diff options
| author | Isaac Freund <mail@isaacfreund.com> | 2021-12-22 04:32:23 +0000 |
|---|---|---|
| committer | Isaac Freund <mail@isaacfreund.com> | 2021-12-22 04:32:23 +0000 |
| commit | 334ede00e134029e01f8b7cb7b5126c17ec0fafe (patch) | |
| tree | 3285a410eada4fbda2ccc18ed58fcc0a651bd65a | |
| parent | 2288778dd794507c3d18524496340b2e29008221 (diff) | |
| download | river-334ede00e134029e01f8b7cb7b5126c17ec0fafe.tar.gz river-334ede00e134029e01f8b7cb7b5126c17ec0fafe.tar.xz | |
Cursor: properly handle clients setting the cursor image
The new code to dedup XcursorManager.setCursorImage() calls for
efficiency currently doesn't handle clients setting the cursor properly.
This commit corrects this oversight.
| -rw-r--r-- | river/Cursor.zig | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/river/Cursor.zig b/river/Cursor.zig index be1c459..f78800b 100644 --- a/river/Cursor.zig +++ b/river/Cursor.zig @@ -65,7 +65,8 @@ const Mode = union(enum) { }; const Image = enum { - none, + /// The current image of the cursor is unknown, perhaps because it was set by a client. + unknown, left_ptr, move, @"se-resize", @@ -83,7 +84,7 @@ wlr_cursor: *wlr.Cursor, pointer_gestures: *wlr.PointerGesturesV1, xcursor_manager: *wlr.XcursorManager, -image: Image = .none, +image: Image = .unknown, constraint: ?*wlr.PointerConstraintV1 = null, @@ -217,6 +218,8 @@ pub fn handleViewUnmap(self: *Self, view: *View) void { /// as it does no checks to see if the the given image is already set. Therefore, /// do that check here. fn setImage(self: *Self, image: Image) void { + assert(image != .unknown); + if (image == self.image) return; self.image = image; @@ -455,6 +458,7 @@ fn handleRequestSetCursor( // cursor moves between outputs. log.debug("focused client set cursor", .{}); self.wlr_cursor.setSurface(event.surface, event.hotspot_x, event.hotspot_y); + self.image = .unknown; } } |
