From 83b7d0cb4f30c95ce6f27d2c0944727d75eb6e5e Mon Sep 17 00:00:00 2001 From: Matias Linares Date: Sun, 22 Nov 2015 20:02:10 -0300 Subject: Death to the threads. All the socket stuff is done syncing it with select calls so we can get either a X11 event or a Socket event. Also cleanup the C mess, it's done all in rust now :). --- src/safe_x11/event.rs | 33 --------------------------------- 1 file changed, 33 deletions(-) delete mode 100644 src/safe_x11/event.rs (limited to 'src/safe_x11/event.rs') diff --git a/src/safe_x11/event.rs b/src/safe_x11/event.rs deleted file mode 100644 index 8a4bc32..0000000 --- a/src/safe_x11/event.rs +++ /dev/null @@ -1,33 +0,0 @@ -use x11::xlib::{ - XConnectionNumber, - Display, - XEvent, -}; - -use std::mem::uninitialized; - -use libc::c_int; - -#[link(name = "safex11")] -extern { - /// Get an XEvent if there're one on the queue or wait a little before continue. - fn select_next_event(display: *mut Display, x11_fd: c_int, ev: *mut XEvent) -> c_int; -} - -/// Get the file descriptor for the XServer -pub fn x11_fd(display: *mut Display) -> c_int { - unsafe { XConnectionNumber(display) } -} - -/// Get the next event from the xserver. This call will not block forever -/// (like XNextEvent), instead it will wait for a certain time (1 second -/// for now, but it can change) so we're not blocking the socket interface -/// on the main thread. -pub fn next_xevent(display: *mut Display, fd: c_int) -> XEvent { - unsafe { - let mut last_event: XEvent = uninitialized(); - select_next_event(display, fd, &mut last_event) as i32; - last_event - } -} - -- cgit v1.2.3-70-g09d2