mirror of
https://github.com/rust-windowing/winit.git
synced 2026-06-27 07:03:15 -04:00
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.
This commit is contained in:
@@ -285,7 +285,10 @@ impl<T: 'static> EventLoop<T> {
|
||||
|
||||
// Reduce spurious wake-ups.
|
||||
let dispatched_events = self.with_state(|state| state.dispatched_events);
|
||||
if matches!(cause, StartCause::WaitCancelled { .. }) && !dispatched_events {
|
||||
if matches!(cause, StartCause::WaitCancelled { .. })
|
||||
&& !dispatched_events
|
||||
&& timeout.is_none()
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
@@ -497,6 +497,7 @@ impl<T: 'static> EventLoop<T> {
|
||||
// If we don't have any pending `_receiver`
|
||||
if !self.has_pending()
|
||||
&& !matches!(&cause, StartCause::ResumeTimeReached { .. } | StartCause::Poll)
|
||||
&& timeout.is_none()
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user