diff options
| author | Isaac Freund <ifreund@ifreund.xyz> | 2020-04-19 15:15:50 +0200 |
|---|---|---|
| committer | Isaac Freund <ifreund@ifreund.xyz> | 2020-04-19 15:15:50 +0200 |
| commit | 472e2b2624d9fe3b92f2139fbd53771f4e9709b3 (patch) | |
| tree | 997c21236bfcf254eabe5edfa812e317c7a51649 /src | |
| parent | a0c30de132a71bb90b2e90607a1fe0a78fd44322 (diff) | |
| download | river-472e2b2624d9fe3b92f2139fbd53771f4e9709b3.tar.gz river-472e2b2624d9fe3b92f2139fbd53771f4e9709b3.tar.xz | |
Fix layer sufaces holding focus after unmap
Diffstat (limited to 'src')
| -rw-r--r-- | src/layer_surface.zig | 10 | ||||
| -rw-r--r-- | src/output.zig | 5 | ||||
| -rw-r--r-- | src/seat.zig | 3 |
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; } |
