mirror of
https://github.com/italicsjenga/winit-sonoma-fix.git
synced 2024-12-24 22:31:30 +11:00
Fix x11 poll_events to drain queue
It was only processing a single event per call. The docs say > Fetches all the events that are pending, calls the callback function > for each of them, and returns. which suggests that was incorrect.
This commit is contained in:
parent
8f9f2352cf
commit
c92ac695af
|
@ -111,16 +111,22 @@ impl EventsLoop {
|
|||
let xlib = &self.display.xlib;
|
||||
|
||||
let mut xev = unsafe { mem::uninitialized() };
|
||||
loop {
|
||||
// Get next event
|
||||
unsafe {
|
||||
// Ensure XNextEvent won't block
|
||||
let count = (xlib.XPending)(self.display.display);
|
||||
if count == 0 {
|
||||
return;
|
||||
break;
|
||||
}
|
||||
|
||||
(xlib.XNextEvent)(self.display.display, &mut xev);
|
||||
}
|
||||
self.process_event(&mut xev, &mut callback);
|
||||
if self.interrupted.load(::std::sync::atomic::Ordering::Relaxed) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub fn run_forever<F>(&self, mut callback: F)
|
||||
|
|
Loading…
Reference in a new issue