Skip to content

Commit a4ab7dc

Browse files
authored
x11:wayland: fix pump_events blocking with Wait
Using `Duration::Zero` with `Wait` polling mode was still blocking until the event was actually delivered. Thus when `pump_events` API is used, ensure that it's not happening. Fixes #4130.
1 parent afb731b commit a4ab7dc

File tree

3 files changed

+6
-1
lines changed

3 files changed

+6
-1
lines changed

src/changelog/unreleased.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -240,3 +240,4 @@ changelog entry.
240240
- On macOS, fixed redundant `SurfaceResized` event at window creation.
241241
- On Windows, fixed ~500 ms pause when clicking the title bar during continuous redraw.
242242
- On macos, `WindowExtMacOS::set_simple_fullscreen` now honors `WindowExtMacOS::set_borderless_game`
243+
- On X11 and Wayland, fixed pump_events with `Some(Duration::Zero)` blocking with `Wait` polling mode

src/platform_impl/linux/wayland/event_loop/mod.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,10 @@ impl EventLoop {
272272

273273
// Reduce spurious wake-ups.
274274
let dispatched_events = self.with_state(|state| state.dispatched_events);
275-
if matches!(cause, StartCause::WaitCancelled { .. }) && !dispatched_events {
275+
if matches!(cause, StartCause::WaitCancelled { .. })
276+
&& !dispatched_events
277+
&& timeout.is_none()
278+
{
276279
continue;
277280
}
278281

src/platform_impl/linux/x11/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -568,6 +568,7 @@ impl EventLoop {
568568
// If we don't have any pending `_receiver`
569569
if !self.has_pending()
570570
&& !matches!(&cause, StartCause::ResumeTimeReached { .. } | StartCause::Poll)
571+
&& timeout.is_none()
571572
{
572573
return;
573574
}

0 commit comments

Comments
 (0)