diff options
4 files changed, 191 insertions, 0 deletions
diff --git a/meta/recipes-graphics/wayland/weston/0002-desktop-shell-Remove-no-op-de-activation-of-the-xdg-.patch b/meta/recipes-graphics/wayland/weston/0002-desktop-shell-Remove-no-op-de-activation-of-the-xdg-.patch new file mode 100644 index 0000000000..fb36d3817a --- /dev/null +++ b/meta/recipes-graphics/wayland/weston/0002-desktop-shell-Remove-no-op-de-activation-of-the-xdg-.patch | |||
| @@ -0,0 +1,32 @@ | |||
| 1 | From 5c74a0640e873694bf60a88eceb21f664cb4b8f7 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Marius Vlad <marius.vlad@collabora.com> | ||
| 3 | Date: Fri, 5 Mar 2021 20:03:49 +0200 | ||
| 4 | Subject: [PATCH 2/5] desktop-shell: Remove no-op de-activation of the xdg | ||
| 5 | top-level surface | ||
| 6 | |||
| 7 | The shsurf is calloc'ed so the surface count is always 0. Not only | ||
| 8 | that but the surface is not set as active by default, so there's no | ||
| 9 | need to de-activate it. | ||
| 10 | |||
| 11 | Upstream-Status: Backport [05bef4c18a3e82376a46a4a28d978389c4c0fd0f] | ||
| 12 | Signed-off-by: Marius Vlad <marius.vlad@collabora.com> | ||
| 13 | --- | ||
| 14 | desktop-shell/shell.c | 2 -- | ||
| 15 | 1 file changed, 2 deletions(-) | ||
| 16 | |||
| 17 | diff --git a/desktop-shell/shell.c b/desktop-shell/shell.c | ||
| 18 | index 442a625f..3791be25 100644 | ||
| 19 | --- a/desktop-shell/shell.c | ||
| 20 | +++ b/desktop-shell/shell.c | ||
| 21 | @@ -2427,8 +2427,6 @@ desktop_surface_added(struct weston_desktop_surface *desktop_surface, | ||
| 22 | wl_list_init(&shsurf->children_link); | ||
| 23 | |||
| 24 | weston_desktop_surface_set_user_data(desktop_surface, shsurf); | ||
| 25 | - weston_desktop_surface_set_activated(desktop_surface, | ||
| 26 | - shsurf->focus_count > 0); | ||
| 27 | } | ||
| 28 | |||
| 29 | static void | ||
| 30 | -- | ||
| 31 | 2.34.1 | ||
| 32 | |||
diff --git a/meta/recipes-graphics/wayland/weston/0003-desktop-shell-Rename-gain-lose-keyboard-focus-to-act.patch b/meta/recipes-graphics/wayland/weston/0003-desktop-shell-Rename-gain-lose-keyboard-focus-to-act.patch new file mode 100644 index 0000000000..dcd0700fca --- /dev/null +++ b/meta/recipes-graphics/wayland/weston/0003-desktop-shell-Rename-gain-lose-keyboard-focus-to-act.patch | |||
| @@ -0,0 +1,57 @@ | |||
| 1 | From edb31c456ae3da7ffffefb668a37ab88075c4b67 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Marius Vlad <marius.vlad@collabora.com> | ||
| 3 | Date: Fri, 5 Mar 2021 21:40:22 +0200 | ||
| 4 | Subject: [PATCH 3/5] desktop-shell: Rename gain/lose keyboard focus to | ||
| 5 | activate/de-activate | ||
| 6 | |||
| 7 | This way it better reflects that it handles activation rather that input | ||
| 8 | focus. | ||
| 9 | |||
| 10 | Upstream-Status: Backport [ab39e1d76d4f6715cb300bc37f5c2a0e2d426208] | ||
| 11 | Signed-off-by: Marius Vlad <marius.vlad@collabora.com> | ||
| 12 | --- | ||
| 13 | desktop-shell/shell.c | 8 ++++---- | ||
| 14 | 1 file changed, 4 insertions(+), 4 deletions(-) | ||
| 15 | |||
| 16 | diff --git a/desktop-shell/shell.c b/desktop-shell/shell.c | ||
| 17 | index 3791be25..c4669f11 100644 | ||
| 18 | --- a/desktop-shell/shell.c | ||
| 19 | +++ b/desktop-shell/shell.c | ||
| 20 | @@ -1869,14 +1869,14 @@ handle_pointer_focus(struct wl_listener *listener, void *data) | ||
| 21 | } | ||
| 22 | |||
| 23 | static void | ||
| 24 | -shell_surface_lose_keyboard_focus(struct shell_surface *shsurf) | ||
| 25 | +shell_surface_deactivate(struct shell_surface *shsurf) | ||
| 26 | { | ||
| 27 | if (--shsurf->focus_count == 0) | ||
| 28 | weston_desktop_surface_set_activated(shsurf->desktop_surface, false); | ||
| 29 | } | ||
| 30 | |||
| 31 | static void | ||
| 32 | -shell_surface_gain_keyboard_focus(struct shell_surface *shsurf) | ||
| 33 | +shell_surface_activate(struct shell_surface *shsurf) | ||
| 34 | { | ||
| 35 | if (shsurf->focus_count++ == 0) | ||
| 36 | weston_desktop_surface_set_activated(shsurf->desktop_surface, true); | ||
| 37 | @@ -1891,7 +1891,7 @@ handle_keyboard_focus(struct wl_listener *listener, void *data) | ||
| 38 | if (seat->focused_surface) { | ||
| 39 | struct shell_surface *shsurf = get_shell_surface(seat->focused_surface); | ||
| 40 | if (shsurf) | ||
| 41 | - shell_surface_lose_keyboard_focus(shsurf); | ||
| 42 | + shell_surface_deactivate(shsurf); | ||
| 43 | } | ||
| 44 | |||
| 45 | seat->focused_surface = weston_surface_get_main_surface(keyboard->focus); | ||
| 46 | @@ -1899,7 +1899,7 @@ handle_keyboard_focus(struct wl_listener *listener, void *data) | ||
| 47 | if (seat->focused_surface) { | ||
| 48 | struct shell_surface *shsurf = get_shell_surface(seat->focused_surface); | ||
| 49 | if (shsurf) | ||
| 50 | - shell_surface_gain_keyboard_focus(shsurf); | ||
| 51 | + shell_surface_activate(shsurf); | ||
| 52 | } | ||
| 53 | } | ||
| 54 | |||
| 55 | -- | ||
| 56 | 2.34.1 | ||
| 57 | |||
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 @@ | |||
| 1 | From 899ad5a6a8a92f2c10e0694a45c982b7d878aed6 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Marius Vlad <marius.vlad@collabora.com> | ||
| 3 | Date: Fri, 5 Mar 2021 21:44:26 +0200 | ||
| 4 | Subject: [PATCH 4/5] desktop-shell: Embed keyboard focus handle code when | ||
| 5 | activating | ||
| 6 | |||
| 7 | We shouldn't be constrained by having a keyboard plugged-in, so avoid | ||
| 8 | activating/de-activating the window/surface in the keyboard focus | ||
| 9 | handler and embed it straight into the window activation part. | ||
| 10 | |||
| 11 | Upstream-Status: Backport [f12697bb3e4c6eb85437ed905e7de44ae2a0ba69] | ||
| 12 | Signed-off-by: Marius Vlad <marius.vlad@collabora.com> | ||
| 13 | --- | ||
| 14 | desktop-shell/shell.c | 41 +++++++++++++++++++++++++---------------- | ||
| 15 | 1 file changed, 25 insertions(+), 16 deletions(-) | ||
| 16 | |||
| 17 | diff --git a/desktop-shell/shell.c b/desktop-shell/shell.c | ||
| 18 | index 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 | -- | ||
| 98 | 2.34.1 | ||
| 99 | |||
diff --git a/meta/recipes-graphics/wayland/weston_8.0.0.bb b/meta/recipes-graphics/wayland/weston_8.0.0.bb index 2b120d7404..e647fbc686 100644 --- a/meta/recipes-graphics/wayland/weston_8.0.0.bb +++ b/meta/recipes-graphics/wayland/weston_8.0.0.bb | |||
| @@ -12,6 +12,9 @@ SRC_URI = "https://wayland.freedesktop.org/releases/${BPN}-${PV}.tar.xz \ | |||
| 12 | file://systemd-notify.weston-start \ | 12 | file://systemd-notify.weston-start \ |
| 13 | file://xwayland.weston-start \ | 13 | file://xwayland.weston-start \ |
| 14 | file://0001-weston-launch-Provide-a-default-version-that-doesn-t.patch \ | 14 | file://0001-weston-launch-Provide-a-default-version-that-doesn-t.patch \ |
| 15 | file://0002-desktop-shell-Remove-no-op-de-activation-of-the-xdg-.patch \ | ||
| 16 | file://0003-desktop-shell-Rename-gain-lose-keyboard-focus-to-act.patch \ | ||
| 17 | file://0004-desktop-shell-Embed-keyboard-focus-handle-code-when-.patch \ | ||
| 15 | " | 18 | " |
| 16 | SRC_URI[md5sum] = "53e4810d852df0601d01fd986a5b22b3" | 19 | SRC_URI[md5sum] = "53e4810d852df0601d01fd986a5b22b3" |
| 17 | SRC_URI[sha256sum] = "7518b49b2eaa1c3091f24671bdcc124fd49fc8f1af51161927afa4329c027848" | 20 | SRC_URI[sha256sum] = "7518b49b2eaa1c3091f24671bdcc124fd49fc8f1af51161927afa4329c027848" |
