Disable iOS 13.4+ mouse support on iOS 14 in preparation for GCMouse work

This commit is contained in:
Cameron Gutman 2020-09-16 18:36:49 -07:00
parent 452b001c99
commit 4c68a5d8c3

View File

@ -76,7 +76,11 @@ static const int REFERENCE_HEIGHT = 720;
[onScreenControls setLevel:level];
}
if (@available(iOS 13.4, *)) {
if (@available(iOS 14.0, *)) {
// Use the new GCMouse API on iOS 14
}
else if (@available(iOS 13.4, *)) {
// Use the legacy mouse API on iOS 13.4
[self addInteraction:[[UIPointerInteraction alloc] initWithDelegate:self]];
UIPanGestureRecognizer *mouseWheelRecognizer = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(mouseWheelMoved:)];
@ -179,6 +183,11 @@ static const int REFERENCE_HEIGHT = 720;
if (@available(iOS 13.4, *)) {
UITouch* touch = [touches anyObject];
if (touch.type == UITouchTypeIndirectPointer) {
if (@available(iOS 14.0, *)) {
// We'll handle this with GCMouse. Do nothing here.
return YES;
}
else {
UIEventButtonMask changedButtons = lastMouseButtonMask ^ event.buttonMask;
for (int i = BUTTON_LEFT; i <= BUTTON_X2; i++) {
@ -207,6 +216,7 @@ static const int REFERENCE_HEIGHT = 720;
return YES;
}
}
}
#endif
return NO;
@ -217,6 +227,11 @@ static const int REFERENCE_HEIGHT = 720;
if (@available(iOS 13.4, *)) {
UITouch *touch = [touches anyObject];
if (touch.type == UITouchTypeIndirectPointer) {
if (@available(iOS 14.0, *)) {
// We'll handle this with GCMouse. Do nothing here.
return;
}
else {
// We must handle this event to properly support
// drags while the middle, X1, or X2 mouse buttons are
// held down. For some reason, left and right buttons
@ -227,6 +242,7 @@ static const int REFERENCE_HEIGHT = 720;
return;
}
}
}
#endif
hasUserInteracted = YES;