1
0
Fork 0
forked from wry/wry

all: implement damage tracking

This commit is contained in:
Julian Orth 2024-07-10 19:58:17 +02:00
parent 76a3c50560
commit bb66abb817
28 changed files with 473 additions and 82 deletions

View file

@ -18,9 +18,13 @@ impl DndIcon {
}
fn update_visible(&self) {
let was_visible = self.surface.visible.get();
let is_visible =
self.surface.dnd_icons.is_not_empty() && self.surface.client.state.root_visible();
self.surface.set_visible(is_visible);
if was_visible != is_visible {
self.damage();
}
}
pub fn enable(self: &Rc<Self>) {
@ -45,6 +49,16 @@ impl DndIcon {
self.surface.extents.get().move_(x, y)
}
pub fn damage(&self) {
let (x, y) = self.seat.pointer_cursor().position_int();
self.damage_at(x, y);
}
pub fn damage_at(&self, x: i32, y: i32) {
let extents = self.extents(x, y);
self.surface.client.state.damage(extents);
}
pub fn render(&self, renderer: &mut Renderer<'_>, cursor_rect: &Rect, x: i32, y: i32) {
let extents = self.extents(x, y);
if extents.intersects(&cursor_rect) {