diff options
Diffstat (limited to 'sway/desktop/xdg_shell.c')
-rw-r--r-- | sway/desktop/xdg_shell.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/sway/desktop/xdg_shell.c b/sway/desktop/xdg_shell.c index a8b527a7..4690a3c5 100644 --- a/sway/desktop/xdg_shell.c +++ b/sway/desktop/xdg_shell.c | |||
@@ -192,6 +192,21 @@ static void for_each_popup(struct sway_view *view, | |||
192 | wlr_xdg_surface_for_each_popup(view->wlr_xdg_surface, iterator, user_data); | 192 | wlr_xdg_surface_for_each_popup(view->wlr_xdg_surface, iterator, user_data); |
193 | } | 193 | } |
194 | 194 | ||
195 | static bool is_transient_for(struct sway_view *child, | ||
196 | struct sway_view *ancestor) { | ||
197 | if (xdg_shell_view_from_view(child) == NULL) { | ||
198 | return false; | ||
199 | } | ||
200 | struct wlr_xdg_surface *surface = child->wlr_xdg_surface; | ||
201 | while (surface) { | ||
202 | if (surface->toplevel->parent == ancestor->wlr_xdg_surface) { | ||
203 | return true; | ||
204 | } | ||
205 | surface = surface->toplevel->parent; | ||
206 | } | ||
207 | return false; | ||
208 | } | ||
209 | |||
195 | static void _close(struct sway_view *view) { | 210 | static void _close(struct sway_view *view) { |
196 | if (xdg_shell_view_from_view(view) == NULL) { | 211 | if (xdg_shell_view_from_view(view) == NULL) { |
197 | return; | 212 | return; |
@@ -233,6 +248,7 @@ static const struct sway_view_impl view_impl = { | |||
233 | .wants_floating = wants_floating, | 248 | .wants_floating = wants_floating, |
234 | .for_each_surface = for_each_surface, | 249 | .for_each_surface = for_each_surface, |
235 | .for_each_popup = for_each_popup, | 250 | .for_each_popup = for_each_popup, |
251 | .is_transient_for = is_transient_for, | ||
236 | .close = _close, | 252 | .close = _close, |
237 | .close_popups = close_popups, | 253 | .close_popups = close_popups, |
238 | .destroy = destroy, | 254 | .destroy = destroy, |
@@ -395,6 +411,7 @@ static void handle_map(struct wl_listener *listener, void *data) { | |||
395 | arrange_workspace(view->container->workspace); | 411 | arrange_workspace(view->container->workspace); |
396 | } | 412 | } |
397 | } | 413 | } |
414 | |||
398 | transaction_commit_dirty(); | 415 | transaction_commit_dirty(); |
399 | 416 | ||
400 | xdg_shell_view->commit.notify = handle_commit; | 417 | xdg_shell_view->commit.notify = handle_commit; |