aboutsummaryrefslogtreecommitdiffstats
path: root/sway/tree/container.c
diff options
context:
space:
mode:
authorLibravatar Jonathan Buch <jbuch@synyx.de>2018-10-03 11:26:46 +0200
committerLibravatar Jonathan Buch <jbuch@synyx.de>2018-10-03 16:23:14 +0200
commit426c33f4dc2515867a0d3b04cb865d5cad091d10 (patch)
tree2564be2f236c91052227bf2cdf322d620caa18b4 /sway/tree/container.c
parentUse "raycasting" for determining focus for floating windows (diff)
downloadsway-426c33f4dc2515867a0d3b04cb865d5cad091d10.tar.gz
sway-426c33f4dc2515867a0d3b04cb865d5cad091d10.tar.zst
sway-426c33f4dc2515867a0d3b04cb865d5cad091d10.zip
Reenable popup-handling for determining focus
This reenables the popup-handling code before the floating-window focus change.
Diffstat (limited to 'sway/tree/container.c')
-rw-r--r--sway/tree/container.c23
1 files changed, 20 insertions, 3 deletions
diff --git a/sway/tree/container.c b/sway/tree/container.c
index f069a9e9..9db7aed1 100644
--- a/sway/tree/container.c
+++ b/sway/tree/container.c
@@ -356,16 +356,33 @@ static bool surface_is_popup(struct wlr_surface *surface) {
356struct sway_container *container_at(struct sway_workspace *workspace, 356struct sway_container *container_at(struct sway_workspace *workspace,
357 double lx, double ly, 357 double lx, double ly,
358 struct wlr_surface **surface, double *sx, double *sy) { 358 struct wlr_surface **surface, double *sx, double *sy) {
359 struct sway_container *c = NULL; 359 struct sway_container *c;
360 360
361 // First cast a ray to handle floating windows 361 // Focused view's popups
362 struct sway_seat *seat = input_manager_current_seat(input_manager);
363 struct sway_container *focus = seat_get_focused_container(seat);
364 bool is_floating = focus && container_is_floating_or_child(focus);
365 // Focused view's popups
366 if (focus && focus->view) {
367 c = surface_at_view(focus, lx, ly, surface, sx, sy);
368 if (c && surface_is_popup(*surface)) {
369 return c;
370 }
371 *surface = NULL;
372 }
373 // Cast a ray to handle floating windows
362 for (int i = workspace->floating->length - 1; i >= 0; --i) { 374 for (int i = workspace->floating->length - 1; i >= 0; --i) {
363 struct sway_container *cn = workspace->floating->items[i]; 375 struct sway_container *cn = workspace->floating->items[i];
364 if (cn->view && (c = surface_at_view(cn, lx, ly, surface, sx, sy))) { 376 if (cn->view && (c = surface_at_view(cn, lx, ly, surface, sx, sy))) {
365 return c; 377 return c;
366 } 378 }
367 } 379 }
368 380 // If focused is tiling, focused view's non-popups
381 if (focus && focus->view && !is_floating) {
382 if ((c = surface_at_view(focus, lx, ly, surface, sx, sy))) {
383 return c;
384 }
385 }
369 // Tiling (non-focused) 386 // Tiling (non-focused)
370 if ((c = tiling_container_at(&workspace->node, lx, ly, surface, sx, sy))) { 387 if ((c = tiling_container_at(&workspace->node, lx, ly, surface, sx, sy))) {
371 return c; 388 return c;