cancel some restrictions for iOS 13.3 & lower

This commit is contained in:
True Zhuanjia committed 2024-08-09 11:40:41 +08:00
1 parent 9f9df09c61
commit b21b93ff71
2 files changed
+19 -16

No files matched your search

+3
View File
@@ -354,6 +354,9 @@ static const double MOUSE_SPEED_DIVISOR = 1.25;
rightStickY = MAX_MAGNITUDE(rightStickY, controller.mergedWithController.lastRightStickY); rightStickY = MAX_MAGNITUDE(rightStickY, controller.mergedWithController.lastRightStickY);
} }
// Player 1 is always present for OSC // Player 1 is always present for OSC
LiSendMultiControllerEvent(_multiController ? controller.playerIndex : 0, [self getActiveGamepadMask], LiSendMultiControllerEvent(_multiController ? controller.playerIndex : 0, [self getActiveGamepadMask],
buttonFlags, leftTrigger, rightTrigger, buttonFlags, leftTrigger, rightTrigger,
+16 -16
View File
@@ -463,19 +463,20 @@ static const double X1_MOUSE_SPEED_DIVISOR = 2.5;
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
#if !TARGET_OS_TV #if !TARGET_OS_TV
if (@available(iOS 13.4, *)) { // if (@available(iOS 13.4, *)) {
// cancel restriction of native touch for iOS13.3 & lower
if (settings.touchMode.intValue == PURE_NATIVE_TOUCH) { if (settings.touchMode.intValue == PURE_NATIVE_TOUCH) {
[touchHandler touchesBegan:touches withEvent:event]; [touchHandler touchesBegan:touches withEvent:event];
return; //This is a native touch oriented fork, in pure native touch mode, this call back method deals with native touch only. return; //This is a native touch oriented fork, in pure native touch mode, this call back method deals with native touch only.
} }
else{ if (@available(iOS 13.4, *)) { // now only pencil events are restricted
for (UITouch* touch in touches) { for (UITouch* touch in touches) {
if (touch.type == UITouchTypePencil) { if (touch.type == UITouchTypePencil) {
if ([self sendStylusEvent:touch]) return; if ([self sendStylusEvent:touch]) return;
} }
} }
} }
}
#endif #endif
if ([self handleMouseButtonEvent:BUTTON_ACTION_PRESS if ([self handleMouseButtonEvent:BUTTON_ACTION_PRESS
forTouches:touches forTouches:touches
@@ -622,18 +623,19 @@ static const double X1_MOUSE_SPEED_DIVISOR = 2.5;
- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event { - (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event {
#if !TARGET_OS_TV #if !TARGET_OS_TV
if (@available(iOS 13.4, *)) {
if (settings.touchMode.intValue == PURE_NATIVE_TOUCH) { if (settings.touchMode.intValue == PURE_NATIVE_TOUCH) {
[touchHandler touchesMoved:touches withEvent:event]; [touchHandler touchesMoved:touches withEvent:event];
return; //This is a native touch oriented fork, in pure native touch mode, this call back method deals with native touch only. return; //This is a native touch oriented fork, in pure native touch mode, this call back method deals with native touch only.
} }
else{
for (UITouch* touch in touches) { for (UITouch* touch in touches) {
if (touch.type == UITouchTypePencil) { if (touch.type == UITouchTypePencil) {
if ([self sendStylusEvent:touch]) return; if ([self sendStylusEvent:touch]) return;
} }
}
} 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, *)) { if (@available(iOS 14.0, *)) {
@@ -642,7 +644,6 @@ static const double X1_MOUSE_SPEED_DIVISOR = 2.5;
return; return;
} }
} }
// 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
@@ -653,14 +654,14 @@ static const double X1_MOUSE_SPEED_DIVISOR = 2.5;
return; return;
} }
} }
#endif #endif
hasUserInteracted = YES; hasUserInteracted = YES;
if (![onScreenControls handleTouchMovedEvent:touches]) { if (![onScreenControls handleTouchMovedEvent:touches]) {
[touchHandler touchesMoved:touches withEvent:event]; [touchHandler touchesMoved:touches withEvent:event];
} }
} }
}
- (void)pressesBegan:(NSSet<UIPress *> *)presses withEvent:(UIPressesEvent *)event { - (void)pressesBegan:(NSSet<UIPress *> *)presses withEvent:(UIPressesEvent *)event {
BOOL handled = NO; BOOL handled = NO;
@@ -702,19 +703,20 @@ static const double X1_MOUSE_SPEED_DIVISOR = 2.5;
- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event { - (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event {
#if !TARGET_OS_TV #if !TARGET_OS_TV
if (@available(iOS 13.4, *)) {
if (settings.touchMode.intValue == PURE_NATIVE_TOUCH) { if (settings.touchMode.intValue == PURE_NATIVE_TOUCH) {
[touchHandler touchesEnded:touches withEvent:event]; [touchHandler touchesEnded:touches withEvent:event];
return; //This is a native touch oriented fork, in pure native touch mode, this call back method deals with native touch only. return; //This is a native touch oriented fork, in pure native touch mode, this call back method deals with native touch only.
} }
else{
if (@available(iOS 13.4, *)){ //now only pencil events are restricted
for (UITouch* touch in touches) { for (UITouch* touch in touches) {
if (touch.type == UITouchTypePencil) { if (touch.type == UITouchTypePencil) {
if ([self sendStylusEvent:touch]) return; if ([self sendStylusEvent:touch]) return;
} }
} }
} }
}
#endif #endif
if ([self handleMouseButtonEvent:BUTTON_ACTION_RELEASE if ([self handleMouseButtonEvent:BUTTON_ACTION_RELEASE
forTouches:touches forTouches:touches
@@ -735,16 +737,14 @@ static const double X1_MOUSE_SPEED_DIVISOR = 2.5;
- (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event { - (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event {
[touchHandler touchesCancelled:touches withEvent:event]; [touchHandler touchesCancelled:touches withEvent:event];
#if !TARGET_OS_TV #if !TARGET_OS_TV
if (@available(iOS 13.4, *)) {
if (settings.touchMode.intValue == PURE_NATIVE_TOUCH) return; //This is a native touch oriented fork, in pure native touch mode, this call back method deals with native touch only. if (settings.touchMode.intValue == PURE_NATIVE_TOUCH) return; //This is a native touch oriented fork, in pure native touch mode, this call back method deals with native touch only.
else{ if (@available(iOS 13.4, *)){ //now only pencil events are restricted
for (UITouch* touch in touches) { for (UITouch* touch in touches) {
if (touch.type == UITouchTypePencil) { if (touch.type == UITouchTypePencil) {
if ([self sendStylusEvent:touch]) return; if ([self sendStylusEvent:touch]) return;
} }
} }
} }
}
#endif #endif
[self handleMouseButtonEvent:BUTTON_ACTION_RELEASE [self handleMouseButtonEvent:BUTTON_ACTION_RELEASE
forTouches:touches forTouches:touches