From eda425fdabb4050eb2ecc8741793d83e3a7bf154 Mon Sep 17 00:00:00 2001 From: Tony Crisci Date: Sat, 31 Mar 2018 18:52:02 -0400 Subject: fix some segfaults --- sway/input/seat.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'sway/input') diff --git a/sway/input/seat.c b/sway/input/seat.c index adc4cb0a..a1b1caa8 100644 --- a/sway/input/seat.c +++ b/sway/input/seat.c @@ -94,6 +94,7 @@ static void handle_seat_container_destroy(struct wl_listener *listener, // TODO handle workspace switch in the seat? bool set_focus = + focus != NULL && (focus == con || container_has_child(con, focus)) && con->type != C_WORKSPACE; @@ -103,12 +104,13 @@ static void handle_seat_container_destroy(struct wl_listener *listener, struct sway_container *next_focus = NULL; while (next_focus == NULL) { next_focus = sway_seat_get_focus_by_type(seat, parent, C_VIEW); - parent = parent->parent; if (next_focus == NULL && parent->type == C_WORKSPACE) { next_focus = parent; break; } + + parent = parent->parent; } // the structure change might have caused it to move up to the top of @@ -440,7 +442,8 @@ struct sway_container *sway_seat_get_focus_by_type(struct sway_seat *seat, wl_list_for_each(current, &seat->focus_stack, link) { parent = current->container->parent; - if (current->container == container) { + if (current->container == container && + (type == C_TYPES || container->type == type)) { return current->container; } -- cgit v1.2.3