Only pass keypresses up the responder chain when text input is active
This is another attempt to make sure we don't cause beeps from unhandled key presses while still allowing full text input functionalty. If this isn't selective enough, we might need to go up the responder chain to see what's going to handle the event before passing it along. Fixes https://github.com/libsdl-org/SDL/pull/6962main
parent
c3288d113e
commit
a8abe612ed
|
@ -417,7 +417,9 @@ extern int SDL_AppleTVRemoteOpenedAsJoystick;
|
|||
SDL_SendKeyboardKey(UIKit_GetEventTimestamp([event timestamp]), SDL_PRESSED, scancode);
|
||||
}
|
||||
}
|
||||
[super pressesBegan:presses withEvent:event];
|
||||
if (SDL_TextInputActive()) {
|
||||
[super pressesBegan:presses withEvent:event];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)pressesEnded:(NSSet<UIPress *> *)presses withEvent:(UIPressesEvent *)event
|
||||
|
@ -428,7 +430,9 @@ extern int SDL_AppleTVRemoteOpenedAsJoystick;
|
|||
SDL_SendKeyboardKey(UIKit_GetEventTimestamp([event timestamp]), SDL_RELEASED, scancode);
|
||||
}
|
||||
}
|
||||
[super pressesEnded:presses withEvent:event];
|
||||
if (SDL_TextInputActive()) {
|
||||
[super pressesEnded:presses withEvent:event];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)pressesCancelled:(NSSet<UIPress *> *)presses withEvent:(UIPressesEvent *)event
|
||||
|
@ -439,13 +443,17 @@ extern int SDL_AppleTVRemoteOpenedAsJoystick;
|
|||
SDL_SendKeyboardKey(UIKit_GetEventTimestamp([event timestamp]), SDL_RELEASED, scancode);
|
||||
}
|
||||
}
|
||||
[super pressesCancelled:presses withEvent:event];
|
||||
if (SDL_TextInputActive()) {
|
||||
[super pressesCancelled:presses withEvent:event];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)pressesChanged:(NSSet<UIPress *> *)presses withEvent:(UIPressesEvent *)event
|
||||
{
|
||||
/* This is only called when the force of a press changes. */
|
||||
[super pressesChanged:presses withEvent:event];
|
||||
if (SDL_TextInputActive()) {
|
||||
[super pressesChanged:presses withEvent:event];
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* TARGET_OS_TV || defined(__IPHONE_9_1) */
|
||||
|
|
Loading…
Reference in New Issue