Skip to content

Auto Scroll triggered by a Logitech button starts at the cursor - #1480

Merged
lujjjh merged 1 commit into
mainfrom
fix-logitech-auto-scroll-anchor
Nov 1, 2026
Merged

lujjjh merged 1 commit into
mainfrom
fix-logitech-auto-scroll-anchor

Conversation

@lujjjh

@lujjjh lujjjh commented Nov 1, 2026

Copy link
Copy Markdown
Collaborator

Summary

When Auto Scroll is triggered by a Logitech control (a button diverted over HID++, such as the MX Master gesture or thumb button), the anchor was placed at the wrong vertical position:

  • the indicator appeared vertically mirrored instead of under the cursor;
  • in toggle mode, the first movement started fast vertical scrolling;
  • in hold mode, the slightest movement activated Auto Scroll, skipping the dead zone.

The closer the cursor was to the vertical center of the main display, the less noticeable it was. Middle-button triggers were not affected.

Cause

LogitechEventContext.mouseLocation comes from CGEvent(source: nil).location, which uses global display coordinates with a top-left origin. Auto Scroll measures pointer travel with CGEvent.unflippedLocation, whose origin is the bottom-left of the main display. The anchor and the following pointer events were therefore in different coordinate spaces.

Fix

Convert the Logitech location into the unflippedLocation space before using it as the anchor for pending and immediate activations.

Testing

  • Added testLogitechHoldAnchorsAtTheCursorPosition: a 2pt move after a Logitech press stays inside the dead zone, and a 20pt move activates Auto Scroll. It fails without this fix.
  • Full unit test suite passes.
  • Manually tested with a Logitech control as the trigger.

🤖 Generated with Claude Code

Logitech control events report the cursor in global display coordinates
(top-left origin), while Auto Scroll measures pointer travel with
unflippedLocation (bottom-left origin of the main display). The anchor and
the following pointer events disagreed vertically, so the indicator showed
up mirrored and the slightest movement scrolled fast or skipped the dead
zone. Convert the Logitech location before using it as the anchor.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@lujjjh lujjjh added the bug Something isn't working label Nov 1, 2026
@coderabbitai

coderabbitai Bot commented Nov 1, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent review info
Run configuration
Commits

Reviewing files that changed from the base of the PR and between 50cee2e and 795bdc3.

Files selected for processing: 2
  • LinearMouse/EventTransformer/AutoScrollTransformer.swift
  • LinearMouseUnitTests/EventTransformer/AutoScrollTransformerTests.swift

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review.

Walkthrough

Logitech autoscroll activation now anchors to a pointer location converted from the context coordinates. A unit test checks that hold activation responds to movement relative to the press position.

Changes: Logitech autoscroll cursor anchoring

Layer / File(s) Summary
Convert and use the Logitech pointer location
LinearMouse/EventTransformer/AutoScrollTransformer.swift, LinearMouseUnitTests/EventTransformer/AutoScrollTransformerTests.swift
A helper converts the Logitech context location using the main display height. Long-press, hold-only, and immediate activation use the converted location. A test checks that a small move does not activate autoscroll and a larger vertical move does.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Merge Risk: Minimal · up to 795bd

Logitech-triggered Auto Scroll now uses the same coordinate space as pointer movement. No material merge-blocking risk was identified.

Pre-merge checks: Passed 4
Check name Status Explanation
Title check Passed The title clearly identifies the main change: Logitech-triggered Auto Scroll now starts at the cursor.
Description check Passed The description explains the coordinate-space mismatch, the fix, the affected behavior, and the validation performed. It is directly related to the changeset.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Finishing Touches
Generate docstrings
  • Commit to this branch
  • Create a new PR
Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@lujjjh
lujjjh enabled auto-merge (squash) November 1, 2026 06:07
@lujjjh
lujjjh merged commit ef679a3 into main Nov 1, 2026
2 checks passed
@lujjjh
lujjjh deleted the fix-logitech-auto-scroll-anchor branch November 1, 2026 06:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant