aboutsummaryrefslogtreecommitdiffstats
path: root/sway/input/seat.c
diff options
context:
space:
mode:
authorLibravatar Tony Crisci <tony@dubstepdish.com>2018-03-31 18:52:02 -0400
committerLibravatar Tony Crisci <tony@dubstepdish.com>2018-03-31 18:52:02 -0400
commiteda425fdabb4050eb2ecc8741793d83e3a7bf154 (patch)
tree234918f83c38f0c494b8f0a04dff5704459bdbe6 /sway/input/seat.c
parentclean up view destroy seat cleanup (diff)
downloadsway-eda425fdabb4050eb2ecc8741793d83e3a7bf154.tar.gz
sway-eda425fdabb4050eb2ecc8741793d83e3a7bf154.tar.zst
sway-eda425fdabb4050eb2ecc8741793d83e3a7bf154.zip
fix some segfaults
Diffstat (limited to 'sway/input/seat.c')
-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,
94 94
95 // TODO handle workspace switch in the seat? 95 // TODO handle workspace switch in the seat?
96 bool set_focus = 96 bool set_focus =
97 focus != NULL &&
97 (focus == con || container_has_child(con, focus)) && 98 (focus == con || container_has_child(con, focus)) &&
98 con->type != C_WORKSPACE; 99 con->type != C_WORKSPACE;
99 100
@@ -103,12 +104,13 @@ static void handle_seat_container_destroy(struct wl_listener *listener,
103 struct sway_container *next_focus = NULL; 104 struct sway_container *next_focus = NULL;
104 while (next_focus == NULL) { 105 while (next_focus == NULL) {
105 next_focus = sway_seat_get_focus_by_type(seat, parent, C_VIEW); 106 next_focus = sway_seat_get_focus_by_type(seat, parent, C_VIEW);
106 parent = parent->parent;
107 107
108 if (next_focus == NULL && parent->type == C_WORKSPACE) { 108 if (next_focus == NULL && parent->type == C_WORKSPACE) {
109 next_focus = parent; 109 next_focus = parent;
110 break; 110 break;
111 } 111 }
112
113 parent = parent->parent;
112 } 114 }
113 115
114 // the structure change might have caused it to move up to the top of 116 // 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,
440 wl_list_for_each(current, &seat->focus_stack, link) { 442 wl_list_for_each(current, &seat->focus_stack, link) {
441 parent = current->container->parent; 443 parent = current->container->parent;
442 444
443 if (current->container == container) { 445 if (current->container == container &&
446 (type == C_TYPES || container->type == type)) {
444 return current->container; 447 return current->container;
445 } 448 }
446 449