diff options
author | Ryan Dwyer <ryandwyer1@gmail.com> | 2018-06-03 22:31:54 +1000 |
---|---|---|
committer | Ryan Dwyer <ryandwyer1@gmail.com> | 2018-06-03 22:31:54 +1000 |
commit | 57e78414fa24763d09a55e47fed221794ffc7524 (patch) | |
tree | fc66c7aeca74585ebd94463edd0142e6652b7db0 | |
parent | Merge pull request #2093 from emersion/damage-debug (diff) | |
download | sway-57e78414fa24763d09a55e47fed221794ffc7524.tar.gz sway-57e78414fa24763d09a55e47fed221794ffc7524.tar.zst sway-57e78414fa24763d09a55e47fed221794ffc7524.zip |
Fix seat_get_active_child
seat_get_active_child is used for tabbed and stacked containers to get
the active child. The previous implementation used seat_get_focus_inactive
then ascended the tree to the child of the tabbed/stacked container, but
this fails when the workspace itself is stacked or tabbed and the most
recently active child is floating.
The new implementation takes a more simple approach, where it directly
scans the focus stack for the first immediate child which isn't the
floating container.
Fixes #2098.
-rw-r--r-- | sway/input/seat.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/sway/input/seat.c b/sway/input/seat.c index d35cbeef..0e539b70 100644 --- a/sway/input/seat.c +++ b/sway/input/seat.c | |||
@@ -728,14 +728,14 @@ struct sway_container *seat_get_focus_inactive(struct sway_seat *seat, | |||
728 | 728 | ||
729 | struct sway_container *seat_get_active_child(struct sway_seat *seat, | 729 | struct sway_container *seat_get_active_child(struct sway_seat *seat, |
730 | struct sway_container *container) { | 730 | struct sway_container *container) { |
731 | struct sway_container *focus = seat_get_focus_inactive(seat, container); | 731 | struct sway_seat_container *current = NULL; |
732 | if (!focus) { | 732 | wl_list_for_each(current, &seat->focus_stack, link) { |
733 | return NULL; | 733 | if (current->container->parent == container && |
734 | } | 734 | current->container->layout != L_FLOATING) { |
735 | while (focus->parent != container) { | 735 | return current->container; |
736 | focus = focus->parent; | 736 | } |
737 | } | 737 | } |
738 | return focus; | 738 | return NULL; |
739 | } | 739 | } |
740 | 740 | ||
741 | struct sway_container *seat_get_focus(struct sway_seat *seat) { | 741 | struct sway_container *seat_get_focus(struct sway_seat *seat) { |