diff options
| author | Gabriel Schneider <[email protected]> | 2026-11-04 23:21:07 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-11-05 01:40:08 -0300 |
| commit | b10679649936d986f7cf798352cf999324666952 (patch) | |
| tree | bf11709dae39f911534216e3065237c76a10a027 /src/gui | |
| parent | 27d8941a177a4ec2c3b0990d4b81f529b93c6f0a (diff) | |
| download | pardes-b10679649936d986f7cf798352cf999324666952.tar.gz pardes-b10679649936d986f7cf798352cf999324666952.zip | |
the pinch and touch_scroll events go: the window and the web page sent them and the core only kept them for two numbers on the Debug line; their wire tags (0x1b, 0x1c) now answer BadTag, and the NaN check they had moves onto pdf_scroll's distance
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016Y9MNAtZenFv4weoMD3cge
Diffstat (limited to 'src/gui')
| -rw-r--r-- | src/gui/gui.zig | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/src/gui/gui.zig b/src/gui/gui.zig index 880e41ee..3fdcd21c 100644 --- a/src/gui/gui.zig +++ b/src/gui/gui.zig @@ -789,7 +789,7 @@ const Touch = struct { return center; } - fn noteMotion(t: *Touch, f: Finger) ?struct { center: TouchNormPoint, ticks: i32, delta_y: f32 } { + fn noteMotion(t: *Touch, f: Finger) ?struct { center: TouchNormPoint, ticks: i32 } { if (!t.scroll.active or (t.scroll.ids[0] != f.id and t.scroll.ids[1] != f.id)) return null; const center = t.pairCenter(t.scroll.ids) orelse t.scroll.last_center; const delta_y = center.y - t.scroll.last_center.y; @@ -798,7 +798,7 @@ const Touch = struct { const ticks = takeScrollTicks(&t.scroll.accum_y); if (ticks == 0) return null; t.scroll.scrolled = true; - return .{ .center = center, .ticks = ticks, .delta_y = @as(f32, @floatFromInt(ticks)) * touch_scroll_tick }; + return .{ .center = center, .ticks = ticks }; } }; @@ -826,7 +826,7 @@ fn handlePairFinger(t: *Touch, in: *Input, f: Finger, win_w: f32, win_h: f32, ce t.syncPair(); if (!had_pair) return; const res = t.noteMotion(f) orelse return; - emitTouchScroll(in, res.center, res.ticks, res.delta_y, win_w, win_h, cell_w, cell_h, tagline_w); + emitTouchScroll(in, res.center, res.ticks, win_w, win_h, cell_w, cell_h, tagline_w); }, .up, .cancel => { const tap_center = t.finishPair(f); @@ -837,13 +837,12 @@ fn handlePairFinger(t: *Touch, in: *Input, f: Finger, win_w: f32, win_h: f32, ce } } -fn emitTouchScroll(in: *Input, center: TouchNormPoint, ticks: i32, delta_y: f32, win_w: f32, win_h: f32, cell_w: f32, cell_h: f32, tagline_w: f32) void { +fn emitTouchScroll(in: *Input, center: TouchNormPoint, ticks: i32, win_w: f32, win_h: f32, cell_w: f32, cell_h: f32, tagline_w: f32) void { const cell = gridCellAtDimensions(in.core, center.x * win_w, center.y * win_h, cell_w, cell_h, tagline_w); const button: pardes.Mouse.Button = if (ticks > 0) .wheel_up else .wheel_down; var remaining: u32 = @abs(ticks); while (remaining > 0) : (remaining -= 1) in.post(.{ .mouse = .{ .button = button, .kind = .press, .col = cell.col, .row = cell.row, .tag_hit = cell.tag_hit, .body_hit = cell.body_hit } }); - in.post(.{ .touch_scroll = delta_y }); } fn emitTouchClick(in: *Input, point: TouchNormPoint, button: pardes.Mouse.Button, win_w: f32, win_h: f32, cell_w: f32, cell_h: f32, tagline_w: f32) void { @@ -3416,7 +3415,6 @@ fn dispatch(g: *Gui, in: *Input, sev: *const c.SDL_Event) void { const fch: f32 = @floatFromInt(g.cell_h); handleFinger(&g.touch, in, finger, win_w, win_h, fcw, fch, @floatFromInt(g.tagline_width)); }, - c.SDL_EVENT_PINCH_BEGIN, c.SDL_EVENT_PINCH_UPDATE => in.post(.{ .pinch = sev.pinch.scale }), c.SDL_EVENT_GAMEPAD_ADDED => { if (g.gamepad == null) g.gamepad = c.SDL_OpenGamepad(sev.gdevice.which); }, @@ -4154,7 +4152,7 @@ const Shell = struct { if (sev.type != c.SDL_EVENT_USER) s.mail_only = false; if (!s.peers.recording) return false; switch (sev.type) { - c.SDL_EVENT_KEY_DOWN, c.SDL_EVENT_TEXT_INPUT, c.SDL_EVENT_MOUSE_BUTTON_DOWN, c.SDL_EVENT_MOUSE_BUTTON_UP, c.SDL_EVENT_MOUSE_MOTION, c.SDL_EVENT_MOUSE_WHEEL, c.SDL_EVENT_WINDOW_FOCUS_GAINED, c.SDL_EVENT_WINDOW_FOCUS_LOST, c.SDL_EVENT_WINDOW_MOUSE_LEAVE, c.SDL_EVENT_FINGER_DOWN, c.SDL_EVENT_FINGER_MOTION, c.SDL_EVENT_FINGER_UP, c.SDL_EVENT_PINCH_BEGIN, c.SDL_EVENT_PINCH_UPDATE => {}, + c.SDL_EVENT_KEY_DOWN, c.SDL_EVENT_TEXT_INPUT, c.SDL_EVENT_MOUSE_BUTTON_DOWN, c.SDL_EVENT_MOUSE_BUTTON_UP, c.SDL_EVENT_MOUSE_MOTION, c.SDL_EVENT_MOUSE_WHEEL, c.SDL_EVENT_WINDOW_FOCUS_GAINED, c.SDL_EVENT_WINDOW_FOCUS_LOST, c.SDL_EVENT_WINDOW_MOUSE_LEAVE, c.SDL_EVENT_FINGER_DOWN, c.SDL_EVENT_FINGER_MOTION, c.SDL_EVENT_FINGER_UP => {}, else => return false, } if (s.took_input) { |
