mirror of
https://github.com/italicsjenga/winit-sonoma-fix.git
synced 2024-12-25 06:41:31 +11:00
Move interrupt flag reset to beginning of run_forever in wayland backend
This commit is contained in:
parent
1523548d3e
commit
fdb1c56366
|
@ -181,6 +181,8 @@ impl EventsLoop {
|
||||||
pub fn run_forever<F>(&self, callback: F)
|
pub fn run_forever<F>(&self, callback: F)
|
||||||
where F: FnMut(::Event)
|
where F: FnMut(::Event)
|
||||||
{
|
{
|
||||||
|
self.interrupted.store(false, ::std::sync::atomic::Ordering::Relaxed);
|
||||||
|
|
||||||
// send pending requests to the server...
|
// send pending requests to the server...
|
||||||
self.ctxt.flush();
|
self.ctxt.flush();
|
||||||
|
|
||||||
|
@ -193,13 +195,7 @@ impl EventsLoop {
|
||||||
let static_cb = unsafe { ::std::mem::transmute(Box::new(callback) as Box<FnMut(_)>) };
|
let static_cb = unsafe { ::std::mem::transmute(Box::new(callback) as Box<FnMut(_)>) };
|
||||||
let old_cb = unsafe { self.sink.lock().unwrap().set_callback(static_cb) };
|
let old_cb = unsafe { self.sink.lock().unwrap().set_callback(static_cb) };
|
||||||
|
|
||||||
loop {
|
while !self.interrupted.load(::std::sync::atomic::Ordering::Relaxed) {
|
||||||
// If `interrupt` was called, break from the loop after resetting the flag.
|
|
||||||
if self.interrupted.load(::std::sync::atomic::Ordering::Relaxed) {
|
|
||||||
self.interrupted.store(false, ::std::sync::atomic::Ordering::Relaxed);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
self.ctxt.dispatch();
|
self.ctxt.dispatch();
|
||||||
evq_guard.dispatch_pending().expect("Wayland connection unexpectedly lost");
|
evq_guard.dispatch_pending().expect("Wayland connection unexpectedly lost");
|
||||||
let ids_guard = self.decorated_ids.lock().unwrap();
|
let ids_guard = self.decorated_ids.lock().unwrap();
|
||||||
|
|
Loading…
Reference in a new issue