Only do work to process text events if text input is active
Fixes https://github.com/libsdl-org/SDL/issues/9353
This commit is contained in:
parent
658f3cdcf1
commit
fa236f169b
6 changed files with 105 additions and 79 deletions
|
@ -1180,6 +1180,10 @@ int SDL_SendKeyboardText(const char *text)
|
|||
SDL_Keyboard *keyboard = &SDL_keyboard;
|
||||
int posted;
|
||||
|
||||
if (!SDL_TextInputActive()) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Don't post text events for unprintable characters */
|
||||
if (SDL_iscntrl((unsigned char)*text)) {
|
||||
return 0;
|
||||
|
@ -1210,6 +1214,10 @@ int SDL_SendEditingText(const char *text, int start, int length)
|
|||
SDL_Keyboard *keyboard = &SDL_keyboard;
|
||||
int posted;
|
||||
|
||||
if (!SDL_TextInputActive()) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Post the event, if desired */
|
||||
posted = 0;
|
||||
if (SDL_EventEnabled(SDL_EVENT_TEXT_EDITING)) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue