소스 검색

Default SDL_HINT_JOYSTICK_GAMEINPUT to "1" on GDK platforms

Daniel Ludwig 6 달 전
부모
커밋
5b6342a00d
3개의 변경된 파일11개의 추가작업 그리고 6개의 파일을 삭제
  1. 3 1
      include/SDL3/SDL_hints.h
  2. 8 1
      src/joystick/gdk/SDL_gameinputjoystick.c
  3. 0 4
      test/testcontroller.c

+ 3 - 1
include/SDL3/SDL_hints.h

@@ -1244,9 +1244,11 @@ extern "C" {
  *
  * The variable can be set to the following values:
  *
- * - "0": GameInput is not used. (default)
+ * - "0": GameInput is not used.
  * - "1": GameInput is used.
  *
+ * The default is "1" on GDK platforms, and "0" otherwise.
+ *
  * This hint should be set before SDL is initialized.
  *
  * \since This hint is available since SDL 3.0.0.

+ 8 - 1
src/joystick/gdk/SDL_gameinputjoystick.c

@@ -28,6 +28,13 @@
 #define COBJMACROS
 #include <gameinput.h>
 
+// Default value for SDL_HINT_JOYSTICK_GAMEINPUT
+#if defined(SDL_PLATFORM_GDK)
+#define SDL_GAMEINPUT_DEFAULT true
+#else
+#define SDL_GAMEINPUT_DEFAULT false
+#endif
+
 enum
 {
     SDL_GAMEPAD_BUTTON_GAMEINPUT_SHARE = 11
@@ -234,7 +241,7 @@ static bool GAMEINPUT_JoystickInit(void)
 {
     HRESULT hR;
 
-    if (!SDL_GetHintBoolean(SDL_HINT_JOYSTICK_GAMEINPUT, false)) {
+    if (!SDL_GetHintBoolean(SDL_HINT_JOYSTICK_GAMEINPUT, SDL_GAMEINPUT_DEFAULT)) {
         return true;
     }
 

+ 0 - 4
test/testcontroller.c

@@ -2005,10 +2005,6 @@ int main(int argc, char *argv[])
     SDL_SetHint(SDL_HINT_JOYSTICK_ALLOW_BACKGROUND_EVENTS, "1");
     SDL_SetHint(SDL_HINT_JOYSTICK_LINUX_DEADZONES, "1");
 
-#if SDL_PLATFORM_GDK
-    SDL_SetHint(SDL_HINT_JOYSTICK_GAMEINPUT, "1");
-#endif
-
     /* Enable input debug logging */
     SDL_SetLogPriority(SDL_LOG_CATEGORY_INPUT, SDL_LOG_PRIORITY_DEBUG);