aboutsummaryrefslogtreecommitdiffstats
path: root/sway/input/cursor.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/input/cursor.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/input/cursor.c')
-rw-r--r--sway/input/cursor.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/sway/input/cursor.c b/sway/input/cursor.c
index afad6f6f..3c62acb9 100644
--- a/sway/input/cursor.c
+++ b/sway/input/cursor.c
@@ -567,15 +567,15 @@ void cursor_send_pointer_motion(struct sway_cursor *cursor, uint32_t time_msec,
567 struct wlr_surface *surface = NULL; 567 struct wlr_surface *surface = NULL;
568 double sx, sy; 568 double sx, sy;
569 569
570 // Find the node beneath the pointer's previous position 570 struct sway_node *prev_node = cursor->previous.node;
571 struct sway_node *prev_node = node_at_coords(seat, 571 struct sway_node *node = node_at_coords(seat,
572 cursor->previous.x, cursor->previous.y, &surface, &sx, &sy); 572 cursor->cursor->x, cursor->cursor->y, &surface, &sx, &sy);
573
573 // Update the stored previous position 574 // Update the stored previous position
574 cursor->previous.x = cursor->cursor->x; 575 cursor->previous.x = cursor->cursor->x;
575 cursor->previous.y = cursor->cursor->y; 576 cursor->previous.y = cursor->cursor->y;
577 cursor->previous.node = node;
576 578
577 struct sway_node *node = node_at_coords(seat,
578 cursor->cursor->x, cursor->cursor->y, &surface, &sx, &sy);
579 if (node && config->focus_follows_mouse && allow_refocusing) { 579 if (node && config->focus_follows_mouse && allow_refocusing) {
580 struct sway_node *focus = seat_get_focus(seat); 580 struct sway_node *focus = seat_get_focus(seat);
581 if (focus && node->type == N_WORKSPACE) { 581 if (focus && node->type == N_WORKSPACE) {