mirror of
https://github.com/feschber/lan-mouse.git
synced 2026-09-08 05:21:03 +03:00
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.
This commit is contained in:
committed by
Ferdinand Schober
parent
b316af6a8f
commit
c194df791d
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user