Implement win32 workaround for multi_window application as well. Also trigger AboutToWait for Moved as well.
This commit is contained in:
parent
dc2cba9264
commit
3a80fece32
2 changed files with 32 additions and 3 deletions
|
|
@ -250,7 +250,8 @@ where
|
||||||
if matches!(
|
if matches!(
|
||||||
event,
|
event,
|
||||||
winit::event::Event::WindowEvent {
|
winit::event::Event::WindowEvent {
|
||||||
event: winit::event::WindowEvent::Resized(_),
|
event: winit::event::WindowEvent::Resized(_)
|
||||||
|
| winit::event::WindowEvent::Moved(_),
|
||||||
..
|
..
|
||||||
}
|
}
|
||||||
) {
|
) {
|
||||||
|
|
|
||||||
|
|
@ -211,7 +211,7 @@ where
|
||||||
|
|
||||||
let mut context = task::Context::from_waker(task::noop_waker_ref());
|
let mut context = task::Context::from_waker(task::noop_waker_ref());
|
||||||
|
|
||||||
let _ = event_loop.run(move |event, event_loop| {
|
let process_event = move |event, event_loop: &winit::event_loop::EventLoopWindowTarget<_>| {
|
||||||
if event_loop.exiting() {
|
if event_loop.exiting() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -280,7 +280,35 @@ where
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
});
|
};
|
||||||
|
|
||||||
|
#[cfg(not(target_os = "windows"))]
|
||||||
|
let _ = event_loop.run(process_event);
|
||||||
|
|
||||||
|
// TODO: Remove when unnecessary
|
||||||
|
// On Windows, we emulate an `AboutToWait` event after every `Resized` event
|
||||||
|
// since the event loop does not resume during resize interaction.
|
||||||
|
// More details: https://github.com/rust-windowing/winit/issues/3272
|
||||||
|
#[cfg(target_os = "windows")]
|
||||||
|
{
|
||||||
|
let mut process_event = process_event;
|
||||||
|
|
||||||
|
let _ = event_loop.run(move |event, event_loop| {
|
||||||
|
if matches!(
|
||||||
|
event,
|
||||||
|
winit::event::Event::WindowEvent {
|
||||||
|
event: winit::event::WindowEvent::Resized(_)
|
||||||
|
| winit::event::WindowEvent::Moved(_),
|
||||||
|
..
|
||||||
|
}
|
||||||
|
) {
|
||||||
|
process_event(event, event_loop);
|
||||||
|
process_event(winit::event::Event::AboutToWait, event_loop);
|
||||||
|
} else {
|
||||||
|
process_event(event, event_loop);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue