1*4882a593SmuzhiyunFrom 5deac2606736a2bddbf7724f7019dc7b86276e21 Mon Sep 17 00:00:00 2001
2*4882a593SmuzhiyunFrom: Jeffy Chen <jeffy.chen@rock-chips.com>
3*4882a593SmuzhiyunDate: Fri, 2 Apr 2021 01:50:22 +0800
4*4882a593SmuzhiyunSubject: [PATCH 46/93] desktop-shell: Resize views when work area changed
5*4882a593Smuzhiyun
6*4882a593SmuzhiyunSigned-off-by: Jeffy Chen <jeffy.chen@rock-chips.com>
7*4882a593Smuzhiyun---
8*4882a593Smuzhiyun desktop-shell/shell.c | 14 ++++++++++++++
9*4882a593Smuzhiyun 1 file changed, 14 insertions(+)
10*4882a593Smuzhiyun
11*4882a593Smuzhiyundiff --git a/desktop-shell/shell.c b/desktop-shell/shell.c
12*4882a593Smuzhiyunindex fb410ba..0110ac2 100644
13*4882a593Smuzhiyun--- a/desktop-shell/shell.c
14*4882a593Smuzhiyun+++ b/desktop-shell/shell.c
15*4882a593Smuzhiyun@@ -48,6 +48,10 @@
16*4882a593Smuzhiyun #define DEFAULT_NUM_WORKSPACES 1
17*4882a593Smuzhiyun #define DEFAULT_WORKSPACE_CHANGE_ANIMATION_LENGTH 200
18*4882a593Smuzhiyun
19*4882a593Smuzhiyun+static void
20*4882a593Smuzhiyun+handle_output_resize_layer(struct desktop_shell *shell,
21*4882a593Smuzhiyun+			   struct weston_layer *layer, void *data);
22*4882a593Smuzhiyun+
23*4882a593Smuzhiyun struct focus_state {
24*4882a593Smuzhiyun 	struct desktop_shell *shell;
25*4882a593Smuzhiyun 	struct weston_seat *seat;
26*4882a593Smuzhiyun@@ -2619,6 +2623,7 @@ panel_committed(struct weston_surface *es, int32_t sx, int32_t sy)
27*4882a593Smuzhiyun {
28*4882a593Smuzhiyun 	struct desktop_shell *shell = es->committed_private;
29*4882a593Smuzhiyun 	struct weston_view *view;
30*4882a593Smuzhiyun+	pixman_rectangle32_t old_area, new_area;
31*4882a593Smuzhiyun 	int width, height;
32*4882a593Smuzhiyun 	int x = 0, y = 0;
33*4882a593Smuzhiyun
34*4882a593Smuzhiyun@@ -2638,7 +2643,16 @@ panel_committed(struct weston_surface *es, int32_t sx, int32_t sy)
35*4882a593Smuzhiyun 		break;
36*4882a593Smuzhiyun 	}
37*4882a593Smuzhiyun
38*4882a593Smuzhiyun+	get_output_work_area(shell, view->output, &old_area);
39*4882a593Smuzhiyun 	configure_static_view(view, &shell->panel_layer, x, y);
40*4882a593Smuzhiyun+	get_output_work_area(shell, view->output, &new_area);
41*4882a593Smuzhiyun+
42*4882a593Smuzhiyun+	if (old_area.x == new_area.x && old_area.y == new_area.y &&
43*4882a593Smuzhiyun+	    old_area.width == new_area.width &&
44*4882a593Smuzhiyun+	    old_area.height == new_area.height)
45*4882a593Smuzhiyun+		return;
46*4882a593Smuzhiyun+
47*4882a593Smuzhiyun+	shell_for_each_layer(shell, handle_output_resize_layer, view->output);
48*4882a593Smuzhiyun }
49*4882a593Smuzhiyun
50*4882a593Smuzhiyun static void
51*4882a593Smuzhiyun--
52*4882a593Smuzhiyun2.20.1
53*4882a593Smuzhiyun
54