1From 9e3e9e3585879693df47719afa7bbd06f712e86b 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 72/79] 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/exposay.c | 2 +-
12 desktop-shell/shell.c   | 9 +++++----
13 desktop-shell/shell.h   | 3 ++-
14 3 files changed, 8 insertions(+), 6 deletions(-)
15
16diff --git a/desktop-shell/exposay.c b/desktop-shell/exposay.c
17index c7c064b..0981f1a 100644
18--- a/desktop-shell/exposay.c
19+++ b/desktop-shell/exposay.c
20@@ -646,7 +646,7 @@ exposay_transition_active(struct desktop_shell *shell)
21 	shell->exposay.clicked = NULL;
22 	wl_list_init(&shell->exposay.surface_list);
23
24-	lower_fullscreen_layer(shell, NULL);
25+	lower_fullscreen_layer(shell, NULL, NULL);
26 	shell->exposay.grab_kbd.interface = &exposay_kbd_grab;
27 	weston_keyboard_start_grab(keyboard,
28 	                           &shell->exposay.grab_kbd);
29diff --git a/desktop-shell/shell.c b/desktop-shell/shell.c
30index bea4d1d..d4879b2 100644
31--- a/desktop-shell/shell.c
32+++ b/desktop-shell/shell.c
33@@ -3747,7 +3747,8 @@ rotate_binding(struct weston_pointer *pointer, const struct timespec *time,
34  * the alt-tab switcher, which need to de-promote fullscreen layers. */
35 void
36 lower_fullscreen_layer(struct desktop_shell *shell,
37-		       struct weston_output *lowering_output)
38+		       struct weston_output *lowering_output,
39+		       struct shell_surface *orig_shsurf)
40 {
41 	struct workspace *ws;
42 	struct weston_view *view, *prev;
43@@ -3758,7 +3759,7 @@ lower_fullscreen_layer(struct desktop_shell *shell,
44 				      layer_link.link) {
45 		struct shell_surface *shsurf = get_shell_surface(view->surface);
46
47-		if (!shsurf)
48+		if (!shsurf || shsurf == orig_shsurf)
49 			continue;
50
51 		/* Only lower surfaces which have lowering_output as their fullscreen
52@@ -3826,7 +3827,7 @@ activate(struct desktop_shell *shell, struct weston_view *view,
53 	/* Only demote fullscreen surfaces on the output of activated shsurf.
54 	 * Leave fullscreen surfaces on unrelated outputs alone. */
55 	if (shsurf->output)
56-		lower_fullscreen_layer(shell, shsurf->output);
57+		lower_fullscreen_layer(shell, shsurf->output, shsurf);
58
59 	if (view->surface->flags & SURFACE_NO_FOCUS)
60 		goto no_focus;
61@@ -4657,7 +4658,7 @@ switcher_binding(struct weston_keyboard *keyboard, const struct timespec *time,
62 	wl_list_init(&switcher->listener.link);
63 	wl_array_init(&switcher->minimized_array);
64
65-	lower_fullscreen_layer(switcher->shell, NULL);
66+	lower_fullscreen_layer(switcher->shell, NULL, NULL);
67 	switcher->grab.interface = &switcher_grab;
68 	weston_keyboard_start_grab(keyboard, &switcher->grab);
69 	weston_keyboard_set_focus(keyboard, NULL);
70diff --git a/desktop-shell/shell.h b/desktop-shell/shell.h
71index e0a0620..269648a 100644
72--- a/desktop-shell/shell.h
73+++ b/desktop-shell/shell.h
74@@ -242,7 +242,8 @@ get_output_work_area(struct desktop_shell *shell,
75
76 void
77 lower_fullscreen_layer(struct desktop_shell *shell,
78-		       struct weston_output *lowering_output);
79+		       struct weston_output *lowering_output,
80+		       struct shell_surface *orig_shsurf);
81
82 void
83 activate(struct desktop_shell *shell, struct weston_view *view,
84--
852.20.1
86
87