mirror of
https://github.com/Ryujinx/SDL.git
synced 2025-01-09 14:35:39 +00:00
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/6962 (cherry picked from commit a8abe612ed5597cbaabb903c0121b5b48baee91d)
This commit is contained in:
parent
5e9320f6b5
commit
335e9c769a
|
@ -412,8 +412,10 @@ extern int SDL_AppleTVRemoteOpenedAsJoystick;
|
|||
SDL_SendKeyboardKey(SDL_PRESSED, scancode);
|
||||
}
|
||||
}
|
||||
if (SDL_TextInputActive()) {
|
||||
[super pressesBegan:presses withEvent:event];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)pressesEnded:(NSSet<UIPress *> *)presses withEvent:(UIPressesEvent *)event
|
||||
{
|
||||
|
@ -423,8 +425,10 @@ extern int SDL_AppleTVRemoteOpenedAsJoystick;
|
|||
SDL_SendKeyboardKey(SDL_RELEASED, scancode);
|
||||
}
|
||||
}
|
||||
if (SDL_TextInputActive()) {
|
||||
[super pressesEnded:presses withEvent:event];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)pressesCancelled:(NSSet<UIPress *> *)presses withEvent:(UIPressesEvent *)event
|
||||
{
|
||||
|
@ -434,14 +438,18 @@ extern int SDL_AppleTVRemoteOpenedAsJoystick;
|
|||
SDL_SendKeyboardKey(SDL_RELEASED, scancode);
|
||||
}
|
||||
}
|
||||
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. */
|
||||
if (SDL_TextInputActive()) {
|
||||
[super pressesChanged:presses withEvent:event];
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* TARGET_OS_TV || defined(__IPHONE_9_1) */
|
||||
|
||||
|
|
Loading…
Reference in a new issue