From f522c67a5c42ad274ae87aaadd0b547386198ea5 Mon Sep 17 00:00:00 2001 From: Leon Styhre Date: Sun, 25 Jun 2023 14:33:06 +0200 Subject: [PATCH] The automatic popup of the device virtual keyboard is now always disabled if the SDL release is 2.28.0 or higher Also removed the custom SDL patch for the Linux AppImage builds that prevented the popup keyboard from being displayed, and also added logging of the SDL version to es_log.txt on application startup --- es-app/src/main.cpp | 14 ++++++++++++++ tools/create_AppImage.sh | 31 ------------------------------ tools/create_AppImage_SteamDeck.sh | 31 ------------------------------ 3 files changed, 14 insertions(+), 62 deletions(-) diff --git a/es-app/src/main.cpp b/es-app/src/main.cpp index 8b62809d2..41600f629 100644 --- a/es-app/src/main.cpp +++ b/es-app/src/main.cpp @@ -759,6 +759,20 @@ int main(int argc, char* argv[]) #endif AudioManager::getInstance(); + + SDL_version version; + SDL_GetVersion(&version); + + LOG(LogInfo) << "SDL version: " << std::to_string(version.major) << "." + << std::to_string(version.minor) << "." << std::to_string(version.patch); + + if (version.major > 2 || (version.major == 2 && version.minor >= 28)) { + // This will prevent the popup virtual keyboard of any handheld device from being + // automatically displayed on top of the ES-DE virtual keyboard. +#define SDL_HINT_ENABLE_SCREEN_KEYBOARD "SDL_ENABLE_SCREEN_KEYBOARD" + SDL_SetHint(SDL_HINT_ENABLE_SCREEN_KEYBOARD, "0"); + } + MameNames::getInstance(); ThemeData::populateThemeSets(); loadSystemsReturnCode loadSystemsStatus {loadSystemConfigFile()}; diff --git a/tools/create_AppImage.sh b/tools/create_AppImage.sh index d09aaddce..79621ff3f 100755 --- a/tools/create_AppImage.sh +++ b/tools/create_AppImage.sh @@ -50,37 +50,6 @@ if [ ! -f external/SDL/build/${SDL_SHARED_LIBRARY} ]; then cd SDL git checkout $SDL_RELEASE_TAG -# Temporary workaround until a proper fix has been implemented in the SDL library: -# https://github.com/libsdl-org/SDL/issues/7160 -cat << EOF | git apply -diff --git a/src/video/SDL_video.c b/src/video/SDL_video.c -index 0809706c2..bbabfcaa7 100644 ---- a/src/video/SDL_video.c -+++ b/src/video/SDL_video.c -@@ -4342,17 +4342,20 @@ SDL_GetWindowWMInfo(SDL_Window * window, struct SDL_SysWMinfo *info) - void - SDL_StartTextInput(void) - { -+/* - SDL_Window *window; -- -+*/ - /* First, enable text events */ - (void)SDL_EventState(SDL_TEXTINPUT, SDL_ENABLE); - (void)SDL_EventState(SDL_TEXTEDITING, SDL_ENABLE); - - /* Then show the on-screen keyboard, if any */ -+/* - window = SDL_GetFocusWindow(); - if (window && _this && _this->ShowScreenKeyboard) { - _this->ShowScreenKeyboard(_this, window); - } -+*/ - - /* Finally start the text input system */ - if (_this && _this->StartTextInput) { -EOF - mkdir build cd build cmake -DCMAKE_BUILD_TYPE=Release -S .. -B . diff --git a/tools/create_AppImage_SteamDeck.sh b/tools/create_AppImage_SteamDeck.sh index aaaeba37a..d22dae469 100755 --- a/tools/create_AppImage_SteamDeck.sh +++ b/tools/create_AppImage_SteamDeck.sh @@ -46,37 +46,6 @@ if [ ! -f external/SDL/build/${SDL_SHARED_LIBRARY} ]; then cd SDL git checkout $SDL_RELEASE_TAG -# Temporary workaround until a proper fix has been implemented in the SDL library: -# https://github.com/libsdl-org/SDL/issues/7160 -cat << EOF | git apply -diff --git a/src/video/SDL_video.c b/src/video/SDL_video.c -index 0809706c2..bbabfcaa7 100644 ---- a/src/video/SDL_video.c -+++ b/src/video/SDL_video.c -@@ -4342,17 +4342,20 @@ SDL_GetWindowWMInfo(SDL_Window * window, struct SDL_SysWMinfo *info) - void - SDL_StartTextInput(void) - { -+/* - SDL_Window *window; -- -+*/ - /* First, enable text events */ - (void)SDL_EventState(SDL_TEXTINPUT, SDL_ENABLE); - (void)SDL_EventState(SDL_TEXTEDITING, SDL_ENABLE); - - /* Then show the on-screen keyboard, if any */ -+/* - window = SDL_GetFocusWindow(); - if (window && _this && _this->ShowScreenKeyboard) { - _this->ShowScreenKeyboard(_this, window); - } -+*/ - - /* Finally start the text input system */ - if (_this && _this->StartTextInput) { -EOF - mkdir build cd build cmake -DCMAKE_BUILD_TYPE=Release -S .. -B .