summaryrefslogtreecommitdiffstats
path: root/meta/recipes-graphics/wayland/weston/0004-desktop-shell-Embed-keyboard-focus-handle-code-when-.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-graphics/wayland/weston/0004-desktop-shell-Embed-keyboard-focus-handle-code-when-.patch')
-rw-r--r--meta/recipes-graphics/wayland/weston/0004-desktop-shell-Embed-keyboard-focus-handle-code-when-.patch99
1 files changed, 99 insertions, 0 deletions
diff --git a/meta/recipes-graphics/wayland/weston/0004-desktop-shell-Embed-keyboard-focus-handle-code-when-.patch b/meta/recipes-graphics/wayland/weston/0004-desktop-shell-Embed-keyboard-focus-handle-code-when-.patch
new file mode 100644
index 0000000000..7ca72f8494
--- /dev/null
+++ b/meta/recipes-graphics/wayland/weston/0004-desktop-shell-Embed-keyboard-focus-handle-code-when-.patch
@@ -0,0 +1,99 @@
1From 899ad5a6a8a92f2c10e0694a45c982b7d878aed6 Mon Sep 17 00:00:00 2001
2From: Marius Vlad <marius.vlad@collabora.com>
3Date: Fri, 5 Mar 2021 21:44:26 +0200
4Subject: [PATCH 4/5] desktop-shell: Embed keyboard focus handle code when
5 activating
6
7We shouldn't be constrained by having a keyboard plugged-in, so avoid
8activating/de-activating the window/surface in the keyboard focus
9handler and embed it straight into the window activation part.
10
11Upstream-Status: Backport [f12697bb3e4c6eb85437ed905e7de44ae2a0ba69]
12Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
13---
14 desktop-shell/shell.c | 41 +++++++++++++++++++++++++----------------
15 1 file changed, 25 insertions(+), 16 deletions(-)
16
17diff --git a/desktop-shell/shell.c b/desktop-shell/shell.c
18index c4669f11..c6a4fe91 100644
19--- a/desktop-shell/shell.c
20+++ b/desktop-shell/shell.c
21@@ -1885,22 +1885,7 @@ shell_surface_activate(struct shell_surface *shsurf)
22 static void
23 handle_keyboard_focus(struct wl_listener *listener, void *data)
24 {
25- struct weston_keyboard *keyboard = data;
26- struct shell_seat *seat = get_shell_seat(keyboard->seat);
27-
28- if (seat->focused_surface) {
29- struct shell_surface *shsurf = get_shell_surface(seat->focused_surface);
30- if (shsurf)
31- shell_surface_deactivate(shsurf);
32- }
33-
34- seat->focused_surface = weston_surface_get_main_surface(keyboard->focus);
35-
36- if (seat->focused_surface) {
37- struct shell_surface *shsurf = get_shell_surface(seat->focused_surface);
38- if (shsurf)
39- shell_surface_activate(shsurf);
40- }
41+ /* FIXME: To be removed later. */
42 }
43
44 /* The surface will be inserted into the list immediately after the link
45@@ -2438,6 +2423,7 @@ desktop_surface_removed(struct weston_desktop_surface *desktop_surface,
46 struct shell_surface *shsurf_child, *tmp;
47 struct weston_surface *surface =
48 weston_desktop_surface_get_surface(desktop_surface);
49+ struct weston_seat *seat;
50
51 if (!shsurf)
52 return;
53@@ -2448,6 +2434,18 @@ desktop_surface_removed(struct weston_desktop_surface *desktop_surface,
54 }
55 wl_list_remove(&shsurf->children_link);
56
57+ wl_list_for_each(seat, &shsurf->shell->compositor->seat_list, link) {
58+ struct shell_seat *shseat = get_shell_seat(seat);
59+ /* activate() controls the focused surface activation and
60+ * removal of a surface requires invalidating the
61+ * focused_surface to avoid activate() use a stale (and just
62+ * removed) surface when attempting to de-activate it. It will
63+ * also update the focused_surface once it has a chance to run.
64+ */
65+ if (surface == shseat->focused_surface)
66+ shseat->focused_surface = NULL;
67+ }
68+
69 wl_signal_emit(&shsurf->destroy_signal, shsurf);
70
71 if (shsurf->fullscreen.black_view)
72@@ -3836,6 +3834,7 @@ activate(struct desktop_shell *shell, struct weston_view *view,
73 struct workspace *ws;
74 struct weston_surface *old_es;
75 struct shell_surface *shsurf, *shsurf_child;
76+ struct shell_seat *shseat = get_shell_seat(seat);
77
78 main_surface = weston_surface_get_main_surface(es);
79 shsurf = get_shell_surface(main_surface);
80@@ -3855,6 +3854,16 @@ activate(struct desktop_shell *shell, struct weston_view *view,
81
82 weston_view_activate(view, seat, flags);
83
84+ if (shseat->focused_surface) {
85+ struct shell_surface *current_focus =
86+ get_shell_surface(shseat->focused_surface);
87+ assert(current_focus);
88+ shell_surface_deactivate(current_focus);
89+ }
90+
91+ shseat->focused_surface = main_surface;
92+ shell_surface_activate(shsurf);
93+
94 state = ensure_focus_state(shell, seat);
95 if (state == NULL)
96 return;
97--
982.34.1
99