diff options
author | Marius Vlad <marius.vlad@collabora.com> | 2021-11-23 20:46:37 +0200 |
---|---|---|
committer | Jan-Simon Moeller <jsmoeller@linuxfoundation.org> | 2021-12-10 14:43:51 +0000 |
commit | 6d4038380b39f2047ec269017654208f1c01fbd3 (patch) | |
tree | 06362b578904785f9b164a29544106b4aa87e709 | |
parent | 5101851ecb304e75d536a7e83c92ba890d4e5e83 (diff) |
src/desktop: Add a compositor destroy listener
Tearing down the ivi compositor instance (the shell) requires listening
for such an event and handle any potential destruction of surfaces.
With it we use to destroying any pending surfaces might have been left.
Bug-AGL: SPEC-4133
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Change-Id: I911c590409700374007673da680b7a76f69be1b2
-rw-r--r-- | src/desktop.c | 14 | ||||
-rw-r--r-- | src/ivi-compositor.h | 5 | ||||
-rw-r--r-- | src/shell.c | 2 |
3 files changed, 20 insertions, 1 deletions
diff --git a/src/desktop.c b/src/desktop.c index ac68b78..a0cb2d2 100644 --- a/src/desktop.c +++ b/src/desktop.c @@ -436,6 +436,15 @@ static const struct weston_desktop_api desktop_api = { .set_xwayland_position = desktop_set_xwayland_position, }; +static void +ivi_shell_destroy(struct wl_listener *listener, void *data) +{ + struct ivi_compositor *ivi = container_of(listener, + struct ivi_compositor, destroy_listener); + + ivi_compositor_destroy_pending_surfaces(ivi); +} + int ivi_desktop_init(struct ivi_compositor *ivi) { @@ -445,5 +454,10 @@ ivi_desktop_init(struct ivi_compositor *ivi) return -1; } + if (!weston_compositor_add_destroy_listener_once(ivi->compositor, + &ivi->destroy_listener, ivi_shell_destroy)) { + return -1; + } + return 0; } diff --git a/src/ivi-compositor.h b/src/ivi-compositor.h index 0449eb1..e89d215 100644 --- a/src/ivi-compositor.h +++ b/src/ivi-compositor.h @@ -98,6 +98,8 @@ struct ivi_compositor { struct wl_list split_pending_apps; struct wl_list remote_pending_apps; + struct wl_listener destroy_listener; + struct weston_layer hidden; struct weston_layer background; struct weston_layer normal; @@ -424,4 +426,7 @@ ivi_destroy_waltham_destroy(struct ivi_surface *surface); bool ivi_check_pending_surface(struct ivi_surface *surface); +void +ivi_compositor_destroy_pending_surfaces(struct ivi_compositor *ivi); + #endif diff --git a/src/shell.c b/src/shell.c index 3f528de..6fcdfe8 100644 --- a/src/shell.c +++ b/src/shell.c @@ -1068,7 +1068,7 @@ shell_desktop_set_app_property(struct wl_client *client, } } -static void +void ivi_compositor_destroy_pending_surfaces(struct ivi_compositor *ivi) { struct pending_popup *p_popup, *next_p_popup; |