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 | |
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
-rw-r--r-- | include/sway/tree/view.h | 1 | ||||
-rw-r--r-- | sway/tree/view.c | 14 |
2 files changed, 15 insertions, 0 deletions
diff --git a/include/sway/tree/view.h b/include/sway/tree/view.h index 58722dbd..6cfabf3b 100644 --- a/include/sway/tree/view.h +++ b/include/sway/tree/view.h | |||
@@ -101,6 +101,7 @@ struct sway_view { | |||
101 | struct wl_listener foreign_activate_request; | 101 | struct wl_listener foreign_activate_request; |
102 | struct wl_listener foreign_fullscreen_request; | 102 | struct wl_listener foreign_fullscreen_request; |
103 | struct wl_listener foreign_close_request; | 103 | struct wl_listener foreign_close_request; |
104 | struct wl_listener foreign_destroy; | ||
104 | 105 | ||
105 | bool destroying; | 106 | bool destroying; |
106 | 107 | ||
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. |