From 3442df0ca4ed3c214315b4977cbec0765c65229b Mon Sep 17 00:00:00 2001 From: True Zhuanjia Date: Sun, 16 Jun 2024 22:15:58 +0800 Subject: [PATCH] remove deprecated codes in StreamView.m --- Limelight/Input/NativeTouchHandler.m | 25 +++++----- Limelight/Input/StreamView.m | 69 ---------------------------- 2 files changed, 12 insertions(+), 82 deletions(-) diff --git a/Limelight/Input/NativeTouchHandler.m b/Limelight/Input/NativeTouchHandler.m index 78f7072f..e930ab3a 100644 --- a/Limelight/Input/NativeTouchHandler.m +++ b/Limelight/Input/NativeTouchHandler.m @@ -58,8 +58,7 @@ - (void)handleUITouch:(UITouch*)event index:(int)index{ uint8_t type; - //BOOL pointerVelocityScaleEnabled = (settings.pointerVelocityModeDivider.floatValue != 1.0); // when the divider is 1.0, means 0% of screen shall pass velocity-scaled pointer to sunshine. - // NSLog(@"handleUITouch %ld,%d",(long)event.phase,(uint32_t)event); +// NSLog(@"handleUITouch %ld,%d",(long)event.phase,(uint32_t)event); //#define LI_TOUCH_EVENT_HOVER 0x00 //#define LI_TOUCH_EVENT_DOWN 0x01 //#define LI_TOUCH_EVENT_UP 0x02 @@ -80,30 +79,30 @@ // UITouchPhaseRegionExited API_AVAILABLE(ios(13.4), tvos(13.4)) switch (event.phase) { - case UITouchPhaseBegan://开始触摸 + case UITouchPhaseBegan://touchBegan type = LI_TOUCH_EVENT_DOWN; - [NativeTouchPointer populatePointerId:event]; //获取并记录pointerId + [NativeTouchPointer populatePointerId:event]; //generate & populate pointerId if(currentSettings.pointerVelocityModeDivider.floatValue != 1.0) [NativeTouchPointer populatePointerObjIntoDict:event]; break; - case UITouchPhaseMoved://移动 + case UITouchPhaseMoved://touchMoved case UITouchPhaseStationary: type = LI_TOUCH_EVENT_MOVE; if(currentSettings.pointerVelocityModeDivider.floatValue != 1.0) [NativeTouchPointer updatePointerObjInDict:event]; break; - case UITouchPhaseEnded://触摸结束 + case UITouchPhaseEnded://touchEnded type = LI_TOUCH_EVENT_UP; - [self sendTouchEvent:event touchType:type]; //先发送,再删除 - [NativeTouchPointer removePointerId:event]; //删除pointerId + [self sendTouchEvent:event touchType:type]; //send touch event first + [NativeTouchPointer removePointerId:event]; //then remove pointerId if(currentSettings.pointerVelocityModeDivider.floatValue != 1.0) [NativeTouchPointer removePointerObjFromDict:event]; return; - case UITouchPhaseCancelled://触摸取消 + case UITouchPhaseCancelled://touchCancelled type = LI_TOUCH_EVENT_CANCEL; - [self sendTouchEvent:event touchType:type]; //先发送,再删除 - [NativeTouchPointer removePointerId:event]; //删除pointerId + [self sendTouchEvent:event touchType:type]; //send touch event first + [NativeTouchPointer removePointerId:event]; //then remove pointerId if(currentSettings.pointerVelocityModeDivider.floatValue != 1.0) [NativeTouchPointer removePointerObjFromDict:event]; return; - case UITouchPhaseRegionEntered://停留 - case UITouchPhaseRegionMoved://停留 + case UITouchPhaseRegionEntered: + case UITouchPhaseRegionMoved: type = LI_TOUCH_EVENT_HOVER; break; default: diff --git a/Limelight/Input/StreamView.m b/Limelight/Input/StreamView.m index b244d84e..41113a14 100644 --- a/Limelight/Input/StreamView.m +++ b/Limelight/Input/StreamView.m @@ -336,75 +336,6 @@ static const double X1_MOUSE_SPEED_DIVISOR = 2.5; return 90 - MIN(90, altitudeDegs); } - -- (void)sendTouchEvent:(UITouch*)event touchType:(uint8_t)touchType{ - CGPoint targetCoords; - if(settings.pointerVelocityModeDivider.floatValue != 1.0 && event.phase == UITouchPhaseMoved) targetCoords = [NativeTouchPointer selectCoordsFor:event]; // coordinates of touch pointer replaced to relative ones here. - else targetCoords = [event locationInView:self]; - CGPoint location = [self adjustCoordinatesForVideoArea:targetCoords]; - CGSize videoSize = [self getVideoAreaSize]; - LiSendTouchEvent(touchType,[NativeTouchPointer retrievePointerIdFromDict:event],location.x / videoSize.width, location.y / videoSize.height,(event.force / event.maximumPossibleForce) / sin(event.altitudeAngle),0.0f, 0.0f,[self getRotationFromAzimuthAngle:[event azimuthAngleInView:self]]); -} - - -- (void)handleUITouch:(UITouch*)event index:(int)index{ - uint8_t type; - //BOOL pointerVelocityScaleEnabled = (settings.pointerVelocityModeDivider.floatValue != 1.0); // when the divider is 1.0, means 0% of screen shall pass velocity-scaled pointer to sunshine. - // NSLog(@"handleUITouch %ld,%d",(long)event.phase,(uint32_t)event); -//#define LI_TOUCH_EVENT_HOVER 0x00 -//#define LI_TOUCH_EVENT_DOWN 0x01 -//#define LI_TOUCH_EVENT_UP 0x02 -//#define LI_TOUCH_EVENT_MOVE 0x03 -//#define LI_TOUCH_EVENT_CANCEL 0x04 -//#define LI_TOUCH_EVENT_BUTTON_ONLY 0x05 -//#define LI_TOUCH_EVENT_HOVER_LEAVE 0x06 -//#define LI_TOUCH_EVENT_CANCEL_ALL 0x07 -//#define LI_ROT_UNKNOWN 0xFFFF - -// UITouchPhaseBegan, // whenever a finger touches the surface. -// UITouchPhaseMoved, // whenever a finger moves on the surface. -// UITouchPhaseStationary, // whenever a finger is touching the surface but hasn't moved since the previous event. -// UITouchPhaseEnded, // whenever a finger leaves the surface. -// UITouchPhaseCancelled, // whenever a touch doesn't end but we need to stop tracking (e.g. putting device to face) -// UITouchPhaseRegionEntered API_AVAILABLE(ios(13.4), tvos(13.4)) API_UNAVAILABLE(watchos), // whenever a touch is entering the region of a user interface -// UITouchPhaseRegionMoved API_AVAILABLE(ios(13.4), tvos(13.4)) API_UNAVAILABLE(watchos), // when a touch is inside the region of a user interface, but hasn’t yet made contact or left the region -// UITouchPhaseRegionExited API_AVAILABLE(ios(13.4), tvos(13.4)) - - switch (event.phase) { - case UITouchPhaseBegan://开始触摸 - type = LI_TOUCH_EVENT_DOWN; - [NativeTouchPointer populatePointerId:event]; //获取并记录pointerId - if(settings.pointerVelocityModeDivider.floatValue != 1.0) [NativeTouchPointer populatePointerObjIntoDict:event]; - break; - case UITouchPhaseMoved://移动 - case UITouchPhaseStationary: - type = LI_TOUCH_EVENT_MOVE; - if(settings.pointerVelocityModeDivider.floatValue != 1.0) [NativeTouchPointer updatePointerObjInDict:event]; - break; - case UITouchPhaseEnded://触摸结束 - type = LI_TOUCH_EVENT_UP; - [self sendTouchEvent:event touchType:type]; //先发送,再删除 - [NativeTouchPointer removePointerId:event]; //删除pointerId - if(settings.pointerVelocityModeDivider.floatValue != 1.0) [NativeTouchPointer removePointerObjFromDict:event]; - return; - case UITouchPhaseCancelled://触摸取消 - type = LI_TOUCH_EVENT_CANCEL; - [self sendTouchEvent:event touchType:type]; //先发送,再删除 - [NativeTouchPointer removePointerId:event]; //删除pointerId - if(settings.pointerVelocityModeDivider.floatValue != 1.0) [NativeTouchPointer removePointerObjFromDict:event]; - return; - case UITouchPhaseRegionEntered://停留 - case UITouchPhaseRegionMoved://停留 - type = LI_TOUCH_EVENT_HOVER; - break; - default: - return; - } - [self sendTouchEvent:event touchType:type]; -} - - - - (BOOL)sendStylusEvent:(UITouch*)event { uint8_t type;