aboutsummaryrefslogtreecommitdiffstats
path: root/src/x11
diff options
context:
space:
mode:
authortomaka <pierre.krieger1708@gmail.com>2015-04-08 09:03:36 +0200
committertomaka <pierre.krieger1708@gmail.com>2015-04-08 09:03:36 +0200
commit41044c160aa47ea705995da0f09fd77148ff67e2 (patch)
treebb4ed591f51867ffae7c5248ead99eff7b4bcae4 /src/x11
parent3da91fbc922385ec44f00dae493dbcb66cdee24b (diff)
parent5a31b2e438a26fb29c7a93d7f47dec76228f1f7c (diff)
downloadglutin-41044c160aa47ea705995da0f09fd77148ff67e2.tar.gz
glutin-41044c160aa47ea705995da0f09fd77148ff67e2.zip
Merge pull request #364 from tomaka/x11-cursor-pos
Implement set_cursor_position() on X11
Diffstat (limited to 'src/x11')
-rw-r--r--src/x11/ffi.rs4
-rw-r--r--src/x11/window/mod.rs8
2 files changed, 10 insertions, 2 deletions
diff --git a/src/x11/ffi.rs b/src/x11/ffi.rs
index e33ea24..c58647f 100644
--- a/src/x11/ffi.rs
+++ b/src/x11/ffi.rs
@@ -1485,6 +1485,10 @@ extern "C" {
pointer_mode: libc::c_int, keyboard_mode: libc::c_int, confine_to: Window, cursor: Cursor,
time: Time) -> libc::c_int;
pub fn XUngrabPointer(dpy: *mut Display, time: Time);
+
+ pub fn XWarpPointer(display: *mut Display, src_w: Window, dest_w: Window, src_x: libc::c_int,
+ src_y: libc::c_int, src_width: libc::c_uint, src_height: libc::c_uint,
+ dest_x: libc::c_int, dest_y: libc::c_int);
}
/*
diff --git a/src/x11/window/mod.rs b/src/x11/window/mod.rs
index 7121ac6..d58b2d2 100644
--- a/src/x11/window/mod.rs
+++ b/src/x11/window/mod.rs
@@ -825,7 +825,11 @@ impl Window {
1.0
}
- pub fn set_cursor_position(&self, _x: i32, _y: i32) -> Result<(), ()> {
- unimplemented!();
+ pub fn set_cursor_position(&self, x: i32, y: i32) -> Result<(), ()> {
+ unsafe {
+ ffi::XWarpPointer(self.x.display, 0, self.x.window, 0, 0, 0, 0, x, y);
+ }
+
+ Ok(())
}
}