diff options
-rw-r--r-- | sway/input/cursor.c | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/sway/input/cursor.c b/sway/input/cursor.c index 60d4bf5d..3942b64f 100644 --- a/sway/input/cursor.c +++ b/sway/input/cursor.c | |||
@@ -996,8 +996,9 @@ static void dispatch_cursor_axis(struct sway_cursor *cursor, | |||
996 | if (on_titlebar) { | 996 | if (on_titlebar) { |
997 | enum sway_container_layout layout = container_parent_layout(cont); | 997 | enum sway_container_layout layout = container_parent_layout(cont); |
998 | if (layout == L_TABBED || layout == L_STACKED) { | 998 | if (layout == L_TABBED || layout == L_STACKED) { |
999 | struct sway_node *tabcontainer = node_get_parent(node); | ||
999 | struct sway_node *active = | 1000 | struct sway_node *active = |
1000 | seat_get_active_tiling_child(seat, node_get_parent(node)); | 1001 | seat_get_active_tiling_child(seat, tabcontainer); |
1001 | list_t *siblings = container_get_siblings(cont); | 1002 | list_t *siblings = container_get_siblings(cont); |
1002 | int desired = list_find(siblings, active->sway_container) + | 1003 | int desired = list_find(siblings, active->sway_container) + |
1003 | event->delta_discrete; | 1004 | event->delta_discrete; |
@@ -1006,9 +1007,19 @@ static void dispatch_cursor_axis(struct sway_cursor *cursor, | |||
1006 | } else if (desired >= siblings->length) { | 1007 | } else if (desired >= siblings->length) { |
1007 | desired = siblings->length - 1; | 1008 | desired = siblings->length - 1; |
1008 | } | 1009 | } |
1009 | struct sway_container *new_focus = siblings->items[desired]; | 1010 | struct sway_node *old_focus = seat_get_focus(seat); |
1010 | node = seat_get_focus_inactive(seat, &new_focus->node); | 1011 | struct sway_container *new_sibling_con = siblings->items[desired]; |
1011 | seat_set_focus(seat, node); | 1012 | struct sway_node *new_sibling = &new_sibling_con->node; |
1013 | struct sway_node *new_focus = | ||
1014 | seat_get_focus_inactive(seat, new_sibling); | ||
1015 | if (node_has_ancestor(old_focus, tabcontainer)) { | ||
1016 | seat_set_focus(seat, new_focus); | ||
1017 | } else { | ||
1018 | // Scrolling when focus is not in the tabbed container at all | ||
1019 | seat_set_raw_focus(seat, new_sibling); | ||
1020 | seat_set_raw_focus(seat, new_focus); | ||
1021 | seat_set_raw_focus(seat, old_focus); | ||
1022 | } | ||
1012 | return; | 1023 | return; |
1013 | } | 1024 | } |
1014 | } | 1025 | } |