aboutsummaryrefslogtreecommitdiff
path: root/sway
diff options
context:
space:
mode:
authoremersion <contact@emersion.fr>2018-04-05 17:11:46 -0400
committeremersion <contact@emersion.fr>2018-04-05 17:11:46 -0400
commita528aea2ee87a211edd3e6df83f2d408656430ab (patch)
tree9f042a041131ae16c408e8fed36f13d7fcef634a /sway
parent7ce1038478de99f9328beaa289503826f107ac83 (diff)
Make xwayland surface destroy more foolproof
Diffstat (limited to 'sway')
-rw-r--r--sway/desktop/xwayland.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/sway/desktop/xwayland.c b/sway/desktop/xwayland.c
index 543c914e..0a70b680 100644
--- a/sway/desktop/xwayland.c
+++ b/sway/desktop/xwayland.c
@@ -176,12 +176,6 @@ static void handle_commit(struct wl_listener *listener, void *data) {
view_damage_from(view);
}
-static void handle_destroy(struct wl_listener *listener, void *data) {
- struct sway_xwayland_view *xwayland_view =
- wl_container_of(listener, xwayland_view, destroy);
- view_destroy(&xwayland_view->view);
-}
-
static void handle_unmap(struct wl_listener *listener, void *data) {
struct sway_xwayland_view *xwayland_view =
wl_container_of(listener, xwayland_view, unmap);
@@ -205,6 +199,17 @@ static void handle_map(struct wl_listener *listener, void *data) {
view_map(view, xsurface->surface);
}
+static void handle_destroy(struct wl_listener *listener, void *data) {
+ struct sway_xwayland_view *xwayland_view =
+ wl_container_of(listener, xwayland_view, destroy);
+ struct sway_view *view = &xwayland_view->view;
+ struct wlr_xwayland_surface *xsurface = view->wlr_xwayland_surface;
+ if (xsurface->mapped) {
+ handle_unmap(&xwayland_view->unmap, xsurface);
+ }
+ view_destroy(&xwayland_view->view);
+}
+
static void handle_request_configure(struct wl_listener *listener, void *data) {
struct sway_xwayland_view *xwayland_view =
wl_container_of(listener, xwayland_view, request_configure);