mirror of
https://github.com/libsdl-org/SDL.git
synced 2026-06-21 18:53:38 +00:00
Added SDL_HINT_ENABLE_STEAM_SCREEN_KEYBOARD
(cherry picked from commit c9b6581210)
This commit is contained in:
@@ -5785,8 +5785,10 @@ static bool AutoShowingScreenKeyboard(void)
|
||||
{
|
||||
const char *hint = SDL_GetHint(SDL_HINT_ENABLE_SCREEN_KEYBOARD);
|
||||
if (!hint) {
|
||||
// Steam will eventually have smarts about whether a keyboard is active, so always request the on-screen keyboard on Steam Deck
|
||||
hint = SDL_GetHint("SteamDeck");
|
||||
// This hint is currently only used by the X11 video driver
|
||||
if (SDL_strcmp(_this->name, "x11") == 0) {
|
||||
hint = SDL_GetHint(SDL_HINT_ENABLE_STEAM_SCREEN_KEYBOARD);
|
||||
}
|
||||
}
|
||||
if (((!hint || SDL_strcasecmp(hint, "auto") == 0) && !SDL_HasKeyboard()) ||
|
||||
SDL_GetStringBoolean(hint, false)) {
|
||||
|
||||
@@ -831,14 +831,14 @@ bool X11_UpdateTextInputArea(SDL_VideoDevice *_this, SDL_Window *window)
|
||||
bool X11_HasScreenKeyboardSupport(SDL_VideoDevice *_this)
|
||||
{
|
||||
SDL_VideoData *videodata = _this->internal;
|
||||
return videodata->is_steam_deck;
|
||||
return videodata->use_steam_screen_keyboard;
|
||||
}
|
||||
|
||||
void X11_ShowScreenKeyboard(SDL_VideoDevice *_this, SDL_Window *window, SDL_PropertiesID props)
|
||||
{
|
||||
SDL_VideoData *videodata = _this->internal;
|
||||
|
||||
if (videodata->is_steam_deck) {
|
||||
if (videodata->use_steam_screen_keyboard) {
|
||||
/* For more documentation of the URL parameters, see:
|
||||
* https://partner.steamgames.com/doc/api/ISteamUtils#ShowFloatingGamepadTextInput
|
||||
*/
|
||||
@@ -880,7 +880,7 @@ void X11_HideScreenKeyboard(SDL_VideoDevice *_this, SDL_Window *window)
|
||||
{
|
||||
SDL_VideoData *videodata = _this->internal;
|
||||
|
||||
if (videodata->is_steam_deck) {
|
||||
if (videodata->use_steam_screen_keyboard) {
|
||||
SDL_OpenURL("steam://close/keyboard");
|
||||
SDL_SendScreenKeyboardHidden();
|
||||
}
|
||||
|
||||
@@ -143,7 +143,7 @@ static SDL_VideoDevice *X11_CreateDevice(void)
|
||||
/* Steam Deck will have an on-screen keyboard, so check their environment
|
||||
* variable so we can make use of SDL_StartTextInput.
|
||||
*/
|
||||
data->is_steam_deck = SDL_GetHintBoolean("SteamDeck", false);
|
||||
data->use_steam_screen_keyboard = SDL_GetHintBoolean(SDL_HINT_ENABLE_STEAM_SCREEN_KEYBOARD, false);
|
||||
|
||||
// Set the function pointers
|
||||
device->VideoInit = X11_VideoInit;
|
||||
|
||||
@@ -190,7 +190,7 @@ struct SDL_VideoData
|
||||
#endif
|
||||
|
||||
// Used to interact with the on-screen keyboard
|
||||
bool is_steam_deck;
|
||||
bool use_steam_screen_keyboard;
|
||||
|
||||
bool is_xwayland;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user