mirror of
https://github.com/swaywm/sway.git
synced 2025-01-30 06:45:12 +01:00
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.
This commit is contained in:
parent
ebe0b668c9
commit
57e78414fa
1 changed files with 7 additions and 7 deletions
|
@ -728,14 +728,14 @@ struct sway_container *seat_get_focus_inactive(struct sway_seat *seat,
|
||||||
|
|
||||||
struct sway_container *seat_get_active_child(struct sway_seat *seat,
|
struct sway_container *seat_get_active_child(struct sway_seat *seat,
|
||||||
struct sway_container *container) {
|
struct sway_container *container) {
|
||||||
struct sway_container *focus = seat_get_focus_inactive(seat, container);
|
struct sway_seat_container *current = NULL;
|
||||||
if (!focus) {
|
wl_list_for_each(current, &seat->focus_stack, link) {
|
||||||
return NULL;
|
if (current->container->parent == container &&
|
||||||
|
current->container->layout != L_FLOATING) {
|
||||||
|
return current->container;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
while (focus->parent != container) {
|
return NULL;
|
||||||
focus = focus->parent;
|
|
||||||
}
|
|
||||||
return focus;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
struct sway_container *seat_get_focus(struct sway_seat *seat) {
|
struct sway_container *seat_get_focus(struct sway_seat *seat) {
|
||||||
|
|
Loading…
Reference in a new issue