From 785af26007b804104b2119961d063627170d33ba Mon Sep 17 00:00:00 2001 From: Daniel Stone Date: Tue, 20 Jun 2023 11:46:34 +0100 Subject: [PATCH] desktop-shell: Be more precise with rotation damage When we're rotating a surface, only mark the geometry as dirty after we've actually updated the transformations. Then we can restrict our repaint to just the view itself, not the full compositor. Signed-off-by: Daniel Stone --- desktop-shell/shell.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/desktop-shell/shell.c b/desktop-shell/shell.c index 29973c80..3f945c41 100644 --- a/desktop-shell/shell.c +++ b/desktop-shell/shell.c @@ -3499,7 +3499,6 @@ rotate_grab_motion(struct weston_pointer_grab *grab, r = sqrtf(dx * dx + dy * dy); wl_list_remove(&shsurf->rotation.transform.link); - weston_view_geometry_dirty(shsurf->view); if (r > 20.0f) { struct weston_matrix *matrix = @@ -3523,6 +3522,8 @@ rotate_grab_motion(struct weston_pointer_grab *grab, weston_matrix_init(&rotate->rotation); } + weston_view_geometry_dirty(shsurf->view); + /* We need to adjust the position of the surface * in case it was resized in a rotated state before */ cposx = shsurf->view->geometry.pos_offset.x + cx; @@ -3538,10 +3539,8 @@ rotate_grab_motion(struct weston_pointer_grab *grab, weston_view_set_position(shsurf->view, pos); } - /* Repaint implies weston_view_update_transform(), which - * lazily applies the damage due to rotation update. - */ - weston_compositor_schedule_repaint(surface->compositor); + weston_view_update_transform(shsurf->view); + weston_surface_damage(shsurf->view->surface); } static void