From b429141c2899900585d3722e2fc9a518362e909b Mon Sep 17 00:00:00 2001 From: Koen Schmeets Date: Sat, 12 Feb 2022 13:24:06 +0100 Subject: [PATCH] Revert "mac: Don't interpret single-touch scroll events as pan gestures" This reverts commit 91db627a81a1438ca4e02f0b27c6f17ceac1051c. --- src/platform/guimac.mm | 24 +----------------------- 1 file changed, 1 insertion(+), 23 deletions(-) diff --git a/src/platform/guimac.mm b/src/platform/guimac.mm index 91a197d3..67d1eb97 100644 --- a/src/platform/guimac.mm +++ b/src/platform/guimac.mm @@ -372,7 +372,6 @@ MenuBarRef GetOrCreateMainMenu(bool *unique) { double rotationGestureCurrent; Point2d trackpadPositionShift; bool inTrackpadScrollGesture; - int numTouches; Platform::Window::Kind kind; } @@ -398,8 +397,6 @@ MenuBarRef GetOrCreateMainMenu(bool *unique) { editor.action = @selector(didEdit:); inTrackpadScrollGesture = false; - numTouches = 0; - self.acceptsTouchEvents = YES; kind = aKind; if(kind == Platform::Window::Kind::TOPLEVEL) { NSGestureRecognizer *mag = [[NSMagnificationGestureRecognizer alloc] initWithTarget:self @@ -576,9 +573,7 @@ MenuBarRef GetOrCreateMainMenu(bool *unique) { using Platform::MouseEvent; MouseEvent event = [self convertMouseEvent:nsEvent]; - // Check for number of touches to exclude single-finger scrolling on Magic Mouse - bool isTrackpadEvent = numTouches >= 2 && nsEvent.subtype == NSEventSubtypeTabletPoint; - if(isTrackpadEvent && kind == Platform::Window::Kind::TOPLEVEL) { + if(nsEvent.subtype == NSEventSubtypeTabletPoint && kind == Platform::Window::Kind::TOPLEVEL) { // This is how Cocoa represents 2 finger trackpad drag gestures, rather than going via // NSPanGestureRecognizer which is how you might expect this to work... We complicate this // further by also handling shift-two-finger-drag to mean rotate. Fortunately we're using @@ -631,23 +626,6 @@ MenuBarRef GetOrCreateMainMenu(bool *unique) { receiver->onMouseEvent(event); } -- (void)touchesBeganWithEvent:(NSEvent *)event { - numTouches = [event touchesMatchingPhase:NSTouchPhaseTouching inView:self].count; - [super touchesBeganWithEvent:event]; -} -- (void)touchesMovedWithEvent:(NSEvent *)event { - numTouches = [event touchesMatchingPhase:NSTouchPhaseTouching inView:self].count; - [super touchesMovedWithEvent:event]; -} -- (void)touchesEndedWithEvent:(NSEvent *)event { - numTouches = [event touchesMatchingPhase:NSTouchPhaseTouching inView:self].count; - [super touchesEndedWithEvent:event]; -} -- (void)touchesCancelledWithEvent:(NSEvent *)event { - numTouches = 0; - [super touchesCancelledWithEvent:event]; -} - - (void)mouseExited:(NSEvent *)nsEvent { using Platform::MouseEvent;