aboutsummaryrefslogtreecommitdiffstats
path: root/sway/input/seat.c
diff options
context:
space:
mode:
Diffstat (limited to 'sway/input/seat.c')
-rw-r--r--sway/input/seat.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/sway/input/seat.c b/sway/input/seat.c
index c5c8459e..ce933b66 100644
--- a/sway/input/seat.c
+++ b/sway/input/seat.c
@@ -51,6 +51,16 @@ static void seat_device_destroy(struct sway_seat_device *seat_device) {
51static void seat_node_destroy(struct sway_seat_node *seat_node) { 51static void seat_node_destroy(struct sway_seat_node *seat_node) {
52 wl_list_remove(&seat_node->destroy.link); 52 wl_list_remove(&seat_node->destroy.link);
53 wl_list_remove(&seat_node->link); 53 wl_list_remove(&seat_node->link);
54
55 /*
56 * This is the only time we remove items from the focus stack without
57 * immediately re-adding them. If we just removed the last thing,
58 * mark that nothing has focus anymore.
59 */
60 if (wl_list_empty(&seat_node->seat->focus_stack)) {
61 seat_node->seat->has_focus = false;
62 }
63
54 free(seat_node); 64 free(seat_node);
55} 65}
56 66
@@ -1415,9 +1425,8 @@ struct sway_node *seat_get_focus(struct sway_seat *seat) {
1415 if (!seat->has_focus) { 1425 if (!seat->has_focus) {
1416 return NULL; 1426 return NULL;
1417 } 1427 }
1418 if (wl_list_empty(&seat->focus_stack)) { 1428 sway_assert(!wl_list_empty(&seat->focus_stack),
1419 return NULL; 1429 "focus_stack is empty, but has_focus is true");
1420 }
1421 struct sway_seat_node *current = 1430 struct sway_seat_node *current =
1422 wl_container_of(seat->focus_stack.next, current, link); 1431 wl_container_of(seat->focus_stack.next, current, link);
1423 return current->node; 1432 return current->node;