Skip to content

Fix trackpad fractional-scroll loss and first-click focus in splits - #741

Merged
sbertix merged 2 commits into
mainfrom
sbertix/gh-736-trackpad-scrolling-loses-fractional-moti
Jul 30, 2026
Merged

Fix trackpad fractional-scroll loss and first-click focus in splits#741
sbertix merged 2 commits into
mainfrom
sbertix/gh-736-trackpad-scrolling-loses-fractional-moti

Conversation

@sbertix

@sbertix sbertix commented Jul 30, 2026

Copy link
Copy Markdown
Collaborator

Closes #736

Summary

Two independent input defects from the issue:

  • Precision scroll dropped its fractional remainder. Surface.scrollCallback
    stored poff - amount * cell_size as the pending scroll, but
    amount = poff / cell_size, so that expression equals poff and the sub-row
    remainder was zeroed on every row emitted. Slow trackpad scrolls lost motion
    (with a 16px cell and repeated 7px deltas, rows landed on events 3/6/9 instead
    of 3/5/7). Fixed by truncating to whole rows first and carrying
    poff - trunc(amount) * cell_size, on both axes. Shipped as an out-of-tree
    patch applied at build time; the ghostty submodule pin is untouched.
  • First click on an unfocused split misbehaved. A click on an unfocused split
    while the app and window are already active only transfers focus, but the click
    was forwarded to the terminal, leaking a press (and later an orphaned release)
    that broke the first drag-select. The click is now consumed for focus transfer,
    and every terminal release is gated on a press this view actually sent, so
    neither a same-split click nor a drag that presses in one split and releases in
    another orphans a release. Hit-testing now happens in content-view space so the
    check holds when the split is scrolled into scrollback, focus is gated on the
    window's first responder rather than a cached bit, and Force Touch pressure is
    reset on the swallowed release.

Type of change

  • Bug fix (the linked issue is a bug report)
  • Feature (the linked issue is a feature request marked ready)
  • Documentation
  • Other (please describe)

How was this tested?

  • make check passes (format + lint)
  • make test passes
  • I built and ran the app to confirm the change works

Checklist

  • This pull request is linked to an issue with Closes # above.
  • For a feature, the linked issue is labeled ready.
  • I am the author of this work and accountable for it; no commit is authored or co-authored by an AI agent.
  • I have read the Contributing guide and the Code of Conduct.

sbertix added 2 commits July 30, 2026 14:47
Surface.scrollCallback stored `poff - amount * cell_size` as the pending scroll,
but `amount = poff / cell_size`, so that expression equals `poff` and the sub-row
remainder was zeroed on every threshold crossing, making slow trackpad scrolls
lose motion. Truncate to whole rows first and carry `poff - trunc(amount) *
cell_size` instead, on both axes.

Delivered as an out-of-tree patch applied at build time; the submodule pin is
untouched.
A left click on an unfocused split while the app and window are already active
only transfers focus, but the click was forwarded to the terminal, leaking a
press (and later an orphaned release) that broke the first drag-select. Consume
that click and gate every terminal release on a press this view actually sent,
so neither a same-split click nor a drag that presses in one split and releases
in another can orphan a release.

Hit-test in content-view space so the check still holds when the surface is
scrolled into scrollback (its frame origin tracks the scroll offset), gate focus
on the window's first responder rather than a cached bit, and reset Force Touch
pressure on the swallowed release.
@sbertix
sbertix enabled auto-merge (squash) July 30, 2026 12:51
@sbertix
sbertix merged commit e3d20a9 into main Jul 30, 2026
4 checks passed
@sbertix
sbertix deleted the sbertix/gh-736-trackpad-scrolling-loses-fractional-moti branch July 30, 2026 13:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Trackpad scrolling loses fractional motion and first mouse selection can miss focus

1 participant