diff options
author | emersion <contact@emersion.fr> | 2019-02-05 19:07:01 +0100 |
---|---|---|
committer | Drew DeVault <sir@cmpwn.com> | 2019-02-11 10:22:53 -0500 |
commit | 48511c3b35be8251517ab50ceea6dd2b33c32b86 (patch) | |
tree | 6fc82f57acad787472ea2b413b643e58cd7acc94 | |
parent | output_cmd_background: fix no file + valid mode (diff) | |
download | sway-48511c3b35be8251517ab50ceea6dd2b33c32b86.tar.gz sway-48511c3b35be8251517ab50ceea6dd2b33c32b86.tar.zst sway-48511c3b35be8251517ab50ceea6dd2b33c32b86.zip |
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.c | 16 |
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) { | |||
236 | } | 236 | } |
237 | } | 237 | } |
238 | 238 | ||
239 | static void close_popups_iterator(struct wlr_surface *surface, | ||
240 | int sx, int sy, void *data) { | ||
241 | struct wlr_xdg_surface *xdg_surface = | ||
242 | wlr_xdg_surface_from_wlr_surface(surface); | ||
243 | if (xdg_surface->role == WLR_XDG_SURFACE_ROLE_POPUP | ||
244 | && xdg_surface->popup) { | ||
245 | wlr_xdg_popup_destroy(xdg_surface); | ||
246 | } | ||
247 | } | ||
248 | |||
249 | static void close_popups(struct sway_view *view) { | 239 | static void close_popups(struct sway_view *view) { |
250 | wlr_xdg_surface_for_each_popup(view->wlr_xdg_surface, | 240 | struct wlr_xdg_popup *popup, *tmp; |
251 | close_popups_iterator, NULL); | 241 | wl_list_for_each_safe(popup, tmp, &view->wlr_xdg_surface->popups, link) { |
242 | wlr_xdg_popup_destroy(popup->base); | ||
243 | } | ||
252 | } | 244 | } |
253 | 245 | ||
254 | static void destroy(struct sway_view *view) { | 246 | static void destroy(struct sway_view *view) { |