From c194df791dc11c79d266ada4d413179d4da3525b Mon Sep 17 00:00:00 2001 From: Ian Douglas Scott Date: Thu, 20 Aug 2026 12:40:30 -0700 Subject: [PATCH] fix(input-capture/layer_shell): Call `read()` on guard only once With `wayland-backend/client_system` enabled, this was causing an infinite loop since `read` never returned `WouldBlock`. This seems to be an inconsistency in wayland-rs: https://github.com/Smithay/wayland-rs/pull/959 In any case, it isn't necessary to call `read` more than once. --- input-capture/src/layer_shell.rs | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/input-capture/src/layer_shell.rs b/input-capture/src/layer_shell.rs index 698c584..ab9d6df 100644 --- a/input-capture/src/layer_shell.rs +++ b/input-capture/src/layer_shell.rs @@ -548,13 +548,12 @@ impl State { } impl Inner { - fn read(&mut self) -> bool { + fn read(&mut self) { match self.state.read_guard.take().unwrap().read() { - Ok(_) => true, - Err(WaylandError::Io(e)) if e.kind() == ErrorKind::WouldBlock => false, + Ok(_) => {} + Err(WaylandError::Io(e)) if e.kind() == ErrorKind::WouldBlock => {} Err(WaylandError::Io(e)) => { log::error!("error reading from wayland socket: {e}"); - false } Err(WaylandError::Protocol(e)) => { panic!("wayland protocol violation: {e}") @@ -655,13 +654,7 @@ impl Stream for LayerShellInputCapture { let inner = guard.get_inner_mut(); // read events - while inner.read() { - // prepare next read - match inner.prepare_read() { - Ok(_) => {} - Err(e) => return Poll::Ready(Some(Err(e.into()))), - } - } + inner.read(); // dispatch the events inner.dispatch_events();