Revert "mac: Don't interpret single-touch scroll events as pan gestures"

This reverts commit 91db627a81.
pull/1232/head
Koen Schmeets 2022-02-12 13:24:06 +01:00 committed by Paul Kahler
parent c5ea9a44e1
commit b429141c28
1 changed files with 1 additions and 23 deletions

View File

@ -372,7 +372,6 @@ MenuBarRef GetOrCreateMainMenu(bool *unique) {
double rotationGestureCurrent; double rotationGestureCurrent;
Point2d trackpadPositionShift; Point2d trackpadPositionShift;
bool inTrackpadScrollGesture; bool inTrackpadScrollGesture;
int numTouches;
Platform::Window::Kind kind; Platform::Window::Kind kind;
} }
@ -398,8 +397,6 @@ MenuBarRef GetOrCreateMainMenu(bool *unique) {
editor.action = @selector(didEdit:); editor.action = @selector(didEdit:);
inTrackpadScrollGesture = false; inTrackpadScrollGesture = false;
numTouches = 0;
self.acceptsTouchEvents = YES;
kind = aKind; kind = aKind;
if(kind == Platform::Window::Kind::TOPLEVEL) { if(kind == Platform::Window::Kind::TOPLEVEL) {
NSGestureRecognizer *mag = [[NSMagnificationGestureRecognizer alloc] initWithTarget:self NSGestureRecognizer *mag = [[NSMagnificationGestureRecognizer alloc] initWithTarget:self
@ -576,9 +573,7 @@ MenuBarRef GetOrCreateMainMenu(bool *unique) {
using Platform::MouseEvent; using Platform::MouseEvent;
MouseEvent event = [self convertMouseEvent:nsEvent]; MouseEvent event = [self convertMouseEvent:nsEvent];
// Check for number of touches to exclude single-finger scrolling on Magic Mouse if(nsEvent.subtype == NSEventSubtypeTabletPoint && kind == Platform::Window::Kind::TOPLEVEL) {
bool isTrackpadEvent = numTouches >= 2 && nsEvent.subtype == NSEventSubtypeTabletPoint;
if(isTrackpadEvent && kind == Platform::Window::Kind::TOPLEVEL) {
// This is how Cocoa represents 2 finger trackpad drag gestures, rather than going via // 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 // 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 // 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); 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 { - (void)mouseExited:(NSEvent *)nsEvent {
using Platform::MouseEvent; using Platform::MouseEvent;