diff options
| author | Gabriel Schneider <[email protected]> | 2026-09-15 12:43:53 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-09-15 17:24:42 -0300 |
| commit | c787d59a987ec601cd7b65399543afe6d37a615d (patch) | |
| tree | b593436d7aa4c37cb0e59eef5412dbb77ae5faad /src/macos/Sources | |
| parent | 8b0bed0427064794725f95cb7b020d7d96956975 (diff) | |
| download | pardes-c787d59a987ec601cd7b65399543afe6d37a615d.tar.gz pardes-c787d59a987ec601cd7b65399543afe6d37a615d.zip | |
Route mouse thumb buttons to jump history
Diffstat (limited to 'src/macos/Sources')
| -rw-r--r-- | src/macos/Sources/PardesView.swift | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/src/macos/Sources/PardesView.swift b/src/macos/Sources/PardesView.swift index 5c5bc8ba..bfc8a060 100644 --- a/src/macos/Sources/PardesView.swift +++ b/src/macos/Sources/PardesView.swift @@ -1730,11 +1730,25 @@ final class PardesView: NSView { override func rightMouseDown(with event: NSEvent) { beginClick(PARDES_MOUSE_RIGHT, event) } override func rightMouseDragged(with event: NSEvent) { continueClick(event) } override func rightMouseUp(with event: NSEvent) { endClick(event) } - // otherMouse covers button 2 and up. acme's vocabulary stops at three, so - // every one of them lands on middle rather than being invented into a fourth. - override func otherMouseDown(with event: NSEvent) { beginClick(PARDES_MOUSE_MIDDLE, event) } - override func otherMouseDragged(with event: NSEvent) { continueClick(event) } - override func otherMouseUp(with event: NSEvent) { endClick(event) } + // Thumb navigation has its own stream so it cannot replace a held + // selection button or inherit a resting trackpad's finger count. + override func otherMouseDown(with event: NSEvent) { + if event.buttonNumber == 2 { beginClick(PARDES_MOUSE_MIDDLE, event); return } + guard event.buttonNumber == 3 || event.buttonNumber == 4, + let at = cell(for: event) else { return } + press(event.buttonNumber == 3 ? PARDES_MOUSE_BACK : PARDES_MOUSE_FORWARD, + at: at, mods: pointerModifiers) + } + override func otherMouseDragged(with event: NSEvent) { + if event.buttonNumber == 2 { continueClick(event) } + } + override func otherMouseUp(with event: NSEvent) { + if event.buttonNumber == 2 { endClick(event); return } + guard event.buttonNumber == 3 || event.buttonNumber == 4, + let at = cell(for: event) else { return } + release(event.buttonNumber == 3 ? PARDES_MOUSE_BACK : PARDES_MOUSE_FORWARD, + at: at, mods: pointerModifiers) + } /// A deep press, which is a second gesture layered on the click already in /// flight. AppKit keeps sending stage-2 events while the finger stays down, |
