src/video/uikit/SDL_uikitview.m
changeset 11845 cf80a56f6d8d
parent 11831 c3446901fc1c
child 11846 a1b2d62d5d73
     1.1 --- a/src/video/uikit/SDL_uikitview.m	Tue Feb 06 15:03:35 2018 -0800
     1.2 +++ b/src/video/uikit/SDL_uikitview.m	Tue Feb 06 15:03:38 2018 -0800
     1.3 @@ -44,7 +44,7 @@
     1.4  {
     1.5      if ((self = [super initWithFrame:frame])) {
     1.6  #if TARGET_OS_TV
     1.7 -        if (SDL_GetHintBoolean(SDL_HINT_APPLE_TV_REMOTE_SWIPES_AS_ARROW_KEYS, SDL_TRUE)) {
     1.8 +        if (!SDL_GetHintBoolean(SDL_HINT_TV_REMOTE_AS_JOYSTICK, SDL_TRUE)) {
     1.9              /* Apple TV Remote touchpad swipe gestures. */
    1.10              UISwipeGestureRecognizer *swipeUp = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(swipeGesture:)];
    1.11              swipeUp.direction = UISwipeGestureRecognizerDirectionUp;
    1.12 @@ -237,10 +237,10 @@
    1.13          return SDL_SCANCODE_RIGHT;
    1.14      case UIPressTypeSelect:
    1.15          /* HIG says: "primary button behavior" */
    1.16 -        return SDL_SCANCODE_SELECT;
    1.17 +        return SDL_SCANCODE_RETURN;
    1.18      case UIPressTypeMenu:
    1.19          /* HIG says: "returns to previous screen" */
    1.20 -        return SDL_SCANCODE_MENU;
    1.21 +        return SDL_SCANCODE_ESCAPE;
    1.22      case UIPressTypePlayPause:
    1.23          /* HIG says: "secondary button behavior" */
    1.24          return SDL_SCANCODE_PAUSE;
    1.25 @@ -251,31 +251,34 @@
    1.26  
    1.27  - (void)pressesBegan:(NSSet<UIPress *> *)presses withEvent:(UIPressesEvent *)event
    1.28  {
    1.29 -    for (UIPress *press in presses) {
    1.30 -        SDL_Scancode scancode = [self scancodeFromPressType:press.type];
    1.31 -        SDL_SendKeyboardKey(SDL_PRESSED, scancode);
    1.32 -    }
    1.33 -
    1.34 +	if (!SDL_GetHintBoolean(SDL_HINT_TV_REMOTE_AS_JOYSTICK, SDL_TRUE)) {
    1.35 +    	for (UIPress *press in presses) {
    1.36 +        	SDL_Scancode scancode = [self scancodeFromPressType:press.type];
    1.37 +        	SDL_SendKeyboardKey(SDL_PRESSED, scancode);
    1.38 +    	}
    1.39 +	}
    1.40      [super pressesBegan:presses withEvent:event];
    1.41  }
    1.42  
    1.43  - (void)pressesEnded:(NSSet<UIPress *> *)presses withEvent:(UIPressesEvent *)event
    1.44  {
    1.45 -    for (UIPress *press in presses) {
    1.46 -        SDL_Scancode scancode = [self scancodeFromPressType:press.type];
    1.47 -        SDL_SendKeyboardKey(SDL_RELEASED, scancode);
    1.48 -    }
    1.49 -
    1.50 +	if (!SDL_GetHintBoolean(SDL_HINT_TV_REMOTE_AS_JOYSTICK, SDL_TRUE)) {
    1.51 +		for (UIPress *press in presses) {
    1.52 +			SDL_Scancode scancode = [self scancodeFromPressType:press.type];
    1.53 +			SDL_SendKeyboardKey(SDL_RELEASED, scancode);
    1.54 +		}
    1.55 +	}
    1.56      [super pressesEnded:presses withEvent:event];
    1.57  }
    1.58  
    1.59  - (void)pressesCancelled:(NSSet<UIPress *> *)presses withEvent:(UIPressesEvent *)event
    1.60  {
    1.61 -    for (UIPress *press in presses) {
    1.62 -        SDL_Scancode scancode = [self scancodeFromPressType:press.type];
    1.63 -        SDL_SendKeyboardKey(SDL_RELEASED, scancode);
    1.64 -    }
    1.65 -
    1.66 +	if (!SDL_GetHintBoolean(SDL_HINT_TV_REMOTE_AS_JOYSTICK, SDL_TRUE)) {
    1.67 +		for (UIPress *press in presses) {
    1.68 +			SDL_Scancode scancode = [self scancodeFromPressType:press.type];
    1.69 +			SDL_SendKeyboardKey(SDL_RELEASED, scancode);
    1.70 +		}
    1.71 +	}
    1.72      [super pressesCancelled:presses withEvent:event];
    1.73  }
    1.74