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

commit0093d9b03d2f2291c4a4f60befbb3df649a6df0d
parente778e87364
authorIsaac Freund <[email protected]>
date2024-02-10 12:00
command/zoom: always warp cursor if configured

Focus may not actually change here so seat.focus() may not automatically
warp the cursor.  Nevertheless, a cursor warp seems to be what users
expect with `set-cursor-warp on-focus` configured, especially in
combination with focus-follows-cursor.

 river/command/zoom.zig | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/river/command/zoom.zig b/river/command/zoom.zig
index 0a16eb6..7db3500 100644
--- a/river/command/zoom.zig
+++ b/river/command/zoom.zig
@@ -76,6 +76,10 @@ pub fn zoom(
         target.pending_wm_stack_link.remove();
         output.pending.wm_stack.prepend(target);
         seat.focus(target);
+        // Focus may not actually change here so seat.focus() may not automatically warp the cursor.
+        // Nevertheless, a cursor warp seems to be what users expect with `set-cursor-warp on-focus`
+        // configured, especially in combination with focus-follows-cursor.
+        seat.cursor.may_need_warp = true;
         server.root.applyPending();
     }
 }