diff options
author | Sergio Gómez <sergio.g.delreal@gmail.com> | 2023-05-26 11:29:10 -0500 |
---|---|---|
committer | Marius Vlad <marius.vlad@collabora.com> | 2023-07-27 10:13:48 +0300 |
commit | d53efc6cc3f718dd538cd50a24cf4c5bb95f0c96 (patch) | |
tree | ef1b05016329cd673bedd5dacd3cd2d9a5d5a494 /kiosk-shell | |
parent | beece0215f82885bc97cdf615d6b66b54b9d935d (diff) |
kiosk-shell: Distinguish between 'destroy_signal' and 'parent_destroy_signal'
Currently, the 'parent_destroy_listener' is being paired with
'destroy_signal'. The signal is emitted from kiosk_shell_surface_destroy(),
which is the appropriate place to emit this general-purpose surface destruction
signal.
However, we need to inform the children of the surface destruction before
finding the focus successor and activating it, that is, before calling
find_focus_successor() and kiosk_shell_surface_activate(), which happen before
kiosk_shell_surface_destroy().
Since there are currently other uses for 'destroy_signal' (e.g. in
kiosk-shell-grab.c), don't mess with it and simply add a new
'parent_destroy_signal', placing its emition where we need it.
Signed-off-by: Sergio Gómez <sergio.g.delreal@gmail.com>
Diffstat (limited to 'kiosk-shell')
-rw-r--r-- | kiosk-shell/kiosk-shell.c | 8 | ||||
-rw-r--r-- | kiosk-shell/kiosk-shell.h | 2 |
2 files changed, 9 insertions, 1 deletions
diff --git a/kiosk-shell/kiosk-shell.c b/kiosk-shell/kiosk-shell.c index 53affdd8..b1e02500 100644 --- a/kiosk-shell/kiosk-shell.c +++ b/kiosk-shell/kiosk-shell.c @@ -325,7 +325,7 @@ kiosk_shell_surface_set_parent(struct kiosk_shell_surface *shsurf, if (shsurf->parent) { shsurf->parent_destroy_listener.notify = kiosk_shell_surface_notify_parent_destroy; - wl_signal_add(&shsurf->parent->destroy_signal, + wl_signal_add(&parent->parent_destroy_signal, &shsurf->parent_destroy_listener); if (!kiosk_shell_surface_is_surface_in_tree(shsurf, shroot)) { @@ -432,6 +432,7 @@ kiosk_shell_surface_create(struct kiosk_shell *shell, weston_desktop_surface_set_user_data(desktop_surface, shsurf); wl_signal_init(&shsurf->destroy_signal); + wl_signal_init(&shsurf->parent_destroy_signal); /* start life inserting itself as root of its own surface tree list */ wl_list_init(&shsurf->surface_tree_list); @@ -810,6 +811,11 @@ desktop_surface_removed(struct weston_desktop_surface *desktop_surface, seat = get_kiosk_shell_first_seat(shell); kiosk_seat = get_kiosk_shell_seat(seat); + /* Inform children about destruction of their parent, so that we can + * reparent them and potentially relink surface tree links before + * finding a focus successor and activating a new surface. */ + wl_signal_emit(&shsurf->parent_destroy_signal, shsurf); + if (seat && kiosk_seat) { focus_view = find_focus_successor(&shell->inactive_layer, shsurf, kiosk_seat->focused_surface); diff --git a/kiosk-shell/kiosk-shell.h b/kiosk-shell/kiosk-shell.h index 007c33ab..94360472 100644 --- a/kiosk-shell/kiosk-shell.h +++ b/kiosk-shell/kiosk-shell.h @@ -60,6 +60,8 @@ struct kiosk_shell_surface { struct wl_listener output_destroy_listener; struct wl_signal destroy_signal; + + struct wl_signal parent_destroy_signal; struct wl_listener parent_destroy_listener; struct kiosk_shell_surface *parent; |