mirror of
https://github.com/rust-windowing/winit.git
synced 2026-06-27 07:03:15 -04:00
On X11, fix WaitUntil and Poll behavior
Co-authored-by: Kirill Chibisov <contact@kchibisov.com>
This commit is contained in:
@@ -505,18 +505,6 @@ impl<T: 'static> EventLoop<T> {
|
||||
return;
|
||||
}
|
||||
|
||||
// False positive / spurious wake ups could lead to us spamming
|
||||
// redundant iterations of the event loop with no new events to
|
||||
// dispatch.
|
||||
//
|
||||
// If there's no readable event source then we just double check if we
|
||||
// have any pending `_receiver` events and if not we return without
|
||||
// running a loop iteration.
|
||||
// If we don't have any pending `_receiver`
|
||||
if !self.has_pending() && !self.state.x11_readiness.readable {
|
||||
return;
|
||||
}
|
||||
|
||||
// NB: `StartCause::Init` is handled as a special case and doesn't need
|
||||
// to be considered here
|
||||
let cause = match self.control_flow() {
|
||||
@@ -540,6 +528,23 @@ impl<T: 'static> EventLoop<T> {
|
||||
}
|
||||
};
|
||||
|
||||
// False positive / spurious wake ups could lead to us spamming
|
||||
// redundant iterations of the event loop with no new events to
|
||||
// dispatch.
|
||||
//
|
||||
// If there's no readable event source then we just double check if we
|
||||
// have any pending `_receiver` events and if not we return without
|
||||
// running a loop iteration.
|
||||
// If we don't have any pending `_receiver`
|
||||
if !self.has_pending()
|
||||
&& !matches!(
|
||||
&cause,
|
||||
StartCause::ResumeTimeReached { .. } | StartCause::Poll
|
||||
)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
self.single_iteration(&mut callback, cause);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user