mirror of
https://github.com/italicsjenga/winit-sonoma-fix.git
synced 2024-12-23 22:01:31 +11:00
X11: Fix multiple RedrawRequested events per event loop iteration (#1758)
* X11: Fix multiple RedrawRequested per event loop iteration * Prevent infinite loop
This commit is contained in:
parent
45e4fd6ec1
commit
cbeb51b436
|
@ -24,7 +24,7 @@ pub use self::{
|
||||||
|
|
||||||
use std::{
|
use std::{
|
||||||
cell::RefCell,
|
cell::RefCell,
|
||||||
collections::HashMap,
|
collections::{HashMap, HashSet},
|
||||||
ffi::CStr,
|
ffi::CStr,
|
||||||
mem::{self, MaybeUninit},
|
mem::{self, MaybeUninit},
|
||||||
ops::Deref,
|
ops::Deref,
|
||||||
|
@ -309,7 +309,13 @@ impl<T: 'static> EventLoop<T> {
|
||||||
}
|
}
|
||||||
// Empty the redraw requests
|
// Empty the redraw requests
|
||||||
{
|
{
|
||||||
|
let mut windows = HashSet::new();
|
||||||
|
|
||||||
while let Ok(window_id) = self.redraw_channel.try_recv() {
|
while let Ok(window_id) = self.redraw_channel.try_recv() {
|
||||||
|
windows.insert(window_id);
|
||||||
|
}
|
||||||
|
|
||||||
|
for window_id in windows {
|
||||||
let window_id = crate::window::WindowId(super::WindowId::X(window_id));
|
let window_id = crate::window::WindowId(super::WindowId::X(window_id));
|
||||||
sticky_exit_callback(
|
sticky_exit_callback(
|
||||||
Event::RedrawRequested(window_id),
|
Event::RedrawRequested(window_id),
|
||||||
|
|
Loading…
Reference in a new issue