1
0
Fork 0
forked from wry/wry

head-management: add tearing-state-v1 extension

This commit is contained in:
Julian Orth 2025-07-13 13:51:08 +02:00
parent aaef75f9f3
commit 4482c3168b
10 changed files with 140 additions and 4 deletions

View file

@ -80,6 +80,8 @@ pub struct HeadState {
pub inherent_non_desktop: bool,
pub override_non_desktop: Option<bool>,
pub vrr: bool,
pub tearing_enabled: bool,
pub tearing_active: bool,
}
impl HeadState {
@ -380,4 +382,28 @@ impl HeadManagers {
}
}
}
pub fn handle_tearing_enabled_change(&self, enabled: bool) {
let state = &mut *self.state.borrow_mut();
state.tearing_enabled = enabled;
for head in self.managers.lock().values() {
skip_in_transaction!(head);
if let Some(ext) = &head.ext.tearing_state_v1 {
ext.send_enabled(state);
head.session.schedule_done();
}
}
}
pub fn handle_tearing_active_change(&self, active: bool) {
let state = &mut *self.state.borrow_mut();
state.tearing_active = active;
for head in self.managers.lock().values() {
skip_in_transaction!(head);
if let Some(ext) = &head.ext.tearing_state_v1 {
ext.send_active(state);
head.session.schedule_done();
}
}
}
}