diff --git a/Limelight/Input/CustomTapGestureRecognizer.h b/Limelight/Input/CustomTapGestureRecognizer.h index cc1aaf7a..64578379 100644 --- a/Limelight/Input/CustomTapGestureRecognizer.h +++ b/Limelight/Input/CustomTapGestureRecognizer.h @@ -10,14 +10,13 @@ #define CustomTapGestureRecognizer_h - @interface CustomTapGestureRecognizer : UIGestureRecognizer{ CGFloat lowestTouchPointYCoord; } @property (nonatomic, assign) uint8_t numberOfTouchesRequired; -@property (nonatomic, assign) bool immediateTriggering; // trigger the signal on touchesBegan stage if enabled. +@property (nonatomic, assign) bool immediateTriggering; // if enabled, trigger the signal on touchesBegan stage. @property (nonatomic, assign) double tapDownTimeThreshold; // tap down threshold in seconds. @property (nonatomic, readonly) CGFloat lowestTouchPointHeight; @property (nonatomic, readonly) bool gestureCaptured; diff --git a/Limelight/Input/CustomTapGestureRecognizer.m b/Limelight/Input/CustomTapGestureRecognizer.m index 846e7a50..5f03eaea 100644 --- a/Limelight/Input/CustomTapGestureRecognizer.m +++ b/Limelight/Input/CustomTapGestureRecognizer.m @@ -11,9 +11,12 @@ #import "CustomTapGestureRecognizer.h" // The most accurate & reliable tap gesture recognizer of iOS: -// - almost 100% recoginition rate. UITapGestureRecognizer of Apple API is just intractable. -// - instances of different numberOfTouchesRequired barely compete with each other, even when immediateTriggering is set to false. -// - set property immediateTriggering = true, ensures no competition with gestures of less fingers in non-native touch mode. +// - Almost 100% recoginition rate. UITapGestureRecognizer of Apple API fails frequently, just intractable. +// - When immediateTriggering is set to false (for native multi-touch): +// Gesture signal will be triggered on touchesEnded stage, multi finger touch operations will not be interrupted by the arising keyboard. +// Instances of different [numberOfTouchesRequired] barely compete with each other, for example, the chance of 3-finger gesture get triggered by 4 or 5 finger tap is very small. +// - Set property immediateTriggering to true, to ensure the priority of keyboard toggle in non-native touch mode, in compete with 2-finger gestures. +// - This recognizer also provides properties like gestureCapturedTime, to be accessed outside the class for useful purpose. @implementation CustomTapGestureRecognizer diff --git a/Limelight/Input/NativeTouchHandler.m b/Limelight/Input/NativeTouchHandler.m index 5df2044f..1083f934 100644 --- a/Limelight/Input/NativeTouchHandler.m +++ b/Limelight/Input/NativeTouchHandler.m @@ -19,7 +19,7 @@ @implementation NativeTouchHandler { StreamView* streamView; TemporarySettings* currentSettings; - BOOL activateCoordSelector; + bool activateCoordSelector; } diff --git a/Limelight/Input/RelativeTouchHandler.m b/Limelight/Input/RelativeTouchHandler.m index c32ffe29..da3bac46 100644 --- a/Limelight/Input/RelativeTouchHandler.m +++ b/Limelight/Input/RelativeTouchHandler.m @@ -10,7 +10,7 @@ #import "CustomTapGestureRecognizer.h" #include -#define RIGHTCLICK_TAP_DOWN_TIME_THRESHOLD_S 0.2 +#define RIGHTCLICK_TAP_DOWN_TIME_THRESHOLD_S 0.15 static const int REFERENCE_WIDTH = 1280; @@ -132,7 +132,7 @@ static const int REFERENCE_HEIGHT = 720; CGPoint secondLocation = [[[[event allTouches] allObjects] objectAtIndex:1] locationInView:view]; CGPoint avgLocation = CGPointMake((firstLocation.x + secondLocation.x) / 2, (firstLocation.y + secondLocation.y) / 2); - if ((CACurrentMediaTime() - rightClickTapRecognizer.gestureCapturedTime > RIGHTCLICK_TAP_DOWN_TIME_THRESHOLD_S) && touchLocation.y != avgLocation.y) { //prevent sending scrollevent while right click gesture is being recognized. The time threshold is only 100ms, resulting in a barely noticeable delay before the scroll event is activated. + if ((CACurrentMediaTime() - rightClickTapRecognizer.gestureCapturedTime > RIGHTCLICK_TAP_DOWN_TIME_THRESHOLD_S) && touchLocation.y != avgLocation.y) { //prevent sending scrollevent while right click gesture is being recognized. The time threshold is only 150ms, resulting in a barely noticeable delay before the scroll event is activated. LiSendHighResScrollEvent((avgLocation.y - touchLocation.y) * 10); }