From 088b374b1a3e7ead08e1430d3d89649b1cd5a54b Mon Sep 17 00:00:00 2001
From: Brian Ashworth <bosrsf04@gmail.com>
Date: Thu, 26 Dec 2019 19:51:06 -0500
Subject: layer-shell: refocus if keyboard interactive lost

When arranging layer-shell layers, verify that the currently focused
layer, if any, for each seat is still keyboard interactive. If the layer
is no longer keyboard interactive and there is not a keyboard
interactive overlay or top layer to change the focus to, refocus the
focus inactive node for the seat.
---
 sway/desktop/layer_shell.c | 3 +++
 1 file changed, 3 insertions(+)

(limited to 'sway')

diff --git a/sway/desktop/layer_shell.c b/sway/desktop/layer_shell.c
index b754b1fa..b6dddff6 100644
--- a/sway/desktop/layer_shell.c
+++ b/sway/desktop/layer_shell.c
@@ -215,6 +215,9 @@ void arrange_layers(struct sway_output *output) {
 	wl_list_for_each(seat, &server.input->seats, link) {
 		if (topmost != NULL) {
 			seat_set_focus_layer(seat, topmost->layer_surface);
+		} else if (seat->focused_layer &&
+				!seat->focused_layer->current.keyboard_interactive) {
+			seat_set_focus_layer(seat, NULL);
 		}
 	}
 }
-- 
cgit v1.2.3