Parcourir la source

A Steam Controller might be generating keyboard input

We can't use keyboard input as a signal about whether a keyboard is attached. There might be keyboard input from any number of generated inputs or non-keyboard devices.
Sam Lantinga il y a 4 semaines
Parent
commit
8caeaaacdd

+ 0 - 17
src/events/SDL_keyboard.c

@@ -70,7 +70,6 @@ typedef struct SDL_Keyboard
 static SDL_Keyboard SDL_keyboard;
 static int SDL_keyboard_count;
 static SDL_KeyboardInstance *SDL_keyboards;
-static bool SDL_keyboard_active;
 
 static void SDLCALL SDL_KeycodeOptionsChanged(void *userdata, const char *name, const char *oldValue, const char *hint)
 {
@@ -215,20 +214,6 @@ const char *SDL_GetKeyboardNameForID(SDL_KeyboardID instance_id)
     return SDL_GetPersistentString(SDL_keyboards[keyboard_index].name);
 }
 
-void SDL_SetKeyboardActive(bool active)
-{
-    SDL_keyboard_active = active;
-}
-
-bool SDL_HasActiveKeyboard(void)
-{
-    if (!SDL_HasKeyboard()) {
-        // No keyboards to be active
-        return false;
-    }
-    return SDL_keyboard_active;
-}
-
 void SDL_ResetKeyboard(void)
 {
     SDL_Keyboard *keyboard = &SDL_keyboard;
@@ -571,8 +556,6 @@ static bool SDL_SendKeyboardKeyInternal(Uint64 timestamp, Uint32 flags, SDL_Keyb
     }
 
     if (source == KEYBOARD_HARDWARE) {
-        // Primary input appears to be a keyboard
-        SDL_SetKeyboardActive(true);
         keyboard->hardware_timestamp = SDL_GetTicks();
     } else if (source == KEYBOARD_AUTORELEASE) {
         keyboard->autorelease_pending = true;

+ 0 - 6
src/events/SDL_keyboard_c.h

@@ -43,12 +43,6 @@ extern void SDL_AddKeyboard(SDL_KeyboardID keyboardID, const char *name, bool se
 // A keyboard has been removed from the system
 extern void SDL_RemoveKeyboard(SDL_KeyboardID keyboardID, bool send_event);
 
-// Set whether keyboard input is active
-extern void SDL_SetKeyboardActive(bool active);
-
-// Get whether keyboard input is active
-extern bool SDL_HasActiveKeyboard(void);
-
 // Set the mapping of scancode to key codes
 extern void SDL_SetKeymap(SDL_Keymap *keymap, bool send_event);
 

+ 0 - 5
src/joystick/SDL_joystick.c

@@ -2368,11 +2368,6 @@ void SDL_SendJoystickButton(Uint64 timestamp, SDL_Joystick *joystick, Uint8 butt
         return;
     }
 
-    if (!joystick->is_virtual) {
-        // Primary input appears to be a joystick
-        SDL_SetKeyboardActive(false);
-    }
-
     /* We ignore events if we don't have keyboard focus, except for button
      * release. */
     if (SDL_PrivateJoystickShouldIgnoreEvent()) {

+ 1 - 1
src/video/SDL_video.c

@@ -5416,7 +5416,7 @@ bool SDL_GetTextInputMultiline(SDL_PropertiesID props)
 static bool AutoShowingScreenKeyboard(void)
 {
     const char *hint = SDL_GetHint(SDL_HINT_ENABLE_SCREEN_KEYBOARD);
-    if (((!hint || SDL_strcasecmp(hint, "auto") == 0) && !SDL_HasActiveKeyboard()) ||
+    if (((!hint || SDL_strcasecmp(hint, "auto") == 0) && !SDL_HasKeyboard()) ||
         SDL_GetStringBoolean(hint, false)) {
         return true;
     } else {