diff --git a/Limelight/Input/RelativeTouchHandler.m b/Limelight/Input/RelativeTouchHandler.m index 3438a18..64d7da4 100644 --- a/Limelight/Input/RelativeTouchHandler.m +++ b/Limelight/Input/RelativeTouchHandler.m @@ -18,6 +18,7 @@ static const int REFERENCE_HEIGHT = 720; BOOL touchMoved; BOOL isDragging; NSTimer* dragTimer; + NSUInteger peakTouchCount; #if TARGET_OS_TV UIGestureRecognizer* remotePressRecognizer; @@ -59,6 +60,7 @@ static const int REFERENCE_HEIGHT = 720; - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { touchMoved = false; + peakTouchCount = [[event allTouches] count]; if ([[event allTouches] count] == 1) { UITouch *touch = [[event allTouches] anyObject]; originalLocation = touchLocation = [touch locationInView:view]; @@ -126,7 +128,7 @@ static const int REFERENCE_HEIGHT = 720; isDragging = false; LiSendMouseButtonEvent(BUTTON_ACTION_RELEASE, BUTTON_LEFT); } else if (!touchMoved) { - if ([[event allTouches] count] == 2) { + if (peakTouchCount == 2) { dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0), ^{ Log(LOG_D, @"Sending right mouse button press"); @@ -137,7 +139,7 @@ static const int REFERENCE_HEIGHT = 720; LiSendMouseButtonEvent(BUTTON_ACTION_RELEASE, BUTTON_RIGHT); }); - } else if ([[event allTouches] count] == 1) { + } else if (peakTouchCount == 1) { dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0), ^{ if (!self->isDragging){ Log(LOG_D, @"Sending left mouse button press"); @@ -175,6 +177,7 @@ static const int REFERENCE_HEIGHT = 720; isDragging = false; LiSendMouseButtonEvent(BUTTON_ACTION_RELEASE, BUTTON_LEFT); } + peakTouchCount = 0; } #if TARGET_OS_TV diff --git a/Limelight/Input/StreamView.m b/Limelight/Input/StreamView.m index a85d230..0ee9779 100644 --- a/Limelight/Input/StreamView.m +++ b/Limelight/Input/StreamView.m @@ -179,6 +179,13 @@ static const double X1_MOUSE_SPEED_DIVISOR = 2.5; [self startInteractionTimer]; if (![onScreenControls handleTouchDownEvent:touches]) { + // We still inform the touch handler even if we're going trigger the + // keyboard activation gesture. This is important to ensure the touch + // handler has a consistent view of touch events to correctly suppress + // activation of one or two finger gestures when a three finger gesture + // is triggered. + [touchHandler touchesBegan:touches withEvent:event]; + if ([[event allTouches] count] == 3) { if (isInputingText) { Log(LOG_D, @"Closing the keyboard"); @@ -198,9 +205,6 @@ static const double X1_MOUSE_SPEED_DIVISOR = 2.5; isInputingText = true; } } - else { - [touchHandler touchesBegan:touches withEvent:event]; - } } }