From bc001e90e988c965776abbd078224c14ac296047 Mon Sep 17 00:00:00 2001 From: emersion Date: Sat, 20 Jan 2018 01:04:35 +0100 Subject: [PATCH] rootston: fix artifacts when un-maximizing a view --- rootston/desktop.c | 4 ++++ rootston/wl_shell.c | 17 +++++++++-------- rootston/xdg_shell_v6.c | 17 +++++++++-------- rootston/xwayland.c | 18 +++++++++--------- 4 files changed, 31 insertions(+), 25 deletions(-) diff --git a/rootston/desktop.c b/rootston/desktop.c index faaefd05..e36ae6a4 100644 --- a/rootston/desktop.c +++ b/rootston/desktop.c @@ -298,6 +298,10 @@ void view_damage_whole(struct roots_view *view) { } void view_update_position(struct roots_view *view, double x, double y) { + if (view->x == x && view->y == y) { + return; + } + view_damage_whole(view); view->x = x; view->y = y; diff --git a/rootston/wl_shell.c b/rootston/wl_shell.c index 25ef9a3c..f7b09db0 100644 --- a/rootston/wl_shell.c +++ b/rootston/wl_shell.c @@ -88,22 +88,23 @@ static void handle_surface_commit(struct wl_listener *listener, void *data) { struct roots_view *view = roots_surface->view; struct wlr_surface *wlr_surface = view->wlr_surface; + view_apply_damage(view); + int width = wlr_surface->current->width; int height = wlr_surface->current->height; + double x = view->x; + double y = view->y; if (view->pending_move_resize.update_x) { - double x = view->pending_move_resize.x + - view->pending_move_resize.width - width; - view_update_position(view, x, view->y); + x = view->pending_move_resize.x + view->pending_move_resize.width - + width; view->pending_move_resize.update_x = false; } if (view->pending_move_resize.update_y) { - double y = view->pending_move_resize.y + - view->pending_move_resize.height - height; - view_update_position(view, view->x, y); + y = view->pending_move_resize.y + view->pending_move_resize.height - + height; view->pending_move_resize.update_y = false; } - - view_apply_damage(view); + view_update_position(view, x, y); } static void handle_destroy(struct wl_listener *listener, void *data) { diff --git a/rootston/xdg_shell_v6.c b/rootston/xdg_shell_v6.c index 225886ad..295be6a2 100644 --- a/rootston/xdg_shell_v6.c +++ b/rootston/xdg_shell_v6.c @@ -197,29 +197,30 @@ static void handle_commit(struct wl_listener *listener, void *data) { struct roots_view *view = roots_surface->view; struct wlr_xdg_surface_v6 *surface = view->xdg_surface_v6; + view_apply_damage(view); + uint32_t pending_serial = roots_surface->pending_move_resize_configure_serial; if (pending_serial > 0 && pending_serial >= surface->configure_serial) { struct wlr_box size; get_size(view, &size); + double x = view->x; + double y = view->y; if (view->pending_move_resize.update_x) { - double x = view->pending_move_resize.x + - view->pending_move_resize.width - size.width; - view_update_position(view, x, view->y); + x = view->pending_move_resize.x + view->pending_move_resize.width - + size.width; } if (view->pending_move_resize.update_y) { - double y = view->pending_move_resize.y + - view->pending_move_resize.height - size.height; - view_update_position(view, view->x, y); + y = view->pending_move_resize.y + view->pending_move_resize.height - + size.height; } + view_update_position(view, x, y); if (pending_serial == surface->configure_serial) { roots_surface->pending_move_resize_configure_serial = 0; } } - - view_apply_damage(view); } static void handle_destroy(struct wl_listener *listener, void *data) { diff --git a/rootston/xwayland.c b/rootston/xwayland.c index 856c3d70..81f91b4f 100644 --- a/rootston/xwayland.c +++ b/rootston/xwayland.c @@ -204,23 +204,23 @@ static void handle_surface_commit(struct wl_listener *listener, void *data) { struct roots_view *view = roots_surface->view; struct wlr_surface *wlr_surface = view->wlr_surface; + view_apply_damage(view); + int width = wlr_surface->current->width; int height = wlr_surface->current->height; - + double x = view->x; + double y = view->y; if (view->pending_move_resize.update_x) { - double x = view->pending_move_resize.x + - view->pending_move_resize.width - width; - view_update_position(view, x, view->y); + x = view->pending_move_resize.x + view->pending_move_resize.width - + width; view->pending_move_resize.update_x = false; } if (view->pending_move_resize.update_y) { - double y = view->pending_move_resize.y + - view->pending_move_resize.height - height; - view_update_position(view, view->x, y); + y = view->pending_move_resize.y + view->pending_move_resize.height - + height; view->pending_move_resize.update_y = false; } - - view_apply_damage(view); + view_update_position(view, x, y); } static void handle_map_notify(struct wl_listener *listener, void *data) {