aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIsaac Freund <ifreund@ifreund.xyz>2020-04-19 15:15:50 +0200
committerIsaac Freund <ifreund@ifreund.xyz>2020-04-19 15:15:50 +0200
commit472e2b2624d9fe3b92f2139fbd53771f4e9709b3 (patch)
tree997c21236bfcf254eabe5edfa812e317c7a51649
parenta0c30de132a71bb90b2e90607a1fe0a78fd44322 (diff)
downloadriver-472e2b2624d9fe3b92f2139fbd53771f4e9709b3.tar.gz
river-472e2b2624d9fe3b92f2139fbd53771f4e9709b3.tar.xz
Fix layer sufaces holding focus after unmap
-rw-r--r--src/layer_surface.zig10
-rw-r--r--src/output.zig5
-rw-r--r--src/seat.zig3
3 files changed, 16 insertions, 2 deletions
diff --git a/src/layer_surface.zig b/src/layer_surface.zig
index 0ad76c9..650fdb2 100644
--- a/src/layer_surface.zig
+++ b/src/layer_surface.zig
@@ -117,7 +117,17 @@ pub const LayerSurface = struct {
}
}
+ // This gives exclusive focus to a keyboard interactive top or overlay layer
+ // surface if there is one.
layer_surface.output.arrangeLayers();
+
+ // Ensure that focus is given to the appropriate view if there is no
+ // other top/overlay layer surface to grab focus.
+ it = layer_surface.output.root.server.input_manager.seats.first;
+ while (it) |node| : (it = node.next) {
+ const seat = &node.data;
+ seat.focus(null);
+ }
}
fn handleCommit(listener: ?*c.wl_listener, data: ?*c_void) callconv(.C) void {
diff --git a/src/output.zig b/src/output.zig
index fa09b07..34769f1 100644
--- a/src/output.zig
+++ b/src/output.zig
@@ -259,7 +259,10 @@ pub const Output = struct {
var it = self.layers[layer].last;
while (it) |node| : (it = node.prev) {
const layer_surface = &node.data;
- if (layer_surface.wlr_layer_surface.current.keyboard_interactive) {
+ // Only mapped surfaces may gain focus
+ if (layer_surface.mapped and
+ layer_surface.wlr_layer_surface.current.keyboard_interactive)
+ {
break :outer layer_surface;
}
}
diff --git a/src/seat.zig b/src/seat.zig
index 6b7539e..9d13257 100644
--- a/src/seat.zig
+++ b/src/seat.zig
@@ -161,7 +161,8 @@ pub const Seat = struct {
std.debug.assert(self.focused_layer == null);
current_focus.setActivated(false);
self.focused_view = null;
- } else if (self.focused_layer) |current_focus| {
+ }
+ if (self.focused_layer) |current_focus| {
std.debug.assert(self.focused_view == null);
self.focused_layer = null;
}