Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 1 addition & 23 deletions src/platform/guimac.mm
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,6 @@ @implementation SSView
double rotationGestureCurrent;
Point2d trackpadPositionShift;
bool inTrackpadScrollGesture;
int numTouches;
Platform::Window::Kind kind;
}

Expand All @@ -398,8 +397,6 @@ - (id)initWithKind:(Platform::Window::Kind)aKind {
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
Expand Down Expand Up @@ -576,9 +573,7 @@ - (void)scrollWheel:(NSEvent *)nsEvent {
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
Expand Down Expand Up @@ -631,23 +626,6 @@ - (void)scrollWheel:(NSEvent *)nsEvent {
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;

Expand Down