Make seat_get_active_child ignore floating children

seat_get_active_child is used to get the active tiling child in a few
places, such as outputs getting their active workspace and
tabbed/stacked containers getting their visible child. When a workspace
uses a tabbed or stacked layout and contains a focused floating view,
calling seat_get_active_child on the workspace would incorrectly return
the floating view. This changes it so it will return the tiling child.

This fixes the following bug:

* Create layout T[view view] then float one of the views
* Attempt to click the tiling view to give it focus - it wouldn't work
because seat_get_active_child would return the floating view
This commit is contained in:
Ryan Dwyer 2018-09-16 14:04:25 +10:00
parent 31c6b5814f
commit 48bc15e758

View file

@ -888,9 +888,17 @@ struct sway_node *seat_get_active_child(struct sway_seat *seat,
struct sway_seat_node *current; struct sway_seat_node *current;
wl_list_for_each(current, &seat->focus_stack, link) { wl_list_for_each(current, &seat->focus_stack, link) {
struct sway_node *node = current->node; struct sway_node *node = current->node;
if (node_get_parent(node) == parent) { if (node_get_parent(node) != parent) {
return node; continue;
} }
if (parent->type == N_WORKSPACE) {
// Only consider tiling children
struct sway_workspace *ws = parent->sway_workspace;
if (list_find(ws->tiling, node->sway_container) == -1) {
continue;
}
}
return node;
} }
return NULL; return NULL;
} }