X11: Fix events not being reported when using run_return (#1245)

* X11: Fix events not being reported using `run_return`

* Adapt examples to be more practical

* Add CHANGELOG entry
This commit is contained in:
Murarth 2019-11-10 11:24:43 -07:00 committed by Hal Gentz
parent c66784995d
commit 1ed15c7ec7
5 changed files with 88 additions and 78 deletions

View file

@ -66,6 +66,13 @@ impl<T: 'static> EventProcessor<T> {
self.with_window(window_id, |_| ()).is_some()
}
pub(super) fn poll(&self) -> bool {
let wt = get_xtarget(&self.target);
let result = unsafe { (wt.xconn.xlib.XPending)(wt.xconn.display) };
result != 0
}
pub(super) unsafe fn poll_one_event(&mut self, event_ptr: *mut ffi::XEvent) -> bool {
let wt = get_xtarget(&self.target);
// This function is used to poll and remove a single event