aboutsummaryrefslogtreecommitdiffstats
path: root/src/api/x11
diff options
context:
space:
mode:
authortomaka <pierre.krieger1708@gmail.com>2015-05-26 16:11:43 +0200
committertomaka <pierre.krieger1708@gmail.com>2015-05-26 16:11:43 +0200
commita2507b687660ef4179217e063bb5ffce91c32483 (patch)
tree20d0d66a11039a6bf3e9af46790624bfc6d41b50 /src/api/x11
parentd089ea867459bfd7e875a2cd44ae46bac705ae18 (diff)
parent267b2c027a3cbe4fb3188a9afbee3c5008b44b58 (diff)
downloadglutin-a2507b687660ef4179217e063bb5ffce91c32483.tar.gz
glutin-a2507b687660ef4179217e063bb5ffce91c32483.zip
Merge pull request #476 from aepsil0n/x11-cursor-grab-fix
Fix set_cursor_state on X11
Diffstat (limited to 'src/api/x11')
-rw-r--r--src/api/x11/window.rs13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/api/x11/window.rs b/src/api/x11/window.rs
index 38838f5..42134d0 100644
--- a/src/api/x11/window.rs
+++ b/src/api/x11/window.rs
@@ -711,20 +711,22 @@ impl Window {
}
pub fn set_cursor_state(&self, state: CursorState) -> Result<(), String> {
+ use CursorState::{ Grab, Normal };
+
let mut cursor_state = self.cursor_state.lock().unwrap();
match (state, *cursor_state) {
- (CursorState::Normal, CursorState::Grab) => {
+ (Normal, Grab) => {
unsafe {
(self.x.display.xlib.XUngrabPointer)(self.x.display.display, ffi::CurrentTime);
- *cursor_state = CursorState::Normal;
+ *cursor_state = Normal;
Ok(())
}
},
- (CursorState::Grab, CursorState::Normal) => {
+ (Grab, Normal) => {
unsafe {
- *cursor_state = CursorState::Grab;
+ *cursor_state = Grab;
match (self.x.display.xlib.XGrabPointer)(
self.x.display.display, self.x.window, ffi::False,
@@ -745,6 +747,9 @@ impl Window {
}
},
+ // Nothing needs to change
+ (Grab, Grab) | (Normal, Normal) => Ok(()),
+
_ => unimplemented!(),
}
}