1
0
Fork 0
forked from wry/wry

metal: implement tearing

This commit is contained in:
Julian Orth 2024-07-18 15:04:02 +02:00
parent d355059ad9
commit 49f6304716
31 changed files with 726 additions and 51 deletions

View file

@ -287,7 +287,7 @@ pub struct WlSurface {
pub constraints: SmallMap<SeatId, Rc<SeatConstraint>, 1>,
xwayland_serial: Cell<Option<u64>>,
tearing_control: CloneCell<Option<Rc<WpTearingControlV1>>>,
tearing: Cell<bool>,
pub tearing: Cell<bool>,
version: Version,
pub has_content_type_manager: Cell<bool>,
pub content_type: Cell<Option<ContentType>>,
@ -1235,8 +1235,11 @@ impl WlSurface {
self.opaque_region.set(region);
}
}
let mut tearing_changed = false;
if let Some(tearing) = pending.tearing.take() {
self.tearing.set(tearing);
if self.tearing.replace(tearing) != tearing {
tearing_changed = true;
}
}
if let Some(content_type) = pending.content_type.take() {
self.content_type.set(content_type);
@ -1305,6 +1308,13 @@ impl WlSurface {
pending.buffer_damage.clear();
pending.surface_damage.clear();
pending.damage_full = false;
if tearing_changed {
if let Some(tl) = self.toplevel.get() {
if tl.tl_data().is_fullscreen.get() {
self.output.get().update_presentation_type();
}
}
}
Ok(())
}