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/xwayland.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/xwayland.c')
-rw-r--r-- | sway/desktop/xwayland.c | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/sway/desktop/xwayland.c b/sway/desktop/xwayland.c index 4c710f7e..80489f93 100644 --- a/sway/desktop/xwayland.c +++ b/sway/desktop/xwayland.c | |||
@@ -15,6 +15,7 @@ | |||
15 | #include "sway/tree/arrange.h" | 15 | #include "sway/tree/arrange.h" |
16 | #include "sway/tree/container.h" | 16 | #include "sway/tree/container.h" |
17 | #include "sway/tree/view.h" | 17 | #include "sway/tree/view.h" |
18 | #include "sway/tree/workspace.h" | ||
18 | 19 | ||
19 | static const char *atom_map[ATOM_LAST] = { | 20 | static const char *atom_map[ATOM_LAST] = { |
20 | "_NET_WM_WINDOW_TYPE_NORMAL", | 21 | "_NET_WM_WINDOW_TYPE_NORMAL", |
@@ -253,6 +254,21 @@ static void handle_set_decorations(struct wl_listener *listener, void *data) { | |||
253 | view_update_csd_from_client(view, csd); | 254 | view_update_csd_from_client(view, csd); |
254 | } | 255 | } |
255 | 256 | ||
257 | static bool is_transient_for(struct sway_view *child, | ||
258 | struct sway_view *ancestor) { | ||
259 | if (xwayland_view_from_view(child) == NULL) { | ||
260 | return false; | ||
261 | } | ||
262 | struct wlr_xwayland_surface *surface = child->wlr_xwayland_surface; | ||
263 | while (surface) { | ||
264 | if (surface->parent == ancestor->wlr_xwayland_surface) { | ||
265 | return true; | ||
266 | } | ||
267 | surface = surface->parent; | ||
268 | } | ||
269 | return false; | ||
270 | } | ||
271 | |||
256 | static void _close(struct sway_view *view) { | 272 | static void _close(struct sway_view *view) { |
257 | if (xwayland_view_from_view(view) == NULL) { | 273 | if (xwayland_view_from_view(view) == NULL) { |
258 | return; | 274 | return; |
@@ -276,6 +292,7 @@ static const struct sway_view_impl view_impl = { | |||
276 | .set_tiled = set_tiled, | 292 | .set_tiled = set_tiled, |
277 | .set_fullscreen = set_fullscreen, | 293 | .set_fullscreen = set_fullscreen, |
278 | .wants_floating = wants_floating, | 294 | .wants_floating = wants_floating, |
295 | .is_transient_for = is_transient_for, | ||
279 | .close = _close, | 296 | .close = _close, |
280 | .destroy = destroy, | 297 | .destroy = destroy, |
281 | }; | 298 | }; |
@@ -390,6 +407,18 @@ static void handle_map(struct wl_listener *listener, void *data) { | |||
390 | // Put it back into the tree | 407 | // Put it back into the tree |
391 | view_map(view, xsurface->surface); | 408 | view_map(view, xsurface->surface); |
392 | 409 | ||
410 | if (config->popup_during_fullscreen == POPUP_LEAVE && | ||
411 | view->container->workspace && | ||
412 | view->container->workspace->fullscreen && | ||
413 | xsurface->parent) { | ||
414 | struct wlr_xwayland_surface *psurface = xsurface->parent; | ||
415 | struct sway_xwayland_view *parent = psurface->data; | ||
416 | struct sway_view *sway_view = &parent->view; | ||
417 | if (sway_view->container && sway_view->container->is_fullscreen) { | ||
418 | container_set_fullscreen(sway_view->container, false); | ||
419 | } | ||
420 | } | ||
421 | |||
393 | if (xsurface->fullscreen) { | 422 | if (xsurface->fullscreen) { |
394 | container_set_fullscreen(view->container, true); | 423 | container_set_fullscreen(view->container, true); |
395 | arrange_workspace(view->container->workspace); | 424 | arrange_workspace(view->container->workspace); |