1From e22238d293a882aa5c0c7219378ef03d6aa4db74 Mon Sep 17 00:00:00 2001
2From: Jeffy Chen <jeffy.chen@rock-chips.com>
3Date: Fri, 24 Jun 2022 16:25:11 +0800
4Subject: [PATCH 71/92] desktop-shell: Avoid lowering the requested fullscreen
5 surface
6
7Don't lower itself.
8
9Signed-off-by: Jeffy Chen <jeffy.chen@rock-chips.com>
10---
11 desktop-shell/shell.c | 9 +++++----
12 desktop-shell/shell.h | 3 ++-
13 2 files changed, 7 insertions(+), 5 deletions(-)
14
15diff --git a/desktop-shell/shell.c b/desktop-shell/shell.c
16index 1da402a..08c84c5 100644
17--- a/desktop-shell/shell.c
18+++ b/desktop-shell/shell.c
19@@ -3327,7 +3327,8 @@ rotate_binding(struct weston_pointer *pointer, const struct timespec *time,
20  * the alt-tab switcher, which need to de-promote fullscreen layers. */
21 void
22 lower_fullscreen_layer(struct desktop_shell *shell,
23-		       struct weston_output *lowering_output)
24+		       struct weston_output *lowering_output,
25+		       struct shell_surface *orig_shsurf)
26 {
27 	struct workspace *ws;
28 	struct weston_view *view, *prev;
29@@ -3338,7 +3339,7 @@ lower_fullscreen_layer(struct desktop_shell *shell,
30 				      layer_link.link) {
31 		struct shell_surface *shsurf = get_shell_surface(view->surface);
32
33-		if (!shsurf)
34+		if (!shsurf || shsurf == orig_shsurf)
35 			continue;
36
37 		/* Only lower surfaces which have lowering_output as their fullscreen
38@@ -3405,7 +3406,7 @@ activate(struct desktop_shell *shell, struct weston_view *view,
39 	/* Only demote fullscreen surfaces on the output of activated shsurf.
40 	 * Leave fullscreen surfaces on unrelated outputs alone. */
41 	if (shsurf->output)
42-		lower_fullscreen_layer(shell, shsurf->output);
43+		lower_fullscreen_layer(shell, shsurf->output, shsurf);
44
45 	if (view->surface->flags & SURFACE_NO_FOCUS)
46 		goto no_focus;
47@@ -4234,7 +4235,7 @@ switcher_binding(struct weston_keyboard *keyboard, const struct timespec *time,
48 	wl_list_init(&switcher->listener.link);
49 	wl_array_init(&switcher->minimized_array);
50
51-	lower_fullscreen_layer(switcher->shell, NULL);
52+	lower_fullscreen_layer(switcher->shell, NULL, NULL);
53 	switcher->grab.interface = &switcher_grab;
54 	weston_keyboard_start_grab(keyboard, &switcher->grab);
55 	weston_keyboard_set_focus(keyboard, NULL);
56diff --git a/desktop-shell/shell.h b/desktop-shell/shell.h
57index 6876cf3..3372679 100644
58--- a/desktop-shell/shell.h
59+++ b/desktop-shell/shell.h
60@@ -177,7 +177,8 @@ get_output_work_area(struct desktop_shell *shell,
61
62 void
63 lower_fullscreen_layer(struct desktop_shell *shell,
64-		       struct weston_output *lowering_output);
65+		       struct weston_output *lowering_output,
66+		       struct shell_surface *orig_shsurf);
67
68 void
69 activate(struct desktop_shell *shell, struct weston_view *view,
70--
712.20.1
72
73