aboutsummaryrefslogtreecommitdiff
path: root/sway/input
diff options
context:
space:
mode:
authorTony Crisci <tony@dubstepdish.com>2018-03-31 18:52:02 -0400
committerTony Crisci <tony@dubstepdish.com>2018-03-31 18:52:02 -0400
commiteda425fdabb4050eb2ecc8741793d83e3a7bf154 (patch)
tree234918f83c38f0c494b8f0a04dff5704459bdbe6 /sway/input
parent2aec85bf241f4bad59a23e8492e91d3e7add6ab6 (diff)
downloadsway-eda425fdabb4050eb2ecc8741793d83e3a7bf154.tar.xz
fix some segfaults
Diffstat (limited to 'sway/input')
-rw-r--r--sway/input/seat.c7
1 files changed, 5 insertions, 2 deletions
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;
}