Skip to content

fix(macos): write the scroll point delta last so pixel precision survives - #1156

Open
isleofgreg wants to merge 1 commit into
AprilNEA:masterfrom
isleofgreg:fix/scroll-point-delta-write-order
Open

fix(macos): write the scroll point delta last so pixel precision survives#1156
isleofgreg wants to merge 1 commit into
AprilNEA:masterfrom
isleofgreg:fix/scroll-point-delta-write-order

Conversation

@isleofgreg

Copy link
Copy Markdown
Contributor

Summary

Hardware-verification follow-up to #1141 (first of the fix series proposed there).

A scroll CGEvent keeps one canonical distance. set_continuous_axis writes the pixel/point delta first and the coarse integer line field after it, which makes the line count canonical: at delivery the point delta is re-derived from it at 8 points per line. Every smooth-scroll frame under 10 posted points reaches applications as zero, and the rest quantize to 8-point steps.

Measured on macOS 15.7 (MX Master 4, free-spin wheel, listen-only session-tap logger): a slow animated stream lost 77% of its distance, a medium one 45%. This is most of the reason smooth_scroll = true currently travels less than native (#1141's 0.58× number).

The fix is a reorder: write the line and fixed-point fields first, the point delta last, so it stays authoritative. Verified with isolated synthetic-event experiments that the mangle follows field write order, not posting location (HID vs session tap both show it when the line field is written last).

Test plan

  • cargo fmt --all --check, cargo clippy -p openlogi-inject --all-targets -- -D warnings (aarch64-darwin + x86_64-pc-windows-gnu), cargo test -p openlogi-inject, cargo check --workspace — all green.
  • On hardware: with this reorder, sub-10-point frames arrive intact and slow smooth-scroll streams deliver their full distance (same logger, before/after).

🤖 Generated with Claude Code

…ives

A scroll CGEvent keeps one canonical distance. set_continuous_axis wrote
the pixel/point delta first and the coarse integer line field after it,
which made the line count canonical: at delivery the point delta is
re-derived from it at 8 points per line, so every smooth-scroll frame
under 10 posted points reached applications as zero and the rest
quantized to 8-point steps. Measured on macOS 15.7 (MX Master 4,
free-spin): a slow animated stream lost 77% of its distance, a medium
one 45%.

Writing the point delta last keeps it authoritative. Verified with
isolated synthetic-event experiments that the mangle follows field write
order, not the posting location.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@greptile-apps

greptile-apps Bot commented Aug 30, 2026

Copy link
Copy Markdown

Greptile Summary

This PR fixes precision loss in macOS continuous scrolling by writing the Core Graphics point-delta field after the coarser line and fixed-point fields.

  • Reorders scroll-event field writes so the point delta remains canonical.
  • Documents the write-order dependency and observed macOS quantization behavior.

Confidence Score: 5/5

The PR appears safe to merge, with the narrowly scoped field-order change matching the documented Core Graphics behavior and hardware verification.

The changed helper still populates all three scroll representations but now writes the precise point delta last, preventing the subsequently delivered event from being canonicalized to the coarse line value.

Important Files Changed

Filename Overview
crates/openlogi-inject/src/inject/macos.rs Reorders continuous-scroll field assignment to preserve pixel precision; no actionable defect was identified.

Reviews (1): Last reviewed commit: "fix(macos): write the scroll point delta..." | Re-trigger Greptile

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

platform: macos macOS-specific issue type: bug Something is broken or behaves incorrectly

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants