From 9660151c94e988620c79b40a0326057b9854c081 Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Sun, 27 Sep 2026 22:16:35 -0300 Subject: Move the mouse out of pardes.zig into mouse.zig Pure move, no behaviour change: handleMouse with dragUpdate, dragRelease, seamIdxAt, reportGesture, gestureRange, dispatchPointerBuiltin, mirrorTtySelection and chordCutPaste, the pointer hit helpers (bodyHitForPane, sameTagCell, tagColumn, sameBodyCell), chromeTarget with ChromeTarget, paneAt, the Drag state type with clampBorderCol/Row, the seam test fixtures and thirteen pointer and drag tests go verbatim to mouse.zig. The methods become free functions taking `p: *Pardes`; their 36 call sites change from `p.handleMouse(..)` to `mouse.handleMouse(p, ..)`, including web.zig's chromeTarget and macos.zig's paneAt. The Mouse event type stays in pardes.zig with the rest of the event vocabulary. Co-Authored-By: Claude Opus 5.5 --- src/web.zig | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/web.zig') diff --git a/src/web.zig b/src/web.zig index b5a992ae..4c2a9db8 100644 --- a/src/web.zig +++ b/src/web.zig @@ -10,6 +10,7 @@ const std = @import("std"); const pardes = @import("pardes.zig"); +const mouse = @import("mouse.zig"); const gpa = std.heap.wasm_allocator; const embedded_dump = @embedFile("embedded.dump.zon"); @@ -441,7 +442,7 @@ export fn pardes_chrome_target(col_arg: u32, row_arg: u32) u32 { const s = &(state orelse return std.math.maxInt(u32)); const col: u16 = @intCast(@min(col_arg, std.math.maxInt(u16))); const row: u16 = @intCast(@min(row_arg, std.math.maxInt(u16))); - const target = s.core.chromeTarget(col, row) orelse return std.math.maxInt(u32); + const target = mouse.chromeTarget(s.core, col, row) orelse return std.math.maxInt(u32); return (@as(u32, target.row) << 16) | target.col; } -- cgit v1.3