mirror of
https://github.com/rust-windowing/winit.git
synced 2026-08-31 13:50:05 -04: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:
@@ -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),
|
||||||
|
|||||||
Reference in New Issue
Block a user