diff --git a/Cargo.toml b/Cargo.toml index 40fae0fb..4252a1b5 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -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" diff --git a/src/api/wayland/window.rs b/src/api/wayland/window.rs index aa71bc3b..f08e17cd 100644 --- a/src/api/wayland/window.rs +++ b/src/api/wayland/window.rs @@ -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(); }