diff options
author | Ryan Dwyer <ryandwyer1@gmail.com> | 2018-10-07 20:40:05 +1000 |
---|---|---|
committer | Ryan Dwyer <ryandwyer1@gmail.com> | 2018-10-08 22:49:59 +1000 |
commit | 832ebc896655cb5ca7689559d4e42b426d764e71 (patch) | |
tree | 1a3bc3ff7fb13d7ed5e86ad67a05739d4c4a1de3 /sway/desktop/xdg_shell_v6.c | |
parent | Merge pull request #2791 from RyanDwyer/status-command-optional (diff) | |
download | sway-832ebc896655cb5ca7689559d4e42b426d764e71.tar.gz sway-832ebc896655cb5ca7689559d4e42b426d764e71.tar.zst sway-832ebc896655cb5ca7689559d4e42b426d764e71.zip |
Implement popup_during_fullscreen
This introduces a new view_impl function: is_transient_for. Similar to
container_has_ancestor but works using the surface parents rather than
the tree.
This patch modifies view_is_visible, container_at and so on to allow
transient views to function normally when they're in front of a
fullscreen view.
Diffstat (limited to 'sway/desktop/xdg_shell_v6.c')
-rw-r--r-- | sway/desktop/xdg_shell_v6.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/sway/desktop/xdg_shell_v6.c b/sway/desktop/xdg_shell_v6.c index a7838c0f..dacfca02 100644 --- a/sway/desktop/xdg_shell_v6.c +++ b/sway/desktop/xdg_shell_v6.c | |||
@@ -189,6 +189,21 @@ static void for_each_popup(struct sway_view *view, | |||
189 | user_data); | 189 | user_data); |
190 | } | 190 | } |
191 | 191 | ||
192 | static bool is_transient_for(struct sway_view *child, | ||
193 | struct sway_view *ancestor) { | ||
194 | if (xdg_shell_v6_view_from_view(child) == NULL) { | ||
195 | return false; | ||
196 | } | ||
197 | struct wlr_xdg_surface_v6 *surface = child->wlr_xdg_surface_v6; | ||
198 | while (surface) { | ||
199 | if (surface->toplevel->parent == ancestor->wlr_xdg_surface_v6) { | ||
200 | return true; | ||
201 | } | ||
202 | surface = surface->toplevel->parent; | ||
203 | } | ||
204 | return false; | ||
205 | } | ||
206 | |||
192 | static void _close(struct sway_view *view) { | 207 | static void _close(struct sway_view *view) { |
193 | if (xdg_shell_v6_view_from_view(view) == NULL) { | 208 | if (xdg_shell_v6_view_from_view(view) == NULL) { |
194 | return; | 209 | return; |
@@ -230,6 +245,7 @@ static const struct sway_view_impl view_impl = { | |||
230 | .wants_floating = wants_floating, | 245 | .wants_floating = wants_floating, |
231 | .for_each_surface = for_each_surface, | 246 | .for_each_surface = for_each_surface, |
232 | .for_each_popup = for_each_popup, | 247 | .for_each_popup = for_each_popup, |
248 | .is_transient_for = is_transient_for, | ||
233 | .close = _close, | 249 | .close = _close, |
234 | .close_popups = close_popups, | 250 | .close_popups = close_popups, |
235 | .destroy = destroy, | 251 | .destroy = destroy, |
@@ -380,6 +396,18 @@ static void handle_map(struct wl_listener *listener, void *data) { | |||
380 | WLR_SERVER_DECORATION_MANAGER_MODE_CLIENT; | 396 | WLR_SERVER_DECORATION_MANAGER_MODE_CLIENT; |
381 | view_update_csd_from_client(view, csd); | 397 | view_update_csd_from_client(view, csd); |
382 | 398 | ||
399 | if (config->popup_during_fullscreen == POPUP_LEAVE && | ||
400 | view->container->workspace && | ||
401 | view->container->workspace->fullscreen && | ||
402 | xdg_surface->toplevel->parent) { | ||
403 | struct wlr_xdg_surface_v6 *psurface = xdg_surface->toplevel->parent; | ||
404 | struct sway_xdg_shell_v6_view *parent = psurface->data; | ||
405 | struct sway_view *sway_view = &parent->view; | ||
406 | if (sway_view->container && sway_view->container->is_fullscreen) { | ||
407 | container_set_fullscreen(sway_view->container, false); | ||
408 | } | ||
409 | } | ||
410 | |||
383 | if (xdg_surface->toplevel->client_pending.fullscreen) { | 411 | if (xdg_surface->toplevel->client_pending.fullscreen) { |
384 | container_set_fullscreen(view->container, true); | 412 | container_set_fullscreen(view->container, true); |
385 | arrange_workspace(view->container->workspace); | 413 | arrange_workspace(view->container->workspace); |