diff options
Diffstat (limited to 'src/macos')
| -rw-r--r-- | src/macos/Sources/PardesView.swift | 24 | ||||
| -rw-r--r-- | src/macos/pardes.h | 2 |
2 files changed, 21 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, diff --git a/src/macos/pardes.h b/src/macos/pardes.h index 845c8096..546273d9 100644 --- a/src/macos/pardes.h +++ b/src/macos/pardes.h @@ -167,6 +167,8 @@ typedef enum { PARDES_MOUSE_WHEEL_LEFT = 5, PARDES_MOUSE_WHEEL_RIGHT = 6, PARDES_MOUSE_NONE = 7, + PARDES_MOUSE_BACK = 8, + PARDES_MOUSE_FORWARD = 9, } pardes_mouse_button_e; typedef enum { |
