Skip to content

RediWM is a Wayland compositor written in Zig (OpenGL ES) that includes everything in one process

fix(editor): use supported field rectangle hit testing

Mel34731fa2f2e9ce
diff --git a/src/editor/app_paint.zig b/src/editor/app_paint.zig
index 3171bde..6454e2a 100644
--- a/src/editor/app_paint.zig
+++ b/src/editor/app_paint.zig
@@ -163,7 +163,7 @@ pub fn paintButton(self: *App, cr: *c.cairo_t, r: field.Rect, label: []const u8,
});
button.paint(&layer.renderer, layer.local(), .{ .label = label, .variant = .secondary, .size = .sm }, .{
.selected = selected,
- .pointer = if (r.contains(self.px, self.py)) .hover else .idle,
+ .pointer = if (self.px >= r.x and self.px < r.x + r.w and self.py >= r.y and self.py < r.y + r.h) .hover else .idle,
.proximity_distance = proximity.distance,
.proximity_x = proximity.x,
.proximity_y = proximity.y,