aboutsummaryrefslogtreecommitdiffstats
path: root/sway/input/seatop_default.c
diff options
context:
space:
mode:
authorLibravatar Tudor Brindus <me@tbrindus.ca>2020-10-25 13:17:47 -0400
committerLibravatar Brian Ashworth <bosrsf04@gmail.com>2020-11-01 04:05:38 -0500
commitc523aa623bc5e5b5897c0f337058aa7308871fef (patch)
tree1bde4c51e125e96a0c2ca0cbd7ced52bdbf4e30c /sway/input/seatop_default.c
parentcommands/focus: force container warp when fulfilling `focus mode_toggle` (diff)
downloadsway-c523aa623bc5e5b5897c0f337058aa7308871fef.tar.gz
sway-c523aa623bc5e5b5897c0f337058aa7308871fef.tar.zst
sway-c523aa623bc5e5b5897c0f337058aa7308871fef.zip
input: fully change focus when scrolling tabs/stacks
When scrolling on a tabbed/stacked container, i3 focuses its inactive-focused focused child. Sway does the same, but then resets the focus to whatever was focused previously. Ref https://github.com/i3/i3/blob/e5992eed163179f5cd2715c2c212d3d757f04b31/src/click.c#L207-L219
Diffstat (limited to 'sway/input/seatop_default.c')
-rw-r--r--sway/input/seatop_default.c13
1 files changed, 4 insertions, 9 deletions
diff --git a/sway/input/seatop_default.c b/sway/input/seatop_default.c
index 2bee389e..e6d6c11b 100644
--- a/sway/input/seatop_default.c
+++ b/sway/input/seatop_default.c
@@ -703,19 +703,14 @@ static void handle_pointer_axis(struct sway_seat *seat,
703 } else if (desired >= siblings->length) { 703 } else if (desired >= siblings->length) {
704 desired = siblings->length - 1; 704 desired = siblings->length - 1;
705 } 705 }
706 struct sway_node *old_focus = seat_get_focus(seat); 706
707 struct sway_container *new_sibling_con = siblings->items[desired]; 707 struct sway_container *new_sibling_con = siblings->items[desired];
708 struct sway_node *new_sibling = &new_sibling_con->node; 708 struct sway_node *new_sibling = &new_sibling_con->node;
709 struct sway_node *new_focus = 709 struct sway_node *new_focus =
710 seat_get_focus_inactive(seat, new_sibling); 710 seat_get_focus_inactive(seat, new_sibling);
711 if (node_has_ancestor(old_focus, tabcontainer)) { 711 // Use the focused child of the tabbed/stacked container, not the
712 seat_set_focus(seat, new_focus); 712 // container the user scrolled on.
713 } else { 713 seat_set_focus(seat, new_focus);
714 // Scrolling when focus is not in the tabbed container at all
715 seat_set_raw_focus(seat, new_sibling);
716 seat_set_raw_focus(seat, new_focus);
717 seat_set_raw_focus(seat, old_focus);
718 }
719 handled = true; 714 handled = true;
720 } 715 }
721 } 716 }