aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoremersion <contact@emersion.fr>2019-02-05 19:07:01 +0100
committerBrian Ashworth <bosrsf04@gmail.com>2019-02-05 22:31:05 -0500
commit9b1905acf9b4de7bacbb57f5cc20d6a356b0d92d (patch)
tree6fc82f57acad787472ea2b413b643e58cd7acc94
parenta3c531485631698109073d338da956ccaaf0a7e0 (diff)
downloadsway-9b1905acf9b4de7bacbb57f5cc20d6a356b0d92d.tar.xz
Fix close_popups for xdg-shell
wlr_xdg_popup_destroy will destroy popups, so we need to walk the tree carefully. It's enough to just destroy all direct children, since destroying the parent will also destroy all children.
-rw-r--r--sway/desktop/xdg_shell.c16
1 files changed, 4 insertions, 12 deletions
diff --git a/sway/desktop/xdg_shell.c b/sway/desktop/xdg_shell.c
index 152bd26f..ce6fe41a 100644
--- a/sway/desktop/xdg_shell.c
+++ b/sway/desktop/xdg_shell.c
@@ -236,19 +236,11 @@ static void _close(struct sway_view *view) {
}
}
-static void close_popups_iterator(struct wlr_surface *surface,
- int sx, int sy, void *data) {
- struct wlr_xdg_surface *xdg_surface =
- wlr_xdg_surface_from_wlr_surface(surface);
- if (xdg_surface->role == WLR_XDG_SURFACE_ROLE_POPUP
- && xdg_surface->popup) {
- wlr_xdg_popup_destroy(xdg_surface);
- }
-}
-
static void close_popups(struct sway_view *view) {
- wlr_xdg_surface_for_each_popup(view->wlr_xdg_surface,
- close_popups_iterator, NULL);
+ struct wlr_xdg_popup *popup, *tmp;
+ wl_list_for_each_safe(popup, tmp, &view->wlr_xdg_surface->popups, link) {
+ wlr_xdg_popup_destroy(popup->base);
+ }
}
static void destroy(struct sway_view *view) {