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

commit5901e983db27e9df4a2b93be352c26d9663c7f89
parent53e41023bc
authorIsaac Freund <[email protected]>
date2021-07-23 18:37
cursor: add missing maybeResetState() callsite

This function needs to be called whenever pending state is made current,
which includes when views not tracked by the transaction system commit.

 river/InputManager.zig | 5 +++++
 river/Root.zig         | 6 +-----
 river/XdgToplevel.zig  | 1 +
 3 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/river/InputManager.zig b/river/InputManager.zig
index dd066c4..886d86c 100644
--- a/river/InputManager.zig
+++ b/river/InputManager.zig
@@ -178,6 +178,11 @@ pub fn inputAllowed(self: Self, wlr_surface: *wlr.Surface) bool {
         true;
 }
 
+pub fn maybeResetCursorState(self: Self) void {
+    var it = self.seats.first;
+    while (it) |node| : (it = node.next) node.data.cursor.maybeResetState();
+}
+
 fn handleInhibitActivate(
     listener: *wl.Listener(*wlr.InputInhibitManager),
     input_inhibit_manager: *wlr.InputInhibitManager,
diff --git a/river/Root.zig b/river/Root.zig
index b51abed..4384159 100644
--- a/river/Root.zig
+++ b/river/Root.zig
@@ -405,11 +405,7 @@ fn commitTransaction(self: *Self) void {
 
         output.damage.addWhole();
     }
-
-    var seat_it = server.input_manager.seats.first;
-    while (seat_it) |seat_node| : (seat_it = seat_node.next) {
-        seat_node.data.cursor.maybeResetState();
-    }
+    server.input_manager.maybeResetCursorState();
 }
 
 /// Send the new output configuration to all wlr-output-manager clients
diff --git a/river/XdgToplevel.zig b/river/XdgToplevel.zig
index 7431e05..f3cda8c 100644
--- a/river/XdgToplevel.zig
+++ b/river/XdgToplevel.zig
@@ -273,6 +273,7 @@ fn handleCommit(listener: *wl.Listener(*wlr.Surface), surface: *wlr.Surface) voi
                 view.current = view.pending;
                 if (self_tags_changed) view.output.sendViewTags();
                 view.output.damage.addWhole();
+                server.input_manager.maybeResetCursorState();
             }
         } else {
             // If the client has not yet acked our configure, we need to send a