Clean up and refactor X11 refresh loop (alternative) (#8655)

Associates every window with its own refresh event. Removes the use of
X11 present.
Alternative to #8592.
Instead of doing the rendering on idle and then involving a hack for
polling X11 events, this PR just tries to do the rendering inside the
main loop. This guarantees that we continue to poll for events after the
draw, and not get screwed by the driver talking to X11 via the same file
descriptor.

Release Notes:
- N/A
This commit is contained in:
Dzmitry Malyshau 2024-03-01 16:43:24 -08:00 committed by GitHub
parent b7784d414a
commit 26103e8bb9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 81 additions and 106 deletions

View file

@ -122,18 +122,15 @@ impl Platform for LinuxPlatform {
fn run(&self, on_finish_launching: Box<dyn FnOnce()>) {
on_finish_launching();
self.inner
.event_loop
.borrow_mut()
.run(None, &mut (), |data| {})
.run(None, &mut (), |&mut ()| {})
.expect("Run loop failed");
let mut lock = self.inner.callbacks.borrow_mut();
if let Some(mut fun) = lock.quit.take() {
drop(lock);
if let Some(mut fun) = self.inner.callbacks.borrow_mut().quit.take() {
fun();
let mut lock = self.inner.callbacks.borrow_mut();
lock.quit = Some(fun);
}
}