mirror of
https://github.com/italicsjenga/winit-sonoma-fix.git
synced 2024-12-23 22:01:31 +11:00
wayland: properly fetch new events with Window::poll_events()
This commit is contained in:
parent
0663269482
commit
76f5613496
|
@ -39,7 +39,7 @@ kernel32-sys = "0.2"
|
|||
dwmapi-sys = "0.1"
|
||||
|
||||
[target.'cfg(any(target_os = "linux", target_os = "dragonfly", target_os = "freebsd", target_os = "openbsd"))'.dependencies]
|
||||
wayland-client = { version = "0.7.3", features = ["dlopen"] }
|
||||
wayland-client = { version = "0.7.4", features = ["dlopen"] }
|
||||
wayland-kbd = "0.6.2"
|
||||
wayland-window = "0.4.2"
|
||||
x11-dl = "2.8"
|
||||
|
|
|
@ -134,11 +134,20 @@ impl Window {
|
|||
};
|
||||
if evt.is_some() { return evt }
|
||||
|
||||
// There is no event in the queue, we need to fetch more
|
||||
|
||||
// flush the display
|
||||
self.ctxt.flush();
|
||||
|
||||
// read some events if some are waiting & queue is empty
|
||||
if let Some(guard) = self.evq.lock().unwrap().prepare_read() {
|
||||
guard.read_events();
|
||||
}
|
||||
|
||||
// try a pending dispatch
|
||||
// TODO: insert a non-blocking read from socket, overwise no new events will ever come
|
||||
{
|
||||
self.ctxt.dispatch_pending();
|
||||
let mut guard = self.evq.lock().unwrap().dispatch_pending();
|
||||
self.evq.lock().unwrap().dispatch_pending();
|
||||
// some events were dispatched, need to process a potential resising
|
||||
self.process_resize();
|
||||
}
|
||||
|
@ -153,7 +162,7 @@ impl Window {
|
|||
{
|
||||
self.ctxt.flush();
|
||||
self.ctxt.dispatch();
|
||||
let mut guard = self.evq.lock().unwrap().dispatch_pending();
|
||||
self.evq.lock().unwrap().dispatch_pending();
|
||||
// some events were dispatched, need to process a potential resising
|
||||
self.process_resize();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue