From 5e40c9f9adadabfd3898aba0df0b8e11bb741e3e Mon Sep 17 00:00:00 2001 From: TrueZhuanjia Date: Wed, 16 Jul 2025 13:55:19 +0800 Subject: [PATCH] tweak edge slide & touchHandler --- VoidLink/Input/AbsoluteTouchHandler.m | 2 +- VoidLink/Input/NativeTouchHandler.m | 7 ++++--- VoidLink/Input/PureNativeTouchHandler.m | 8 ++++---- VoidLink/Input/RelativeTouchHandler.m | 5 +++-- .../ViewControllers/CustomEdgeSlideGestureRecognizer.m | 2 +- 5 files changed, 13 insertions(+), 11 deletions(-) diff --git a/VoidLink/Input/AbsoluteTouchHandler.m b/VoidLink/Input/AbsoluteTouchHandler.m index 8b15aa05..2875bf55 100644 --- a/VoidLink/Input/AbsoluteTouchHandler.m +++ b/VoidLink/Input/AbsoluteTouchHandler.m @@ -47,7 +47,7 @@ self->streamView = view; // upper screen check - EDGE_TOLERANCE = 15.0; + EDGE_TOLERANCE = 10.0; slideGestureVerticalThreshold = CGRectGetHeight([[UIScreen mainScreen] bounds]) * 0.4; screenWidthWithThreshold = CGRectGetWidth([[UIScreen mainScreen] bounds]) - EDGE_TOLERANCE; self->touchPointSpawnedAtUpperScreenEdge = false; diff --git a/VoidLink/Input/NativeTouchHandler.m b/VoidLink/Input/NativeTouchHandler.m index 83b773f7..87833bfb 100644 --- a/VoidLink/Input/NativeTouchHandler.m +++ b/VoidLink/Input/NativeTouchHandler.m @@ -86,7 +86,7 @@ self->pointerObjDict = [NSMutableDictionary dictionary]; - EDGE_TOLERANCE = 15.0; + EDGE_TOLERANCE = 10.0; slideGestureVerticalThreshold = CGRectGetHeight([[UIScreen mainScreen] bounds]) * 0.4; screenWidthWithThreshold = CGRectGetWidth([[UIScreen mainScreen] bounds]) - EDGE_TOLERANCE; @@ -190,7 +190,7 @@ - (void)sendTouchEvent:(UITouch*)touch withTouchtype:(uint8_t)touchType{ - if(touchPointSpawnedAtUpperScreenEdge) return; // we're done here. this touch event will not be sent to the remote PC. and this must be checked after coord selector finishes populating new relative coords, or the app will crash! + if(touchPointSpawnedAtUpperScreenEdge && touchType != LI_TOUCH_EVENT_UP) return; // we're done here. this touch event will not be sent to the remote PC. and this must be checked after coord selector finishes populating new relative coords, or the app will crash CGPoint targetCoords; //NSLog(@"selecting coords: %d", touch.phase == UITouchPhaseMoved); @@ -264,7 +264,8 @@ [self removePointerId:touch]; //then remove pointerId if(self->activateCoordSelector) [self removePointerObjFromDict:touch]; } - if(self->touchPointSpawnedAtUpperScreenEdge && [[event allTouches] count] == [touches count]) self->touchPointSpawnedAtUpperScreenEdge = false; //bugbugbugbugbugbugbugbug + //if(self->touchPointSpawnedAtUpperScreenEdge && [[event allTouches] count] == [touches count]) + self->touchPointSpawnedAtUpperScreenEdge = false; }); else{ for (UITouch* touch in touches){ diff --git a/VoidLink/Input/PureNativeTouchHandler.m b/VoidLink/Input/PureNativeTouchHandler.m index fcda021c..cc34d5eb 100644 --- a/VoidLink/Input/PureNativeTouchHandler.m +++ b/VoidLink/Input/PureNativeTouchHandler.m @@ -85,7 +85,7 @@ self->pointerObjDict = [NSMutableDictionary dictionary]; - EDGE_TOLERANCE = 15.0; + EDGE_TOLERANCE = 10.0; slideGestureVerticalThreshold = CGRectGetHeight([[UIScreen mainScreen] bounds]) * 0.4; screenWidthWithThreshold = CGRectGetWidth([[UIScreen mainScreen] bounds]) - EDGE_TOLERANCE; @@ -189,8 +189,8 @@ - (void)sendTouchEvent:(UITouch*)touch withTouchtype:(uint8_t)touchType{ - if(touchPointSpawnedAtUpperScreenEdge) return; // we're done here. this touch event will not be sent to the remote PC. and this must be checked after coord selector finishes populating new relative coords, or the app will crash! - + if(touchPointSpawnedAtUpperScreenEdge && touchType != LI_TOUCH_EVENT_UP) return; // we're done here. this touch event will not be sent to the remote PC. and this must be checked after coord selector finishes populating new relative coords, or the app will crash + CGPoint targetCoords; //NSLog(@"selecting coords: %d", touch.phase == UITouchPhaseMoved); // NSLog(@"excluded count: %d", (uint32_t)[excludedPointerIds count]); @@ -253,7 +253,7 @@ [self removePointerId:touch]; //then remove pointerId if(self->activateCoordSelector) [self removePointerObjFromDict:touch]; } - if(self->touchPointSpawnedAtUpperScreenEdge && [[event allTouches] count] == [touches count]) self->touchPointSpawnedAtUpperScreenEdge = false; + self->touchPointSpawnedAtUpperScreenEdge = false; }); else{ for (UITouch* touch in touches){ diff --git a/VoidLink/Input/RelativeTouchHandler.m b/VoidLink/Input/RelativeTouchHandler.m index f8cde591..0f67455d 100644 --- a/VoidLink/Input/RelativeTouchHandler.m +++ b/VoidLink/Input/RelativeTouchHandler.m @@ -63,7 +63,7 @@ static const float QUICK_TAP_TIME_INTERVAL = 0.2; mousePointerTimestamp = 0; // upper screen check - EDGE_TOLERANCE = 15.0; + EDGE_TOLERANCE = 10.0; slideGestureVerticalThreshold = CGRectGetHeight([[UIScreen mainScreen] bounds]) * 0.4; screenWidthWithThreshold = CGRectGetWidth([[UIScreen mainScreen] bounds]) - EDGE_TOLERANCE; self->touchPointSpawnedAtUpperScreenEdge = false; @@ -238,8 +238,9 @@ static const float QUICK_TAP_TIME_INTERVAL = 0.2; touchLockedForMouseMove = nil; mousePointerMoved = false; // need to reset this anyway [self resetAllPressedFlagsForOnScreenWidgetViews]; // reset all pressed flag for on-screen widget views after all fingers lifted from screen. - touchPointSpawnedAtUpperScreenEdge = false; } + + touchPointSpawnedAtUpperScreenEdge = false; } diff --git a/VoidLink/ViewControllers/CustomEdgeSlideGestureRecognizer.m b/VoidLink/ViewControllers/CustomEdgeSlideGestureRecognizer.m index 5224a0ea..858c0486 100644 --- a/VoidLink/ViewControllers/CustomEdgeSlideGestureRecognizer.m +++ b/VoidLink/ViewControllers/CustomEdgeSlideGestureRecognizer.m @@ -20,7 +20,7 @@ static CGFloat screenWidthInPoints; self = [super initWithTarget:target action:action]; screenWidthInPoints = CGRectGetWidth([UIApplication.sharedApplication.windows.firstObject.screen bounds]); // Get the screen's bounds (in points) _immediateTriggering = false; - _EDGE_TOLERANCE = 15.0f; + _EDGE_TOLERANCE = 10.0f; return self; }