aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIsaac Freund <mail@isaacfreund.com>2023-03-16 11:03:33 +0100
committerIsaac Freund <mail@isaacfreund.com>2023-03-16 11:03:33 +0100
commit133b88c266d9de2b567bb551aeaa69328ab0dd80 (patch)
treee907d1673c2a36216f694695cf8add3df2f1f30a
parent50c6ae245feedbc0e8e7d1abc955f79e290d3cd9 (diff)
downloadriver-133b88c266d9de2b567bb551aeaa69328ab0dd80.tar.gz
river-133b88c266d9de2b567bb551aeaa69328ab0dd80.tar.xz
LayerSurface: handle focus when switching outputs
Currently if a layer surface is focused and the user focuses a different output the layer surface remains focused. However, updating focus on layer surface unmap only considers seats that have the layer surface's output focused. To fix this there are 3 approaches I see: 1. Unfocus all layer surfaces on the old output when switching output focus, focus any layer surfaces on the new output. 2. Disallow switching output focus while a layer surface is focused. 3. Stop caring about output focus when determining which layer surface should gain/lose focus. I've taken the 3rd option here as it is significantly simpler to implement and maintain but still feels reasonably intuitive.
-rw-r--r--river/LayerSurface.zig3
-rw-r--r--river/Seat.zig1
2 files changed, 1 insertions, 3 deletions
diff --git a/river/LayerSurface.zig b/river/LayerSurface.zig
index 265a4dc..690be64 100644
--- a/river/LayerSurface.zig
+++ b/river/LayerSurface.zig
@@ -166,9 +166,6 @@ fn handleKeyboardInteractiveExclusive(output: *Output) void {
while (it) |node| : (it = node.next) {
const seat = &node.data;
- // Only grab focus of seats which have the output focused
- if (seat.focused_output != output) continue;
-
if (topmost_surface) |to_focus| {
// If we found a surface that requires focus, grab the focus of all
// seats.
diff --git a/river/Seat.zig b/river/Seat.zig
index ef561b1..2f78f83 100644
--- a/river/Seat.zig
+++ b/river/Seat.zig
@@ -152,6 +152,7 @@ pub fn focus(self: *Self, _target: ?*View) void {
// While a layer surface is exclusively focused, views may not receive focus
if (self.focused == .layer) {
const wlr_layer_surface = self.focused.layer.wlr_layer_surface;
+ assert(wlr_layer_surface.mapped);
if (wlr_layer_surface.current.keyboard_interactive == .exclusive and
(wlr_layer_surface.current.layer == .top or wlr_layer_surface.current.layer == .overlay))
{