diff options
-rw-r--r-- | include/sway/input/cursor.h | 1 | ||||
-rw-r--r-- | sway/input/cursor.c | 10 | ||||
-rw-r--r-- | sway/tree/container.c | 7 |
3 files changed, 13 insertions, 5 deletions
diff --git a/include/sway/input/cursor.h b/include/sway/input/cursor.h index 7ec45120..4d47ab42 100644 --- a/include/sway/input/cursor.h +++ b/include/sway/input/cursor.h | |||
@@ -10,6 +10,7 @@ struct sway_cursor { | |||
10 | struct wlr_cursor *cursor; | 10 | struct wlr_cursor *cursor; |
11 | struct { | 11 | struct { |
12 | double x, y; | 12 | double x, y; |
13 | struct sway_node *node; | ||
13 | } previous; | 14 | } previous; |
14 | struct wlr_xcursor_manager *xcursor_manager; | 15 | struct wlr_xcursor_manager *xcursor_manager; |
15 | 16 | ||
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) { |
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; |