aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPierre Krieger <pierre.krieger1708@gmail.com>2015-03-26 17:33:49 +0100
committerPierre Krieger <pierre.krieger1708@gmail.com>2015-03-28 10:30:46 +0100
commitaaa1c76841f2b895785e0c34ecd8d0c99e16ab23 (patch)
tree1a254ea3b728b046352733461f2bce66b33280d4 /src
parent3d692870e25521871067e9756804127bd80f584d (diff)
downloadglutin-aaa1c76841f2b895785e0c34ecd8d0c99e16ab23.tar.gz
glutin-aaa1c76841f2b895785e0c34ecd8d0c99e16ab23.zip
Fix compilation on x11
Diffstat (limited to 'src')
-rw-r--r--src/x11/window/mod.rs13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/x11/window/mod.rs b/src/x11/window/mod.rs
index 4c2fae8..7c93ad3 100644
--- a/src/x11/window/mod.rs
+++ b/src/x11/window/mod.rs
@@ -283,7 +283,7 @@ pub struct Window {
current_size: Cell<(libc::c_int, libc::c_int)>,
/// Events that have been retreived with XLib but not dispatched with iterators yet
pending_events: Mutex<VecDeque<Event>>,
- cursor_state: CursorState,
+ cursor_state: Mutex<CursorState>,
}
impl Window {
@@ -603,7 +603,7 @@ impl Window {
wm_delete_window: wm_delete_window,
current_size: Cell::new((0, 0)),
pending_events: Mutex::new(VecDeque::new()),
- cursor_state: CursorState::Normal,
+ cursor_state: Mutex::new(CursorState::Normal),
};
// returning
@@ -786,17 +786,20 @@ impl Window {
}
pub fn set_cursor_state(&self, state: CursorState) -> Result<(), String> {
- match (state, self.cursor_state) {
+ let mut cursor_state = self.cursor_state.lock().unwrap();
+
+ match (state, *cursor_state) {
(CursorState::Normal, CursorState::Grab) => {
unsafe {
ffi::XUngrabPointer(self.x.display, ffi::CurrentTime);
- self.cursor_state = CursorState::Normal;
+ *cursor_state = CursorState::Normal;
+ Ok(())
}
},
(CursorState::Grab, CursorState::Normal) => {
unsafe {
- self.cursor_state = CursorState::Grab;
+ *cursor_state = CursorState::Grab;
match ffi::XGrabPointer(
self.x.display, self.x.window, false,