diff options
author | Ronan Pigott <rpigott@berkeley.edu> | 2020-08-03 12:22:03 -0700 |
---|---|---|
committer | Simon Ser <contact@emersion.fr> | 2020-08-05 11:05:49 +0200 |
commit | b7f28cd6b7a421712f3ebb19972e9d501e96be2d (patch) | |
tree | 811b08d07dcd06a8bd4825a3e06d5450116b4218 /sway/tree/view.c | |
parent | view: implement foreign toplevel fullscreen request (diff) | |
download | sway-b7f28cd6b7a421712f3ebb19972e9d501e96be2d.tar.gz sway-b7f28cd6b7a421712f3ebb19972e9d501e96be2d.tar.zst sway-b7f28cd6b7a421712f3ebb19972e9d501e96be2d.zip |
view: remove foreign toplevel listeners on destroy
Diffstat (limited to 'sway/tree/view.c')
-rw-r--r-- | sway/tree/view.c | 14 |
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( | |||
670 | view_close(view); | 670 | view_close(view); |
671 | } | 671 | } |
672 | 672 | ||
673 | static void handle_foreign_destroy( | ||
674 | struct wl_listener *listener, void *data) { | ||
675 | struct sway_view *view = wl_container_of( | ||
676 | listener, view, foreign_destroy); | ||
677 | |||
678 | wl_list_remove(&view->foreign_activate_request.link); | ||
679 | wl_list_remove(&view->foreign_fullscreen_request.link); | ||
680 | wl_list_remove(&view->foreign_close_request.link); | ||
681 | wl_list_remove(&view->foreign_destroy.link); | ||
682 | } | ||
683 | |||
673 | void view_map(struct sway_view *view, struct wlr_surface *wlr_surface, | 684 | void view_map(struct sway_view *view, struct wlr_surface *wlr_surface, |
674 | bool fullscreen, struct wlr_output *fullscreen_output, | 685 | bool fullscreen, struct wlr_output *fullscreen_output, |
675 | bool decoration) { | 686 | bool decoration) { |
@@ -709,6 +720,9 @@ void view_map(struct sway_view *view, struct wlr_surface *wlr_surface, | |||
709 | view->foreign_close_request.notify = handle_foreign_close_request; | 720 | view->foreign_close_request.notify = handle_foreign_close_request; |
710 | wl_signal_add(&view->foreign_toplevel->events.request_close, | 721 | wl_signal_add(&view->foreign_toplevel->events.request_close, |
711 | &view->foreign_close_request); | 722 | &view->foreign_close_request); |
723 | view->foreign_destroy.notify = handle_foreign_destroy; | ||
724 | wl_signal_add(&view->foreign_toplevel->events.destroy, | ||
725 | &view->foreign_destroy); | ||
712 | 726 | ||
713 | // If we're about to launch the view into the floating container, then | 727 | // If we're about to launch the view into the floating container, then |
714 | // launch it as a tiled view in the root of the workspace instead. | 728 | // launch it as a tiled view in the root of the workspace instead. |