From 45dbd46da1ec9b5b61956227630a02c607059e8a Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Sun, 10 Sep 2017 22:58:43 -0700 Subject: [PATCH] Fix mouse cursor jumping on right click gesture where only the 2nd finger is lifted to complete the gesture --- Limelight/Input/StreamView.m | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/Limelight/Input/StreamView.m b/Limelight/Input/StreamView.m index bd4afa2..1011543 100644 --- a/Limelight/Input/StreamView.m +++ b/Limelight/Input/StreamView.m @@ -139,6 +139,20 @@ isDragging = false; LiSendMouseButtonEvent(BUTTON_ACTION_RELEASE, BUTTON_LEFT); } + + // We we're moving from 2+ touches to 1. Synchronize the current position + // of the active finger so we don't jump unexpectedly on the next touchesMoved + // callback when finger 1 switches on us. + if ([[event allTouches] count] - [touches count] == 1) { + NSMutableSet *activeSet = [[NSMutableSet alloc] initWithCapacity:[[event allTouches] count]]; + [activeSet unionSet:[event allTouches]]; + [activeSet minusSet:touches]; + touchLocation = [[activeSet anyObject] locationInView:self]; + + // Mark this touch as moved so we don't send a left mouse click if the user + // right clicks without moving their other finger. + touchMoved = true; + } } }