diff --git a/Limelight/Input/OnScreenControls.h b/Limelight/Input/OnScreenControls.h index 5379a06..b3f17a7 100644 --- a/Limelight/Input/OnScreenControls.h +++ b/Limelight/Input/OnScreenControls.h @@ -8,7 +8,6 @@ #import -@protocol EdgeDetectionDelegate; @class ControllerSupport; @interface OnScreenControls : NSObject @@ -25,7 +24,7 @@ typedef NS_ENUM(NSInteger, OnScreenControlsLevel) { OnScreenControlsLevelAutoGCExtendedGamepadWithStickButtons }; -- (id) initWithView:(UIView*)view controllerSup:(ControllerSupport*)controllerSupport swipeDelegate:(id)edgeDelegate; +- (id) initWithView:(UIView*)view controllerSup:(ControllerSupport*)controllerSupport; - (BOOL) handleTouchDownEvent:(NSSet*)touches; - (BOOL) handleTouchUpEvent:(NSSet*)touches; - (BOOL) handleTouchMovedEvent:(NSSet*)touches; diff --git a/Limelight/Input/OnScreenControls.m b/Limelight/Input/OnScreenControls.m index b404260..f261ed0 100644 --- a/Limelight/Input/OnScreenControls.m +++ b/Limelight/Input/OnScreenControls.m @@ -36,7 +36,6 @@ CALayer* _l1Button; CALayer* _l2Button; CALayer* _l3Button; - CALayer* _edge; UITouch* _aTouch; UITouch* _bTouch; @@ -53,7 +52,6 @@ UITouch* _l1Touch; UITouch* _l2Touch; UITouch* _l3Touch; - UITouch* _edgeTouch; NSDate* l3TouchStart; NSDate* r3TouchStart; @@ -69,7 +67,6 @@ ControllerSupport *_controllerSupport; Controller *_controller; - id _edgeDelegate; NSMutableArray* _deadTouches; } @@ -114,12 +111,11 @@ static float L2_Y; static float L3_X; static float L3_Y; -- (id) initWithView:(UIView*)view controllerSup:(ControllerSupport*)controllerSupport swipeDelegate:(id)swipeDelegate { +- (id) initWithView:(UIView*)view controllerSup:(ControllerSupport*)controllerSupport { self = [self init]; _view = view; _controllerSupport = controllerSupport; _controller = [controllerSupport getOscController]; - _edgeDelegate = swipeDelegate; _deadTouches = [[NSMutableArray alloc] init]; _iPad = ([UIDevice currentDevice].userInterfaceIdiom == UIUserInterfaceIdiomPad); @@ -156,16 +152,13 @@ static float L3_Y; _rightStickBackground = [CALayer layer]; _leftStick = [CALayer layer]; _rightStick = [CALayer layer]; - _edge = [CALayer layer]; return self; } - (void) show { _visible = YES; - - [self setupEdgeDetection]; - + [self updateControls]; } @@ -254,11 +247,6 @@ static float L3_Y; } } -- (void) setupEdgeDetection { - _edge.frame = CGRectMake(0, 0, 5, _view.frame.size.height); - [_view.layer addSublayer:_edge]; -} - // For GCExtendedGamepad controls we move start, select, L3, and R3 to the button - (void) setupExtendedGamepadControls { // Start with the default complex layout @@ -650,8 +638,6 @@ static float L3_Y; buttonTouch = true; } else if (touch == _r3Touch) { buttonTouch = true; - } else if (touch == _edgeTouch) { - buttonTouch = true; } if ([_deadTouches containsObject:touch]) { updated = true; @@ -771,9 +757,6 @@ static float L3_Y; } _rsTouch = touch; stickTouch = true; - } else if ([_edge.presentationLayer hitTest:touchLocation]) { - _edgeTouch = touch; - updated = true; } if (!updated && !stickTouch && [self isInDeadZone:touch]) { [_deadTouches addObject:touch]; @@ -857,11 +840,6 @@ static float L3_Y; else if (touch == _r3Touch) { _r3Touch = nil; touched = true; - } else if (touch == _edgeTouch) { - _edgeTouch = nil; - if ([touch locationInView:_view].x >= _view.frame.size.width / 4) { - [_edgeDelegate edgeSwiped]; - } } if ([_deadTouches containsObject:touch]) { [_deadTouches removeObject:touch]; diff --git a/Limelight/Input/StreamView.h b/Limelight/Input/StreamView.h index adfcd1d..9f50010 100644 --- a/Limelight/Input/StreamView.h +++ b/Limelight/Input/StreamView.h @@ -11,12 +11,6 @@ #import "Moonlight-Swift.h" #import "StreamConfiguration.h" -@protocol EdgeDetectionDelegate - -- (void) edgeSwiped; - -@end - @protocol UserInteractionDelegate - (void) userInteractionBegan; @@ -31,7 +25,6 @@ #endif - (void) setupStreamView:(ControllerSupport*)controllerSupport - swipeDelegate:(id)swipeDelegate interactionDelegate:(id)interactionDelegate config:(StreamConfiguration*)streamConfig; - (void) showOnScreenControls; diff --git a/Limelight/Input/StreamView.m b/Limelight/Input/StreamView.m index 651fef5..f301060 100644 --- a/Limelight/Input/StreamView.m +++ b/Limelight/Input/StreamView.m @@ -44,7 +44,6 @@ static const double X1_MOUSE_SPEED_DIVISOR = 2.5; } - (void) setupStreamView:(ControllerSupport*)controllerSupport - swipeDelegate:(id)swipeDelegate interactionDelegate:(id)interactionDelegate config:(StreamConfiguration*)streamConfig { self->interactionDelegate = interactionDelegate; @@ -71,7 +70,7 @@ static const double X1_MOUSE_SPEED_DIVISOR = 2.5; self->touchHandler = [[RelativeTouchHandler alloc] initWithView:self]; } - onScreenControls = [[OnScreenControls alloc] initWithView:self controllerSup:controllerSupport swipeDelegate:swipeDelegate]; + onScreenControls = [[OnScreenControls alloc] initWithView:self controllerSup:controllerSupport]; OnScreenControlsLevel level = (OnScreenControlsLevel)[settings.onscreenControls integerValue]; if (settings.absoluteTouchMode) { Log(LOG_I, @"On-screen controls disabled in absolute touch mode"); @@ -631,8 +630,10 @@ static const double X1_MOUSE_SPEED_DIVISOR = 2.5; LiSendScrollEvent(deltaZ); } +#if !TARGET_OS_TV - (BOOL)isMultipleTouchEnabled { return YES; } +#endif @end diff --git a/Limelight/ViewControllers/StreamFrameViewController.h b/Limelight/ViewControllers/StreamFrameViewController.h index 65a3c34..6e95919 100644 --- a/Limelight/ViewControllers/StreamFrameViewController.h +++ b/Limelight/ViewControllers/StreamFrameViewController.h @@ -15,9 +15,9 @@ #if TARGET_OS_TV @import GameController; -@interface StreamFrameViewController : GCEventViewController +@interface StreamFrameViewController : GCEventViewController #else -@interface StreamFrameViewController : UIViewController +@interface StreamFrameViewController : UIViewController #endif @property (nonatomic) StreamConfiguration* streamConfig; diff --git a/Limelight/ViewControllers/StreamFrameViewController.m b/Limelight/ViewControllers/StreamFrameViewController.m index bfbd409..f998067 100644 --- a/Limelight/ViewControllers/StreamFrameViewController.m +++ b/Limelight/ViewControllers/StreamFrameViewController.m @@ -33,6 +33,10 @@ StreamView *_streamView; UIScrollView *_scrollView; BOOL _userIsInteracting; + +#if !TARGET_OS_TV + UIScreenEdgePanGestureRecognizer *_exitSwipeRecognizer; +#endif } - (void)viewDidAppear:(BOOL)animated @@ -86,7 +90,7 @@ _inactivityTimer = nil; _streamView = [[StreamView alloc] initWithFrame:self.view.frame]; - [_streamView setupStreamView:_controllerSupport swipeDelegate:self interactionDelegate:self config:self.streamConfig]; + [_streamView setupStreamView:_controllerSupport interactionDelegate:self config:self.streamConfig]; #if TARGET_OS_TV if (!_menuGestureRecognizer || !_menuDoubleTapGestureRecognizer) { @@ -101,8 +105,12 @@ [self.view addGestureRecognizer:_menuGestureRecognizer]; [self.view addGestureRecognizer:_menuDoubleTapGestureRecognizer]; -#endif +#else + _exitSwipeRecognizer = [[UIScreenEdgePanGestureRecognizer alloc] initWithTarget:self action:@selector(edgeSwiped)]; + _exitSwipeRecognizer.edges = UIRectEdgeLeft; + [self.view addGestureRecognizer:_exitSwipeRecognizer]; +#endif _tipLabel = [[UILabel alloc] init]; [_tipLabel setUserInteractionEnabled:NO];