From 7cf521272a174a73fc4c4b3e634acb69dcfabbc0 Mon Sep 17 00:00:00 2001 From: Diego Waxemberg Date: Thu, 8 Jan 2015 21:04:19 -0500 Subject: [PATCH] fixed multitouch issue with on-screen controls --- Limelight/Input/OnScreenControls.h | 6 +++--- Limelight/Input/OnScreenControls.m | 12 ++++++------ Limelight/Input/StreamView.m | 6 +++--- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/Limelight/Input/OnScreenControls.h b/Limelight/Input/OnScreenControls.h index 22f36734..1e01f61d 100644 --- a/Limelight/Input/OnScreenControls.h +++ b/Limelight/Input/OnScreenControls.h @@ -17,9 +17,9 @@ typedef NS_ENUM(NSInteger, OnScreenControlsLevel) { }; - (id) initWithView:(UIView*)view; -- (BOOL) handleTouchDownEvent:(UIEvent*)event; -- (BOOL) handleTouchUpEvent:(UIEvent*) event; -- (BOOL) handleTouchMovedEvent:(UIEvent*)event; +- (BOOL) handleTouchDownEvent:(NSSet*)touches; +- (BOOL) handleTouchUpEvent:(NSSet*)touches; +- (BOOL) handleTouchMovedEvent:(NSSet*)touches; - (void) setLevel:(OnScreenControlsLevel)level; @end diff --git a/Limelight/Input/OnScreenControls.m b/Limelight/Input/OnScreenControls.m index 2ab0359f..7594c3db 100644 --- a/Limelight/Input/OnScreenControls.m +++ b/Limelight/Input/OnScreenControls.m @@ -313,7 +313,7 @@ static float L2_Y; [_rightStick removeFromSuperlayer]; } -- (BOOL) handleTouchMovedEvent:(UIEvent*)event { +- (BOOL) handleTouchMovedEvent:touches { BOOL shouldSendPacket = false; BOOL buttonTouch = false; float rsMaxX = RS_CENTER_X + STICK_OUTER_SIZE / 2; @@ -325,7 +325,7 @@ static float L2_Y; float lsMinX = LS_CENTER_X - STICK_OUTER_SIZE / 2; float lsMinY = LS_CENTER_Y - STICK_OUTER_SIZE / 2; - for (UITouch* touch in [event allTouches]) { + for (UITouch* touch in touches) { CGPoint touchLocation = [touch locationInView:_view]; float xLoc = touchLocation.x; float yLoc = touchLocation.y; @@ -402,9 +402,9 @@ static float L2_Y; return shouldSendPacket || buttonTouch; } -- (BOOL)handleTouchDownEvent:(UIEvent*)event { +- (BOOL)handleTouchDownEvent:touches { BOOL shouldSendPacket = false; - for (UITouch* touch in [event allTouches]) { + for (UITouch* touch in touches) { CGPoint touchLocation = [touch locationInView:_view]; if ([_aButton.presentationLayer hitTest:touchLocation]) { @@ -478,9 +478,9 @@ static float L2_Y; return shouldSendPacket; } -- (BOOL)handleTouchUpEvent:(UIEvent*)event { +- (BOOL)handleTouchUpEvent:touches { BOOL shouldSendPacket = false; - for (UITouch* touch in [event allTouches]) { + for (UITouch* touch in touches) { if (touch == _aTouch) { UPDATE_BUTTON(A_FLAG, 0); _aTouch = nil; diff --git a/Limelight/Input/StreamView.m b/Limelight/Input/StreamView.m index 8069a95b..af1a5fbd 100644 --- a/Limelight/Input/StreamView.m +++ b/Limelight/Input/StreamView.m @@ -27,7 +27,7 @@ - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { NSLog(@"Touch down"); - if (![onScreenControls handleTouchDownEvent:event]) { + if (![onScreenControls handleTouchDownEvent:touches]) { UITouch *touch = [[event allTouches] anyObject]; touchLocation = [touch locationInView:self]; touchMoved = false; @@ -35,7 +35,7 @@ } - (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event { - if (![onScreenControls handleTouchMovedEvent:event]) { + if (![onScreenControls handleTouchMovedEvent:touches]) { if ([[event allTouches] count] == 1) { UITouch *touch = [[event allTouches] anyObject]; CGPoint currentLocation = [touch locationInView:self]; @@ -66,7 +66,7 @@ - (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event { NSLog(@"Touch up"); - if (![onScreenControls handleTouchUpEvent:event]) { + if (![onScreenControls handleTouchUpEvent:touches]) { if (!touchMoved) { if ([[event allTouches] count] == 2) { NSLog(@"Sending right mouse button press");