aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIsaac Freund <ifreund@ifreund.xyz>2021-01-07 11:19:22 +0100
committerIsaac Freund <ifreund@ifreund.xyz>2021-01-07 11:19:22 +0100
commitb468f0aa8502e0cec985f4a9f799c292565f5dcf (patch)
tree0a5058db9adc065362136ac03a301d007100fc0e
parent751b63f6fa5606e3d61b55f204fb16d748539538 (diff)
downloadriver-b468f0aa8502e0cec985f4a9f799c292565f5dcf.tar.gz
river-b468f0aa8502e0cec985f4a9f799c292565f5dcf.tar.xz
cursor: fix down mode motion event coords
These are required to be surface local and we need to take the output's layout coords into account as the cursor itself is in layout coords.
-rw-r--r--river/Cursor.zig6
1 files changed, 4 insertions, 2 deletions
diff --git a/river/Cursor.zig b/river/Cursor.zig
index 7e8d427..0cc2b9a 100644
--- a/river/Cursor.zig
+++ b/river/Cursor.zig
@@ -471,10 +471,12 @@ fn processMotion(self: *Self, device: *wlr.InputDevice, time: u32, delta_x: f64,
},
.down => |view| {
self.wlr_cursor.move(device, delta_x, delta_y);
+ // This takes surface-local coordinates
+ const output_box = view.output.root.output_layout.getBox(view.output.wlr_output).?;
self.seat.wlr_seat.pointerNotifyMotion(
time,
- self.wlr_cursor.x - @intToFloat(f64, view.current.box.x - view.surface_box.x),
- self.wlr_cursor.y - @intToFloat(f64, view.current.box.y - view.surface_box.y),
+ self.wlr_cursor.x - @intToFloat(f64, output_box.x + view.current.box.x - view.surface_box.x),
+ self.wlr_cursor.y - @intToFloat(f64, output_box.y + view.current.box.y - view.surface_box.y),
);
},
.move => |view| {