git.lucas.co / cce-compositor
Wayland compositor (wlroots)
git clone https://git.lucas.co/cce-compositor.git

commit352f5c562f00b6a3f13568f82731956286e39ed0
parent906a979dd7
authorLeon Henrik Plickat <[email protected]>
date2021-05-07 07:23
Allow changing output focus with pointer

 river/Seat.zig | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/river/Seat.zig b/river/Seat.zig
index 10ae97b..d47d64c 100644
--- a/river/Seat.zig
+++ b/river/Seat.zig
@@ -122,10 +122,14 @@ pub fn focus(self: *Self, _target: ?*View) void {
     // While a layer surface is focused, views may not recieve focus
     if (self.focused == .layer) return;
 
-    // If the view is not currently visible, behave as if null was passed
     if (target) |view| {
-        if (view.output != self.focused_output or
-            view.pending.tags & self.focused_output.pending.tags == 0) target = null;
+        // If the view is not currently visible, behave as if null was passed
+        if (view.pending.tags & view.output.pending.tags == 0) {
+            target = null;
+        } else {
+            // If the view is not on the currently focused output, focus it
+            if (view.output != self.focused_output) self.focusOutput(view.output);
+        }
     }
 
     // If the target view is not fullscreen or null, then a fullscreen view