From 84f5283889589b8972a8e1554416abbd7e88e593 Mon Sep 17 00:00:00 2001 From: novakne Date: Thu, 22 Apr 2021 07:46:17 +0200 Subject: [PATCH] pixman: update and fix PointerConstraint --- deps/zig-pixman | 2 +- river/PointerConstraint.zig | 9 ++++----- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/deps/zig-pixman b/deps/zig-pixman index f8e682a..9acac69 160000 --- a/deps/zig-pixman +++ b/deps/zig-pixman @@ -1 +1 @@ -Subproject commit f8e682ac2f640368ebb414aa2e7db6a2be1b179e +Subproject commit 9acac698e073ff54b09a62fecb144de326f67626 diff --git a/river/PointerConstraint.zig b/river/PointerConstraint.zig index fc5cf20..3e9667f 100644 --- a/river/PointerConstraint.zig +++ b/river/PointerConstraint.zig @@ -85,12 +85,11 @@ fn constrainToRegion(self: *Self) void { var box: pixman.Box32 = undefined; if (!self.constraint.region.containsPoint(cx, cy, &box)) { - var nRects: c_int = undefined; - const rects = self.constraint.region.rectangles(&nRects); + const rects = self.constraint.region.rectangles(); - if (nRects > 0) { - const new_cx = @intToFloat(f64, view.current.box.x + rects.x1 + @divFloor(rects.x2, 2)); - const new_cy = @intToFloat(f64, view.current.box.y + rects.y1 + @divFloor(rects.y2, 2)); + if (rects.len > 0) { + const new_cx = @intToFloat(f64, view.current.box.x + rects[0].x1 + @divFloor(rects[0].x2, 2)); + const new_cy = @intToFloat(f64, view.current.box.y + rects[0].y1 + @divFloor(rects[0].y2, 2)); self.cursor.wlr_cursor.warpClosest(null, new_cx, new_cy); }