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

Make seat_get_active_child ignore floating children
master
Drew DeVault 6 years ago committed by GitHub
commit 456b91600d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -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.
*/
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);
/**

@ -261,7 +261,7 @@ struct cmd_results *cmd_focus(int argc, char **argv) {
}
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) {
seat_set_focus(seat, focus);
cursor_send_pointer_motion(seat->cursor, 0, true);

@ -149,7 +149,7 @@ static void container_move_to_container_from_direction(
}
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);
if (!focus_inactive || focus_inactive == &destination->node) {
// The container has no children

@ -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_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) {
return output->workspaces->items[0];
}

@ -176,7 +176,8 @@ static void copy_container_state(struct sway_container *container,
state->focused = seat_get_focus(seat) == &container->node;
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;
}
}

@ -880,7 +880,7 @@ struct sway_container *seat_get_focus_inactive_floating(struct sway_seat *seat,
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) {
if (node_is_view(parent)) {
return parent;
@ -888,9 +888,17 @@ struct sway_node *seat_get_active_child(struct sway_seat *seat,
struct sway_seat_node *current;
wl_list_for_each(current, &seat->focus_stack, link) {
struct sway_node *node = current->node;
if (node_get_parent(node) == parent) {
return node;
if (node_get_parent(node) != parent) {
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;
}

@ -220,7 +220,7 @@ static struct sway_container *container_at_tabbed(struct sway_node *parent,
}
// 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;
}
@ -248,7 +248,7 @@ static struct sway_container *container_at_stacked(struct sway_node *parent,
}
// 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;
}

@ -1001,17 +1001,17 @@ bool view_is_visible(struct sway_view *view) {
bool is_sticky = container_is_floating(floater) && floater->is_sticky;
// 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_container *container = view->container;
while (container) {
enum sway_container_layout layout = container_parent_layout(container);
struct sway_container *con = view->container;
while (con) {
enum sway_container_layout layout = container_parent_layout(con);
if (layout == L_TABBED || layout == L_STACKED) {
struct sway_node *parent = container->parent ?
&container->parent->node : &container->workspace->node;
if (seat_get_active_child(seat, parent) != &container->node) {
struct sway_node *parent = con->parent ?
&con->parent->node : &con->workspace->node;
if (seat_get_active_tiling_child(seat, parent) != &con->node) {
return false;
}
}
container = container->parent;
con = con->parent;
}
// Check view isn't hidden by another fullscreen view
if (workspace->fullscreen &&

Loading…
Cancel
Save