mirror of
https://github.com/italicsjenga/winit-sonoma-fix.git
synced 2024-12-24 06:11:30 +11:00
X11: Fix ResumeTimeReached
being fired early (#1505)
* X11: Fix `ResumeTimeReached` being fired early * Update CHANGELOG.md Co-authored-by: Osspial <osspial@gmail.com>
This commit is contained in:
parent
7e04273719
commit
c2aed1979d
|
@ -1,5 +1,7 @@
|
||||||
# Unreleased
|
# Unreleased
|
||||||
|
|
||||||
|
- On X11, fix `ResumeTimeReached` being fired too early.
|
||||||
|
|
||||||
# 0.22.0 (2020-03-09)
|
# 0.22.0 (2020-03-09)
|
||||||
|
|
||||||
- On Windows, fix minor timing issue in wait_until_time_or_msg
|
- On Windows, fix minor timing issue in wait_until_time_or_msg
|
||||||
|
|
|
@ -268,14 +268,16 @@ impl<T: 'static> EventLoop<T> {
|
||||||
{
|
{
|
||||||
let mut control_flow = ControlFlow::default();
|
let mut control_flow = ControlFlow::default();
|
||||||
let mut events = Events::with_capacity(8);
|
let mut events = Events::with_capacity(8);
|
||||||
|
let mut cause = StartCause::Init;
|
||||||
callback(
|
|
||||||
crate::event::Event::NewEvents(crate::event::StartCause::Init),
|
|
||||||
&self.target,
|
|
||||||
&mut control_flow,
|
|
||||||
);
|
|
||||||
|
|
||||||
loop {
|
loop {
|
||||||
|
sticky_exit_callback(
|
||||||
|
crate::event::Event::NewEvents(cause),
|
||||||
|
&self.target,
|
||||||
|
&mut control_flow,
|
||||||
|
&mut callback,
|
||||||
|
);
|
||||||
|
|
||||||
// Process all pending events
|
// Process all pending events
|
||||||
self.drain_events(&mut callback, &mut control_flow);
|
self.drain_events(&mut callback, &mut control_flow);
|
||||||
|
|
||||||
|
@ -326,7 +328,7 @@ impl<T: 'static> EventLoop<T> {
|
||||||
}
|
}
|
||||||
|
|
||||||
let start = Instant::now();
|
let start = Instant::now();
|
||||||
let (mut cause, deadline, timeout);
|
let (deadline, timeout);
|
||||||
|
|
||||||
match control_flow {
|
match control_flow {
|
||||||
ControlFlow::Exit => break,
|
ControlFlow::Exit => break,
|
||||||
|
@ -357,23 +359,12 @@ impl<T: 'static> EventLoop<T> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if self.event_processor.poll() {
|
|
||||||
// If the XConnection already contains buffered events, we don't
|
// If the XConnection already contains buffered events, we don't
|
||||||
// need to wait for data on the socket.
|
// need to wait for data on the socket.
|
||||||
// However, we still need to check for user events.
|
if !self.event_processor.poll() {
|
||||||
self.poll
|
|
||||||
.poll(&mut events, Some(Duration::from_millis(0)))
|
|
||||||
.unwrap();
|
|
||||||
events.clear();
|
|
||||||
|
|
||||||
callback(
|
|
||||||
crate::event::Event::NewEvents(cause),
|
|
||||||
&self.target,
|
|
||||||
&mut control_flow,
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
self.poll.poll(&mut events, timeout).unwrap();
|
self.poll.poll(&mut events, timeout).unwrap();
|
||||||
events.clear();
|
events.clear();
|
||||||
|
}
|
||||||
|
|
||||||
let wait_cancelled = deadline.map_or(false, |deadline| Instant::now() < deadline);
|
let wait_cancelled = deadline.map_or(false, |deadline| Instant::now() < deadline);
|
||||||
|
|
||||||
|
@ -383,13 +374,6 @@ impl<T: 'static> EventLoop<T> {
|
||||||
requested_resume: deadline,
|
requested_resume: deadline,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
callback(
|
|
||||||
crate::event::Event::NewEvents(cause),
|
|
||||||
&self.target,
|
|
||||||
&mut control_flow,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
callback(
|
callback(
|
||||||
|
|
Loading…
Reference in a new issue