diff options
author | Robert Knight <robert.knight@mendeley.com> | 2015-06-28 22:16:43 +0100 |
---|---|---|
committer | Robert Knight <robert.knight@mendeley.com> | 2015-06-28 22:16:43 +0100 |
commit | 573a7aeaf1e38f53e830b914da4f71f904ca8c9e (patch) | |
tree | bd702f30b23f4c2dc52fcd6def174bac850b0ddf /src/api/x11 | |
parent | edc95d554dd530a810240261d44013f39bef1c6d (diff) | |
download | glutin-573a7aeaf1e38f53e830b914da4f71f904ca8c9e.tar.gz glutin-573a7aeaf1e38f53e830b914da4f71f904ca8c9e.zip |
Report focus in/out events under X11
Fixes #377
Diffstat (limited to 'src/api/x11')
-rw-r--r-- | src/api/x11/input.rs | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/api/x11/input.rs b/src/api/x11/input.rs index 2448c08..25add95 100644 --- a/src/api/x11/input.rs +++ b/src/api/x11/input.rs @@ -86,7 +86,9 @@ impl XInputEventHandler { ffi::XI_ButtonRelease, ffi::XI_Motion, ffi::XI_Enter, - ffi::XI_Leave + ffi::XI_Leave, + ffi::XI_FocusIn, + ffi::XI_FocusOut ]; for event in events { ffi::XISetMask(&mut mask, *event); @@ -159,7 +161,7 @@ impl XInputEventHandler { } pub fn translate_event(&mut self, cookie: &ffi::XGenericEventCookie) -> Option<Event> { - use events::Event::{MouseInput, MouseMoved, MouseWheel}; + use events::Event::{Focused, MouseInput, MouseMoved, MouseWheel}; use events::ElementState::{Pressed, Released}; use events::MouseButton::{Left, Right, Middle}; use events::MouseScrollDelta::{PixelDelta, LineDelta}; @@ -236,6 +238,8 @@ impl XInputEventHandler { None }, ffi::XI_Leave => None, + ffi::XI_FocusIn => Some(Focused(true)), + ffi::XI_FocusOut => Some(Focused(false)), _ => None } } |