aboutsummaryrefslogtreecommitdiff
path: root/sway
diff options
context:
space:
mode:
authorRonan Pigott <rpigott@berkeley.edu>2020-08-03 12:22:03 -0700
committerSimon Ser <contact@emersion.fr>2020-08-05 11:05:49 +0200
commitb7f28cd6b7a421712f3ebb19972e9d501e96be2d (patch)
tree811b08d07dcd06a8bd4825a3e06d5450116b4218 /sway
parentf478f4cc6663f9519281f08334f1f27e3182b022 (diff)
downloadsway-b7f28cd6b7a421712f3ebb19972e9d501e96be2d.tar.xz
view: remove foreign toplevel listeners on destroy
Diffstat (limited to 'sway')
-rw-r--r--sway/tree/view.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/sway/tree/view.c b/sway/tree/view.c
index b1837242..7bba2923 100644
--- a/sway/tree/view.c
+++ b/sway/tree/view.c
@@ -670,6 +670,17 @@ static void handle_foreign_close_request(
view_close(view);
}
+static void handle_foreign_destroy(
+ struct wl_listener *listener, void *data) {
+ struct sway_view *view = wl_container_of(
+ listener, view, foreign_destroy);
+
+ wl_list_remove(&view->foreign_activate_request.link);
+ wl_list_remove(&view->foreign_fullscreen_request.link);
+ wl_list_remove(&view->foreign_close_request.link);
+ wl_list_remove(&view->foreign_destroy.link);
+}
+
void view_map(struct sway_view *view, struct wlr_surface *wlr_surface,
bool fullscreen, struct wlr_output *fullscreen_output,
bool decoration) {
@@ -709,6 +720,9 @@ void view_map(struct sway_view *view, struct wlr_surface *wlr_surface,
view->foreign_close_request.notify = handle_foreign_close_request;
wl_signal_add(&view->foreign_toplevel->events.request_close,
&view->foreign_close_request);
+ view->foreign_destroy.notify = handle_foreign_destroy;
+ wl_signal_add(&view->foreign_toplevel->events.destroy,
+ &view->foreign_destroy);
// If we're about to launch the view into the floating container, then
// launch it as a tiled view in the root of the workspace instead.