src/video/uikit/SDL_uikitview.m
changeset 11831 c3446901fc1c
parent 11811 5d94cb6b24d3
child 11845 cf80a56f6d8d
     1.1 --- a/src/video/uikit/SDL_uikitview.m	Tue Jan 16 21:29:32 2018 +0100
     1.2 +++ b/src/video/uikit/SDL_uikitview.m	Wed Jan 17 17:24:15 2018 -0800
     1.3 @@ -24,6 +24,7 @@
     1.4  
     1.5  #include "SDL_uikitview.h"
     1.6  
     1.7 +#include "SDL_hints.h"
     1.8  #include "../../events/SDL_mouse_c.h"
     1.9  #include "../../events/SDL_touch_c.h"
    1.10  #include "../../events/SDL_events_c.h"
    1.11 @@ -42,23 +43,25 @@
    1.12  - (instancetype)initWithFrame:(CGRect)frame
    1.13  {
    1.14      if ((self = [super initWithFrame:frame])) {
    1.15 -        /* Apple TV Remote touchpad swipe gestures. */
    1.16  #if TARGET_OS_TV
    1.17 -        UISwipeGestureRecognizer *swipeUp = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(swipeGesture:)];
    1.18 -        swipeUp.direction = UISwipeGestureRecognizerDirectionUp;
    1.19 -        [self addGestureRecognizer:swipeUp];
    1.20 +        if (SDL_GetHintBoolean(SDL_HINT_APPLE_TV_REMOTE_SWIPES_AS_ARROW_KEYS, SDL_TRUE)) {
    1.21 +            /* Apple TV Remote touchpad swipe gestures. */
    1.22 +            UISwipeGestureRecognizer *swipeUp = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(swipeGesture:)];
    1.23 +            swipeUp.direction = UISwipeGestureRecognizerDirectionUp;
    1.24 +            [self addGestureRecognizer:swipeUp];
    1.25  
    1.26 -        UISwipeGestureRecognizer *swipeDown = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(swipeGesture:)];
    1.27 -        swipeDown.direction = UISwipeGestureRecognizerDirectionDown;
    1.28 -        [self addGestureRecognizer:swipeDown];
    1.29 +            UISwipeGestureRecognizer *swipeDown = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(swipeGesture:)];
    1.30 +            swipeDown.direction = UISwipeGestureRecognizerDirectionDown;
    1.31 +            [self addGestureRecognizer:swipeDown];
    1.32  
    1.33 -        UISwipeGestureRecognizer *swipeLeft = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(swipeGesture:)];
    1.34 -        swipeLeft.direction = UISwipeGestureRecognizerDirectionLeft;
    1.35 -        [self addGestureRecognizer:swipeLeft];
    1.36 +            UISwipeGestureRecognizer *swipeLeft = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(swipeGesture:)];
    1.37 +            swipeLeft.direction = UISwipeGestureRecognizerDirectionLeft;
    1.38 +            [self addGestureRecognizer:swipeLeft];
    1.39  
    1.40 -        UISwipeGestureRecognizer *swipeRight = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(swipeGesture:)];
    1.41 -        swipeRight.direction = UISwipeGestureRecognizerDirectionRight;
    1.42 -        [self addGestureRecognizer:swipeRight];
    1.43 +            UISwipeGestureRecognizer *swipeRight = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(swipeGesture:)];
    1.44 +            swipeRight.direction = UISwipeGestureRecognizerDirectionRight;
    1.45 +            [self addGestureRecognizer:swipeRight];
    1.46 +        }
    1.47  #endif
    1.48  
    1.49          self.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;