From eaa2f6d37ea050104e1111cb4c98d761888124d4 Mon Sep 17 00:00:00 2001 From: Isaac Freund Date: Thu, 16 Mar 2023 15:10:52 +0100 Subject: LayerSurface: fix surfaces on multiple outputs at once The previous commit broke handling of keyboard interactive layer surfaces being created on multiple outputs at once. This new approach reverts part of the logic change in the previous commit while keeping the fix for the crash and the new assertion. --- river/LayerSurface.zig | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/river/LayerSurface.zig b/river/LayerSurface.zig index 690be64..c7e2aef 100644 --- a/river/LayerSurface.zig +++ b/river/LayerSurface.zig @@ -166,11 +166,16 @@ fn handleKeyboardInteractiveExclusive(output: *Output) void { while (it) |node| : (it = node.next) { const seat = &node.data; - if (topmost_surface) |to_focus| { - // If we found a surface that requires focus, grab the focus of all - // seats. - seat.setFocusRaw(.{ .layer = to_focus }); - } else if (seat.focused == .layer) { + if (seat.focused_output == output) { + if (topmost_surface) |to_focus| { + // If we found a surface on the output that requires focus, grab the focus of all + // seats that are focusing that output. + seat.setFocusRaw(.{ .layer = to_focus }); + continue; + } + } + + if (seat.focused == .layer) { const current_focus = seat.focused.layer.wlr_layer_surface; // If the seat is currently focusing an unmapped layer surface or one // without keyboard interactivity, stop focusing that layer surface. -- cgit v1.2.3