diff --git a/sway/input/seat.c b/sway/input/seat.c index 078cb8b8e..50134aae5 100644 --- a/sway/input/seat.c +++ b/sway/input/seat.c @@ -123,7 +123,7 @@ static void handle_seat_container_destroy(struct wl_listener *listener, static struct sway_seat_container *seat_container_from_container( struct sway_seat *seat, struct sway_container *con) { - if (con->type < C_WORKSPACE) { + if (con->type == C_ROOT || con->type == C_OUTPUT) { // these don't get seat containers ever return NULL; } @@ -473,7 +473,7 @@ struct sway_container *seat_get_focus_by_type(struct sway_seat *seat, struct sway_seat_container *current = NULL; wl_list_for_each(current, &seat->focus_stack, link) { - if (type != C_TYPES && container->type != type) { + if (current->container->type != type && type != C_TYPES) { continue; } diff --git a/sway/tree/layout.c b/sway/tree/layout.c index 5abdbc321..1769609bd 100644 --- a/sway/tree/layout.c +++ b/sway/tree/layout.c @@ -638,16 +638,16 @@ struct sway_container *container_get_in_direction( wrap_candidate = parent->children->items[0]; } if (config->force_focus_wrapping) { - return seat_get_focus_by_type(seat, - wrap_candidate, C_VIEW); + return wrap_candidate; } } } else { + struct sway_container *desired_con = parent->children->items[desired]; wlr_log(L_DEBUG, "cont %d-%p dir %i sibling %d: %p", idx, - container, dir, desired, parent->children->items[desired]); - return seat_get_focus_by_type(seat, - parent->children->items[desired], C_VIEW); + container, dir, desired, desired_con); + struct sway_container *next = seat_get_focus_by_type(seat, desired_con, C_VIEW); + return next; } }