1
0
Fork 0
forked from wry/wry

wl_surface: dispatch frame requests from vblank event handlers

This commit is contained in:
Julian Orth 2024-09-11 19:06:07 +02:00
parent 7800488555
commit 3fcc6d6e36
13 changed files with 65 additions and 137 deletions

View file

@ -81,6 +81,7 @@ pub struct OutputNode {
pub title_visible: Cell<bool>,
pub schedule: Rc<OutputSchedule>,
pub latch_event: EventSource<dyn LatchListener>,
pub vblank_event: EventSource<dyn VblankListener>,
pub presentation_event: EventSource<dyn PresentationListener>,
}
@ -88,6 +89,10 @@ pub trait LatchListener {
fn after_latch(self: Rc<Self>);
}
pub trait VblankListener {
fn after_vblank(self: Rc<Self>);
}
pub trait PresentationListener {
fn presented(
self: Rc<Self>,
@ -126,6 +131,12 @@ impl OutputNode {
}
}
pub fn vblank(&self) {
for listener in self.vblank_event.iter() {
listener.after_vblank();
}
}
pub fn presented(&self, tv_sec: u64, tv_nsec: u32, refresh: u32, seq: u64, flags: u32) {
for listener in self.presentation_event.iter() {
listener.presented(self, tv_sec, tv_nsec, refresh, seq, flags);