1
0
Fork 0
forked from wry/wry

wl_surface: dispatch presentation feedback via presented events

This commit is contained in:
Julian Orth 2024-09-11 21:19:30 +02:00
parent 01331afc6d
commit 7800488555
9 changed files with 117 additions and 47 deletions

View file

@ -81,12 +81,25 @@ pub struct OutputNode {
pub title_visible: Cell<bool>,
pub schedule: Rc<OutputSchedule>,
pub latch_event: EventSource<dyn LatchListener>,
pub presentation_event: EventSource<dyn PresentationListener>,
}
pub trait LatchListener {
fn after_latch(self: Rc<Self>);
}
pub trait PresentationListener {
fn presented(
self: Rc<Self>,
output: &OutputNode,
tv_sec: u64,
tv_nsec: u32,
refresh: u32,
seq: u64,
flags: u32,
);
}
#[derive(Copy, Clone, Debug, Eq, PartialEq, Hash)]
pub enum PointerType {
Seat(SeatId),
@ -113,6 +126,12 @@ impl OutputNode {
}
}
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);
}
}
pub fn update_exclusive_zones(self: &Rc<Self>) {
let mut exclusive = ExclusiveSize::default();
for layer in &self.layers {