From 573a7aeaf1e38f53e830b914da4f71f904ca8c9e Mon Sep 17 00:00:00 2001 From: Robert Knight Date: Sun, 28 Jun 2015 22:16:43 +0100 Subject: Report focus in/out events under X11 Fixes #377 --- src/api/x11/input.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src/api/x11') 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 { - 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 } } -- cgit v1.2.3