Browse Source

Enable SDL_HINT_JOYSTICK_THREAD by default

If you're not using SDL for video you won't get raw input messages without this hint, and this is tripping up enough people it makes sense to have this enabled by default. There isn't much downside to this, other than having another thread processing Xbox controller input.

Fixes https://github.com/libsdl-org/SDL/issues/10576
Sam Lantinga 7 months ago
parent
commit
4797970bfa
2 changed files with 4 additions and 4 deletions
  1. 2 2
      include/SDL3/SDL_hints.h
  2. 2 2
      src/joystick/windows/SDL_windowsjoystick.c

+ 2 - 2
include/SDL3/SDL_hints.h

@@ -2098,8 +2098,8 @@ extern "C" {
  *
  *
  * The variable can be set to the following values:
  * The variable can be set to the following values:
  *
  *
- * - "0": A separate thread is not used. (default)
- * - "1": A separate thread is used for handling raw input messages.
+ * - "0": A separate thread is not used.
+ * - "1": A separate thread is used for handling raw input messages. (default)
  *
  *
  * This hint should be set before SDL is initialized.
  * This hint should be set before SDL is initialized.
  *
  *

+ 2 - 2
src/joystick/windows/SDL_windowsjoystick.c

@@ -284,7 +284,7 @@ static bool SDL_StartJoystickThread(void)
     }
     }
 
 
     s_bJoystickThreadQuit = false;
     s_bJoystickThreadQuit = false;
-    s_joystickThread = SDL_CreateThreadWithStackSize(SDL_JoystickThread, "SDL_joystick", 64 * 1024, NULL);
+    s_joystickThread = SDL_CreateThread(SDL_JoystickThread, "SDL_joystick", NULL);
     if (!s_joystickThread) {
     if (!s_joystickThread) {
         return false;
         return false;
     }
     }
@@ -344,7 +344,7 @@ static bool WINDOWS_JoystickInit(void)
     WIN_InitDeviceNotification();
     WIN_InitDeviceNotification();
 
 
 #if !defined(SDL_PLATFORM_XBOXONE) && !defined(SDL_PLATFORM_XBOXSERIES)
 #if !defined(SDL_PLATFORM_XBOXONE) && !defined(SDL_PLATFORM_XBOXSERIES)
-    s_bJoystickThread = SDL_GetHintBoolean(SDL_HINT_JOYSTICK_THREAD, false);
+    s_bJoystickThread = SDL_GetHintBoolean(SDL_HINT_JOYSTICK_THREAD, true);
     if (s_bJoystickThread) {
     if (s_bJoystickThread) {
         if (!SDL_StartJoystickThread()) {
         if (!SDL_StartJoystickThread()) {
             return false;
             return false;