try delaying notify signal

This commit is contained in:
Erica Z 2024-11-06 12:30:02 +01:00
parent 4fd2608eab
commit ba3cd74a68

View file

@ -162,6 +162,10 @@ mod imp {
loop { loop {
let window = window.upgrade().unwrap(); let window = window.upgrade().unwrap();
let listener = window.imp().mpv.wakeup_listener(); let listener = window.imp().mpv.wakeup_listener();
// only send property change notifications after the event queue is drained
let freeze_notify = window.freeze_notify();
while let Some(event) = window.imp().mpv.wait_event(0.0) { while let Some(event) = window.imp().mpv.wait_event(0.0) {
use crate::mpv::Event; use crate::mpv::Event;
@ -186,6 +190,9 @@ mod imp {
_ => event!(Level::DEBUG, "unhandled {event:?}"), _ => event!(Level::DEBUG, "unhandled {event:?}"),
} }
} }
// send property change notifications now
drop(freeze_notify);
drop(window); drop(window);
listener.await; listener.await;
} }