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.
This commit is contained in:
Isaac Freund 2021-01-07 11:19:22 +01:00
parent 751b63f6fa
commit b468f0aa85
No known key found for this signature in database
GPG Key ID: 86DED400DDFD7A11

View File

@ -471,10 +471,12 @@ fn processMotion(self: *Self, device: *wlr.InputDevice, time: u32, delta_x: f64,
}, },
.down => |view| { .down => |view| {
self.wlr_cursor.move(device, delta_x, delta_y); 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( self.seat.wlr_seat.pointerNotifyMotion(
time, time,
self.wlr_cursor.x - @intToFloat(f64, view.current.box.x - view.surface_box.x), self.wlr_cursor.x - @intToFloat(f64, output_box.x + 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.y - @intToFloat(f64, output_box.y + view.current.box.y - view.surface_box.y),
); );
}, },
.move => |view| { .move => |view| {