mirror of
https://github.com/italicsjenga/winit-sonoma-fix.git
synced 2024-12-24 22:31:30 +11:00
Remove unnecessary locking
For X11 interrupt, we can just use the root window which doesn't require taking a lock to find.
This commit is contained in:
parent
6c5bc52a5f
commit
46057d7122
|
@ -105,22 +105,9 @@ impl EventsLoop {
|
|||
self.interrupted.store(true, ::std::sync::atomic::Ordering::Relaxed);
|
||||
|
||||
// Push an event on the X event queue so that methods like run_forever will advance.
|
||||
|
||||
// Get a window for the event.
|
||||
//
|
||||
// It should not matter which window is used since the purpose is merely
|
||||
// to advance the event loop.
|
||||
let window = {
|
||||
let windows = self.windows.lock().unwrap();
|
||||
match windows.keys().nth(0) {
|
||||
Some(window_id) => window_id.0,
|
||||
None => return
|
||||
}
|
||||
};
|
||||
|
||||
let mut xev = ffi::XClientMessageEvent {
|
||||
type_: ffi::ClientMessage,
|
||||
window: window,
|
||||
window: self.root,
|
||||
format: 32,
|
||||
message_type: 0,
|
||||
serial: 0,
|
||||
|
@ -130,7 +117,7 @@ impl EventsLoop {
|
|||
};
|
||||
|
||||
unsafe {
|
||||
(self.display.xlib.XSendEvent)(self.display.display, window, 0, 0, mem::transmute(&mut xev));
|
||||
(self.display.xlib.XSendEvent)(self.display.display, self.root, 0, 0, mem::transmute(&mut xev));
|
||||
(self.display.xlib.XFlush)(self.display.display);
|
||||
self.display.check_errors().expect("Failed to call XSendEvent after wakeup");
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue