Implement set_cursor_position() on X11

This commit is contained in:
Pierre Krieger 2015-04-07 21:54:53 +02:00
parent 68856c3add
commit 5a31b2e438
2 changed files with 10 additions and 2 deletions

View file

@ -1485,6 +1485,10 @@ extern "C" {
pointer_mode: libc::c_int, keyboard_mode: libc::c_int, confine_to: Window, cursor: Cursor, pointer_mode: libc::c_int, keyboard_mode: libc::c_int, confine_to: Window, cursor: Cursor,
time: Time) -> libc::c_int; time: Time) -> libc::c_int;
pub fn XUngrabPointer(dpy: *mut Display, time: Time); 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);
} }
/* /*

View file

@ -825,7 +825,11 @@ impl Window {
1.0 1.0
} }
pub fn set_cursor_position(&self, _x: i32, _y: i32) -> Result<(), ()> { pub fn set_cursor_position(&self, x: i32, y: i32) -> Result<(), ()> {
unimplemented!(); unsafe {
ffi::XWarpPointer(self.x.display, 0, self.x.window, 0, 0, 0, 0, x, y);
}
Ok(())
} }
} }