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

commit0937993b3ca0b8e28f17a15385ff7ec55a4c805d
parent869bce2df3
authorZakariyya Von Forslun <[email protected]>
date2022-06-09 15:07
Cursor: fix focus for Xwayland override redirect windows

Setting focus on button click for override redirect windows did not
consider whether the window actually wants focus.

 river/Cursor.zig | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/river/Cursor.zig b/river/Cursor.zig
index 0b90054..4557bad 100644
--- a/river/Cursor.zig
+++ b/river/Cursor.zig
@@ -316,10 +316,9 @@ fn handleButton(listener: *wl.Listener(*wlr.Pointer.event.Button), event: *wlr.P
                 }
             },
             .xwayland_override_redirect => |override_redirect| {
-                if (build_options.xwayland) {
+                if (!build_options.xwayland) unreachable;
+                if (override_redirect.xwayland_surface.overrideRedirectWantsFocus()) {
                     self.seat.setFocusRaw(.{ .xwayland_override_redirect = override_redirect });
-                } else {
-                    unreachable;
                 }
             },
         }