Merge pull request #2637 from RyanDwyer/fix-tabbed-workspace-shenanigans

Make seat_get_active_child ignore floating children
This commit is contained in:
Drew DeVault 2018-09-16 10:22:01 -04:00 committed by GitHub
commit 456b91600d
Failed to generate hash of commit
8 changed files with 26 additions and 17 deletions

View file

@ -155,7 +155,7 @@ struct sway_container *seat_get_focus_inactive_view(struct sway_seat *seat,
/** /**
* Return the immediate child of container which was most recently focused. * Return the immediate child of container which was most recently focused.
*/ */
struct sway_node *seat_get_active_child(struct sway_seat *seat, struct sway_node *seat_get_active_tiling_child(struct sway_seat *seat,
struct sway_node *parent); struct sway_node *parent);
/** /**

View file

@ -261,7 +261,7 @@ struct cmd_results *cmd_focus(int argc, char **argv) {
} }
if (direction == MOVE_CHILD) { if (direction == MOVE_CHILD) {
struct sway_node *focus = seat_get_active_child(seat, node); struct sway_node *focus = seat_get_active_tiling_child(seat, node);
if (focus) { if (focus) {
seat_set_focus(seat, focus); seat_set_focus(seat, focus);
cursor_send_pointer_motion(seat->cursor, 0, true); cursor_send_pointer_motion(seat->cursor, 0, true);

View file

@ -149,7 +149,7 @@ static void container_move_to_container_from_direction(
} }
wlr_log(WLR_DEBUG, "Reparenting container (perpendicular)"); wlr_log(WLR_DEBUG, "Reparenting container (perpendicular)");
struct sway_node *focus_inactive = seat_get_active_child( struct sway_node *focus_inactive = seat_get_active_tiling_child(
config->handler_context.seat, &destination->node); config->handler_context.seat, &destination->node);
if (!focus_inactive || focus_inactive == &destination->node) { if (!focus_inactive || focus_inactive == &destination->node) {
// The container has no children // The container has no children

View file

@ -232,7 +232,7 @@ static void scale_box(struct wlr_box *box, float scale) {
struct sway_workspace *output_get_active_workspace(struct sway_output *output) { struct sway_workspace *output_get_active_workspace(struct sway_output *output) {
struct sway_seat *seat = input_manager_current_seat(input_manager); struct sway_seat *seat = input_manager_current_seat(input_manager);
struct sway_node *focus = seat_get_active_child(seat, &output->node); struct sway_node *focus = seat_get_active_tiling_child(seat, &output->node);
if (!focus) { if (!focus) {
return output->workspaces->items[0]; return output->workspaces->items[0];
} }

View file

@ -176,7 +176,8 @@ static void copy_container_state(struct sway_container *container,
state->focused = seat_get_focus(seat) == &container->node; state->focused = seat_get_focus(seat) == &container->node;
if (!container->view) { if (!container->view) {
struct sway_node *focus = seat_get_active_child(seat, &container->node); struct sway_node *focus =
seat_get_active_tiling_child(seat, &container->node);
state->focused_inactive_child = focus ? focus->sway_container : NULL; state->focused_inactive_child = focus ? focus->sway_container : NULL;
} }
} }

View file

@ -880,7 +880,7 @@ struct sway_container *seat_get_focus_inactive_floating(struct sway_seat *seat,
return NULL; return NULL;
} }
struct sway_node *seat_get_active_child(struct sway_seat *seat, struct sway_node *seat_get_active_tiling_child(struct sway_seat *seat,
struct sway_node *parent) { struct sway_node *parent) {
if (node_is_view(parent)) { if (node_is_view(parent)) {
return parent; return parent;
@ -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;
} }

View file

@ -220,7 +220,7 @@ static struct sway_container *container_at_tabbed(struct sway_node *parent,
} }
// Surfaces // Surfaces
struct sway_node *current = seat_get_active_child(seat, parent); struct sway_node *current = seat_get_active_tiling_child(seat, parent);
return current ? tiling_container_at(current, lx, ly, surface, sx, sy) : NULL; return current ? tiling_container_at(current, lx, ly, surface, sx, sy) : NULL;
} }
@ -248,7 +248,7 @@ static struct sway_container *container_at_stacked(struct sway_node *parent,
} }
// Surfaces // Surfaces
struct sway_node *current = seat_get_active_child(seat, parent); struct sway_node *current = seat_get_active_tiling_child(seat, parent);
return current ? tiling_container_at(current, lx, ly, surface, sx, sy) : NULL; return current ? tiling_container_at(current, lx, ly, surface, sx, sy) : NULL;
} }

View file

@ -1001,17 +1001,17 @@ bool view_is_visible(struct sway_view *view) {
bool is_sticky = container_is_floating(floater) && floater->is_sticky; bool is_sticky = container_is_floating(floater) && floater->is_sticky;
// Check view isn't in a tabbed or stacked container on an inactive tab // Check view isn't in a tabbed or stacked container on an inactive tab
struct sway_seat *seat = input_manager_current_seat(input_manager); struct sway_seat *seat = input_manager_current_seat(input_manager);
struct sway_container *container = view->container; struct sway_container *con = view->container;
while (container) { while (con) {
enum sway_container_layout layout = container_parent_layout(container); enum sway_container_layout layout = container_parent_layout(con);
if (layout == L_TABBED || layout == L_STACKED) { if (layout == L_TABBED || layout == L_STACKED) {
struct sway_node *parent = container->parent ? struct sway_node *parent = con->parent ?
&container->parent->node : &container->workspace->node; &con->parent->node : &con->workspace->node;
if (seat_get_active_child(seat, parent) != &container->node) { if (seat_get_active_tiling_child(seat, parent) != &con->node) {
return false; return false;
} }
} }
container = container->parent; con = con->parent;
} }
// Check view isn't hidden by another fullscreen view // Check view isn't hidden by another fullscreen view
if (workspace->fullscreen && if (workspace->fullscreen &&