Skip to content

Version 4.0.0 - Refactor Trackpad API#167

Open
unhuman wants to merge 1 commit into
artginzburg:mainfrom
unhuman:apiOptimize
Open

Version 4.0.0 - Refactor Trackpad API#167
unhuman wants to merge 1 commit into
artginzburg:mainfrom
unhuman:apiOptimize

Conversation

@unhuman
Copy link
Copy Markdown

@unhuman unhuman commented Apr 28, 2026

fix: Replace CGEvent tap with IOHIDManager for physical click detection

- Physical click detection now uses IOHIDManager, which receives actual hardware button-press events at the kernel HID layer. Three Finger Drag synthesises leftMouseDown events at the CGEvent/accessibility layer and is therefore completely invisible to IOHIDManager — TFD now works alongside MiddleClick without conflict.

- Remove CGEventController and the CGEvent tap (Controller+Mouse.swift). wasLeftConverted, wasRightConverted, physicalClickArmed, and lastClickTime are removed from GlobalState. HIDClickHandler synthesises otherMouseDown/Up directly, rather than intercepting and mutating existing events.

- HIDClickHandler gates conversion on a 60 ms stable contact window (threeDownSince, re-added to GlobalState) to filter pressure-deformation transients during 2-finger clicks, matching the original arming intent.

- Fix tap-to-click false positives: remove the 'early lift' promotion in TouchHandler (armed → stableArmed when count drops after ≥ 50 ms). The qualifying finger count must now remain stable until all contacts lift together, preventing a slow 3-finger scroll or resting thumb from accidentally arming a middle click.

- Remove Three Finger Drag from the conflict detection alert (Controller+Conflicts.swift) since TFD is no longer a conflict.

- Update docs/three-finger-drag.md and docs/CHANGELOG.md.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

    fix: Replace CGEvent tap with IOHIDManager for physical click detection

    - Physical click detection now uses IOHIDManager, which receives actual
      hardware button-press events at the kernel HID layer. Three Finger Drag
      synthesises leftMouseDown events at the CGEvent/accessibility layer and
      is therefore completely invisible to IOHIDManager — TFD now works
      alongside MiddleClick without conflict.

    - Remove CGEventController and the CGEvent tap (Controller+Mouse.swift).
      wasLeftConverted, wasRightConverted, physicalClickArmed, and lastClickTime
      are removed from GlobalState. HIDClickHandler synthesises otherMouseDown/Up
      directly, rather than intercepting and mutating existing events.

    - HIDClickHandler gates conversion on a 60 ms stable contact window
      (threeDownSince, re-added to GlobalState) to filter pressure-deformation
      transients during 2-finger clicks, matching the original arming intent.

    - Fix tap-to-click false positives: remove the 'early lift' promotion
      in TouchHandler (armed → stableArmed when count drops after ≥ 50 ms).
      The qualifying finger count must now remain stable until all contacts
      lift together, preventing a slow 3-finger scroll or resting thumb from
      accidentally arming a middle click.

    - Remove Three Finger Drag from the conflict detection alert
      (Controller+Conflicts.swift) since TFD is no longer a conflict.

    - Update docs/three-finger-drag.md and docs/CHANGELOG.md.

    Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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.

1 participant