Fix the way Wayland reads handle the WouldBlock error

This commit is contained in:
Gergő Sályi 2025-04-23 22:19:12 +02:00
parent 34af123af8
commit cd22b9bebe

View file

@ -253,9 +253,20 @@ fn handle_wayland_event(
event_queue: &mut EventQueue<State>, event_queue: &mut EventQueue<State>,
read_guard: ReadEventsGuard, read_guard: ReadEventsGuard,
) { ) {
read_guard.read().expect("Failed to read Wayland events"); match read_guard.read() {
event_queue.dispatch_pending(state) Ok(_) => {
.expect("Failed to dispatch pending Wayland events"); event_queue.dispatch_pending(state)
.expect("Failed to dispatch pending Wayland events");
},
Err(error) => {
if let WaylandError::Io(io_error) = &error {
if io_error.kind() == io::ErrorKind::WouldBlock {
return
}
}
panic!("Failed to read Wayland events: {error}");
}
}
} }
fn handle_sway_event( fn handle_sway_event(