aboutsummaryrefslogtreecommitdiffstats
path: root/sway/desktop/xdg_shell.c
diff options
context:
space:
mode:
authorLibravatar Ryan Dwyer <ryandwyer1@gmail.com>2018-10-07 20:40:05 +1000
committerLibravatar Ryan Dwyer <ryandwyer1@gmail.com>2018-10-08 22:49:59 +1000
commit832ebc896655cb5ca7689559d4e42b426d764e71 (patch)
tree1a3bc3ff7fb13d7ed5e86ad67a05739d4c4a1de3 /sway/desktop/xdg_shell.c
parentMerge pull request #2791 from RyanDwyer/status-command-optional (diff)
downloadsway-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.c')
-rw-r--r--sway/desktop/xdg_shell.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/sway/desktop/xdg_shell.c b/sway/desktop/xdg_shell.c
index a8b527a7..54831679 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
195static 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
195static void _close(struct sway_view *view) { 210static 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,
@@ -385,6 +401,18 @@ static void handle_map(struct wl_listener *listener, void *data) {
385 view_update_csd_from_client(view, csd); 401 view_update_csd_from_client(view, csd);
386 } 402 }
387 403
404 if (config->popup_during_fullscreen == POPUP_LEAVE &&
405 view->container->workspace &&
406 view->container->workspace->fullscreen &&
407 xdg_surface->toplevel->parent) {
408 struct wlr_xdg_surface *psurface = xdg_surface->toplevel->parent;
409 struct sway_xdg_shell_view *parent = psurface->data;
410 struct sway_view *sway_view = &parent->view;
411 if (sway_view->container && sway_view->container->is_fullscreen) {
412 container_set_fullscreen(sway_view->container, false);
413 }
414 }
415
388 if (xdg_surface->toplevel->client_pending.fullscreen) { 416 if (xdg_surface->toplevel->client_pending.fullscreen) {
389 container_set_fullscreen(view->container, true); 417 container_set_fullscreen(view->container, true);
390 arrange_workspace(view->container->workspace); 418 arrange_workspace(view->container->workspace);
@@ -395,6 +423,7 @@ static void handle_map(struct wl_listener *listener, void *data) {
395 arrange_workspace(view->container->workspace); 423 arrange_workspace(view->container->workspace);
396 } 424 }
397 } 425 }
426
398 transaction_commit_dirty(); 427 transaction_commit_dirty();
399 428
400 xdg_shell_view->commit.notify = handle_commit; 429 xdg_shell_view->commit.notify = handle_commit;