From 40e1ec3bbf2a990a5c600564fe312c2121178a50 Mon Sep 17 00:00:00 2001 From: NyakoFox Date: Mon, 19 Oct 2026 01:13:47 -0300 Subject: [PATCH] Fix keyboard detection Apparently, `keyboard_is_active` defaulted to `true`, relying on the existence of a gamepad connection to set it to `false`. This logic is faulty on devices where you have neither a keyboard OR a gamepad, such as touch input. This is the exact scenario I ran into while working on touch input -- the editor was enabled despite not having a keyboard. This patch sets the default depending on the device -- if we're on a mobile device, set it to false; otherwise check if we're on Steam Deck. --- desktop_version/src/ButtonGlyphs.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/desktop_version/src/ButtonGlyphs.cpp b/desktop_version/src/ButtonGlyphs.cpp index 486c6496..30162874 100644 --- a/desktop_version/src/ButtonGlyphs.cpp +++ b/desktop_version/src/ButtonGlyphs.cpp @@ -155,7 +155,7 @@ static const char* glyph_layout[LAYOUT_TOTAL][SDL_GAMEPAD_BUTTON_RIGHT_SHOULDER } }; -static bool keyboard_is_active = true; +static bool keyboard_is_active; static ButtonGlyphLayout layout = LAYOUT_GENERIC; void BUTTONGLYPHS_init(void) @@ -165,6 +165,12 @@ void BUTTONGLYPHS_init(void) { SDL_strlcpy(glyph[i], UTF8_encode(0xEB00+i).bytes, sizeof(glyph[i])); } + +#if defined(SDL_PLATFORM_ANDROID) || TARGET_OS_IPHONE + keyboard_is_active = false; +#else + keyboard_is_active = !SDL_GetHintBoolean("SteamDeck", false); +#endif } bool BUTTONGLYPHS_keyboard_is_available(void)