From 9a6c6b5a09605ca97363629709e46f36eb5bbea3 Mon Sep 17 00:00:00 2001 From: Jeffy Chen Date: Fri, 2 Apr 2021 01:50:22 +0800 Subject: [PATCH 43/74] desktop-shell: Resize views when work area changed Signed-off-by: Jeffy Chen --- desktop-shell/shell.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/desktop-shell/shell.c b/desktop-shell/shell.c index 3b6ca7e..4a25734 100644 --- a/desktop-shell/shell.c +++ b/desktop-shell/shell.c @@ -48,6 +48,10 @@ #define DEFAULT_NUM_WORKSPACES 1 #define DEFAULT_WORKSPACE_CHANGE_ANIMATION_LENGTH 200 +static void +handle_output_resize_layer(struct desktop_shell *shell, + struct weston_layer *layer, void *data); + struct focus_state { struct desktop_shell *shell; struct weston_seat *seat; @@ -3052,6 +3056,7 @@ panel_committed(struct weston_surface *es, int32_t sx, int32_t sy) { struct desktop_shell *shell = es->committed_private; struct weston_view *view; + pixman_rectangle32_t old_area, new_area; int width, height; int x = 0, y = 0; @@ -3071,7 +3076,16 @@ panel_committed(struct weston_surface *es, int32_t sx, int32_t sy) break; } + get_output_work_area(shell, view->output, &old_area); configure_static_view(view, &shell->panel_layer, x, y); + get_output_work_area(shell, view->output, &new_area); + + if (old_area.x == new_area.x && old_area.y == new_area.y && + old_area.width == new_area.width && + old_area.height == new_area.height) + return; + + shell_for_each_layer(shell, handle_output_resize_layer, view->output); } static void -- 2.20.1