Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 15 additions & 3 deletions winit-wayland/src/event_loop/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -264,9 +264,21 @@ impl EventLoop {
//
// Checking for flush error is essential to perform an exit with error, since
// once we have a protocol error, we could get stuck retrying...
if self.handle.connection.flush().is_err() {
self.set_exit_code(1);
return;
match self.handle.connection.flush() {
Ok(()) => {},
Err(sctk::reexports::client::backend::WaylandError::Io(e))
if e.kind() == std::io::ErrorKind::WouldBlock =>
{
// EAGAIN/WouldBlock from the kernel socket: SO_SNDBUF is full.
// libwayland documents this as recoverable back-pressure — the
// poll(POLLOUT) on the next loop iteration will drain the buffer
// and we can retry. Mirrors the pattern in
// calloop-wayland-source's `flush_queue`.
},
Err(_) => {
self.set_exit_code(1);
return;
},
}

if let Err(error) = self.loop_dispatch(timeout) {
Expand Down
5 changes: 5 additions & 0 deletions winit/src/changelog/unreleased.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,3 +61,8 @@ changelog entry.
- On Wayland, switch from using the `ahash` hashing algorithm to `foldhash`.
- On macOS, fix borderless game presentation options not sticking after switching spaces.
- On macOS, fix IME being locked on (regardless of requests to disable) after being enabled once.
- On Wayland, treat `wl_display.flush()` returning `WouldBlock` as
recoverable back-pressure rather than a fatal error. Previously the
event loop would exit with code 1 on transient kernel send-buffer
saturation; it now retries on the next loop iteration as libwayland
documents.
Loading