mirror of
https://github.com/Ryujinx/SDL.git
synced 2025-01-03 16:25:43 +00:00
Added the hint SDL_HINT_ENABLE_SCREEN_KEYBOARD to control whether the on-screen keyboard should be shown when text input is active
Fixes https://github.com/libsdl-org/SDL/issues/7160
This commit is contained in:
parent
00b87f1ded
commit
69644346ac
|
@ -7,6 +7,7 @@ This is a list of major changes in SDL's version history.
|
|||
|
||||
General:
|
||||
* Added a display event SDL_DISPLAYEVENT_MOVED which is sent when the primary monitor changes or displays change position relative to each other
|
||||
* Added the hint SDL_HINT_ENABLE_SCREEN_KEYBOARD to control whether the on-screen keyboard should be shown when text input is active
|
||||
|
||||
|
||||
---------------------------------------------------------------------------
|
||||
|
|
|
@ -377,6 +377,17 @@ extern "C" {
|
|||
*/
|
||||
#define SDL_HINT_EMSCRIPTEN_KEYBOARD_ELEMENT "SDL_EMSCRIPTEN_KEYBOARD_ELEMENT"
|
||||
|
||||
/**
|
||||
* \brief A variable that controls whether the on-screen keyboard should be shown when text input is active
|
||||
*
|
||||
* The variable can be set to the following values:
|
||||
* "0" - Do not show the on-screen keyboard
|
||||
* "1" - Show the on-screen keyboard
|
||||
*
|
||||
* The default value is "1". This hint must be set before text input is activated.
|
||||
*/
|
||||
#define SDL_HINT_ENABLE_SCREEN_KEYBOARD "SDL_ENABLE_SCREEN_KEYBOARD"
|
||||
|
||||
/**
|
||||
* \brief A variable that controls whether Steam Controllers should be exposed using the SDL joystick and game controller APIs
|
||||
*
|
||||
|
|
|
@ -4294,10 +4294,12 @@ void SDL_StartTextInput(void)
|
|||
(void)SDL_EventState(SDL_TEXTEDITING, SDL_ENABLE);
|
||||
|
||||
/* Then show the on-screen keyboard, if any */
|
||||
if (SDL_GetHintBoolean(SDL_HINT_ENABLE_SCREEN_KEYBOARD, SDL_TRUE)) {
|
||||
window = SDL_GetFocusWindow();
|
||||
if (window && _this && _this->ShowScreenKeyboard) {
|
||||
_this->ShowScreenKeyboard(_this, window);
|
||||
}
|
||||
}
|
||||
|
||||
/* Finally start the text input system */
|
||||
if (_this && _this->StartTextInput) {
|
||||
|
@ -4338,10 +4340,12 @@ void SDL_StopTextInput(void)
|
|||
}
|
||||
|
||||
/* Hide the on-screen keyboard, if any */
|
||||
if (SDL_GetHintBoolean(SDL_HINT_ENABLE_SCREEN_KEYBOARD, SDL_TRUE)) {
|
||||
window = SDL_GetFocusWindow();
|
||||
if (window && _this && _this->HideScreenKeyboard) {
|
||||
_this->HideScreenKeyboard(_this, window);
|
||||
}
|
||||
}
|
||||
|
||||
/* Finally disable text events */
|
||||
(void)SDL_EventState(SDL_TEXTINPUT, SDL_DISABLE);
|
||||
|
|
Loading…
Reference in a new issue