aboutsummaryrefslogtreecommitdiffstats
path: root/sway/tree/container.c
diff options
context:
space:
mode:
authorLibravatar Jonathan Buch <jbuch@synyx.de>2018-09-27 18:32:55 +0200
committerLibravatar Jonathan Buch <jbuch@synyx.de>2018-10-03 16:23:14 +0200
commit7727d54faf2939e30f82da562de83dbcda1749db (patch)
treef529d6896885f99d4551b6303c5d5f25a5c71508 /sway/tree/container.c
parentAdd manpage documentatioon for raise_floating (diff)
downloadsway-7727d54faf2939e30f82da562de83dbcda1749db.tar.gz
sway-7727d54faf2939e30f82da562de83dbcda1749db.tar.zst
sway-7727d54faf2939e30f82da562de83dbcda1749db.zip
Fix focusing topmost floating windows
Re-focus on the container on which the cursor hovers over. A special case is, if there are menus or other subsurfaces open in the focused container. It will prefer the focused container as long as there are subsurfaces. This commit starts caching the previous node as well as the previous x/y cursor position. Re-calculating the previous focused node by looking at the current state of the cursor position does not work, if the environment changes.
Diffstat (limited to 'sway/tree/container.c')
-rw-r--r--sway/tree/container.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/sway/tree/container.c b/sway/tree/container.c
index a069b177..f9ddf3d6 100644
--- a/sway/tree/container.c
+++ b/sway/tree/container.c
@@ -369,6 +369,13 @@ struct sway_container *container_at(struct sway_workspace *workspace,
369 } 369 }
370 // If focused is floating, focused view's non-popups 370 // If focused is floating, focused view's non-popups
371 if (focus && focus->view && is_floating) { 371 if (focus && focus->view && is_floating) {
372 // only switch to unfocused container if focused container has no menus open
373 bool has_subsurfaces = wl_list_length(&focus->view->surface->subsurfaces) > 0;
374 c = floating_container_at(lx, ly, surface, sx, sy);
375 if (!has_subsurfaces && c && c->view && *surface && c != focus) {
376 return c;
377 }
378
372 surface_at_view(focus, lx, ly, surface, sx, sy); 379 surface_at_view(focus, lx, ly, surface, sx, sy);
373 if (*surface) { 380 if (*surface) {
374 return focus; 381 return focus;