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

This commit is contained in:
Cameron Gutman committed 2020-09-16 18:36:49 -07:00
1 parent 452b001c99
commit 4c68a5d8c3
1 file changed
+17 -1
+17 -1
View File
@@ -76,7 +76,11 @@ static const int REFERENCE_HEIGHT = 720;
[onScreenControls setLevel:level]; [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]]; [self addInteraction:[[UIPointerInteraction alloc] initWithDelegate:self]];
UIPanGestureRecognizer *mouseWheelRecognizer = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(mouseWheelMoved:)]; UIPanGestureRecognizer *mouseWheelRecognizer = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(mouseWheelMoved:)];
@@ -179,6 +183,11 @@ static const int REFERENCE_HEIGHT = 720;
if (@available(iOS 13.4, *)) { if (@available(iOS 13.4, *)) {
UITouch* touch = [touches anyObject]; UITouch* touch = [touches anyObject];
if (touch.type == UITouchTypeIndirectPointer) { 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; UIEventButtonMask changedButtons = lastMouseButtonMask ^ event.buttonMask;
for (int i = BUTTON_LEFT; i <= BUTTON_X2; i++) { for (int i = BUTTON_LEFT; i <= BUTTON_X2; i++) {
@@ -207,6 +216,7 @@ static const int REFERENCE_HEIGHT = 720;
return YES; return YES;
} }
} }
}
#endif #endif
return NO; return NO;
@@ -217,6 +227,11 @@ static const int REFERENCE_HEIGHT = 720;
if (@available(iOS 13.4, *)) { if (@available(iOS 13.4, *)) {
UITouch *touch = [touches anyObject]; UITouch *touch = [touches anyObject];
if (touch.type == UITouchTypeIndirectPointer) { 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 // We must handle this event to properly support
// drags while the middle, X1, or X2 mouse buttons are // drags while the middle, X1, or X2 mouse buttons are
// held down. For some reason, left and right buttons // held down. For some reason, left and right buttons
@@ -227,6 +242,7 @@ static const int REFERENCE_HEIGHT = 720;
return; return;
} }
} }
}
#endif #endif
hasUserInteracted = YES; hasUserInteracted = YES;