aboutsummaryrefslogtreecommitdiffstats
path: root/sway/input/seat.c
diff options
context:
space:
mode:
authorLibravatar Brian Ashworth <bosrsf04@gmail.com>2019-02-22 23:09:39 -0500
committerLibravatar emersion <contact@emersion.fr>2019-02-23 09:21:19 +0100
commit9350a52c0e8b502f9dc7f876da0527607a44bfec (patch)
treef9679e748d8e25b63b031c555c5dbe60cf954f65 /sway/input/seat.c
parentfish: improve completions a little bit (diff)
downloadsway-9350a52c0e8b502f9dc7f876da0527607a44bfec.tar.gz
sway-9350a52c0e8b502f9dc7f876da0527607a44bfec.tar.zst
sway-9350a52c0e8b502f9dc7f876da0527607a44bfec.zip
handle_seat_node_destroy: update seat->workspace
If an unmanaged or layer surface is focused when an output gets disabled and an empty workspace on the output was focused by the seat, the seat needs to refocus it's focus inactive to update the value of `seat->workspace`.
Diffstat (limited to 'sway/input/seat.c')
-rw-r--r--sway/input/seat.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/sway/input/seat.c b/sway/input/seat.c
index 69b04843..6482a47c 100644
--- a/sway/input/seat.c
+++ b/sway/input/seat.c
@@ -146,6 +146,19 @@ static void handle_seat_node_destroy(struct wl_listener *listener, void *data) {
146 struct sway_node *focus = seat_get_focus(seat); 146 struct sway_node *focus = seat_get_focus(seat);
147 147
148 if (node->type == N_WORKSPACE) { 148 if (node->type == N_WORKSPACE) {
149 // If an unmanaged or layer surface is focused when an output gets
150 // disabled and an empty workspace on the output was focused by the
151 // seat, the seat needs to refocus it's focus inactive to update the
152 // value of seat->workspace.
153 if (seat->workspace == node->sway_workspace) {
154 struct sway_node *node = seat_get_focus_inactive(seat, &root->node);
155 seat_set_focus(seat, NULL);
156 if (node) {
157 seat_set_focus(seat, node);
158 } else {
159 seat->workspace = NULL;
160 }
161 }
149 seat_node_destroy(seat_node); 162 seat_node_destroy(seat_node);
150 return; 163 return;
151 } 164 }