# SDL: Prevent GameInput from picking up controllers when SDL\_HINT\_JOYSTICK\_GAMEINPUT is disabled

**URL:** <https://discourse.libsdl.org/t/sdl-prevent-gameinput-from-picking-up-controllers-when-sdl-hint-joystick-gameinput-is-disabled/69363>\
**Category:** SDL Commits\
**Created:** [September 21, 2026, 4:56pm UTC](https://discourse.libsdl.org/t/sdl-prevent-gameinput-from-picking-up-controllers-when-sdl-hint-joystick-gameinput-is-disabled/69363 "2026-09-21T16:56:56Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![SDLPushPostBot](https://discourse.libsdl.org/user_avatar/discourse.libsdl.org/sdlpushpostbot/32/4370_2.png) [@SDLPushPostBot](https://discourse.libsdl.org/u/SDLPushPostBot)\
**Post date:** [September 21, 2026, 4:56pm UTC](https://discourse.libsdl.org/t/sdl-prevent-gameinput-from-picking-up-controllers-when-sdl-hint-joystick-gameinput-is-disabled/69363/1 "2026-09-21T16:56:56Z")

</div>

> <https://github.com/libsdl-org/SDL/commit/c4cfb739ae66dd256ea1c16273a93994a51225db>

```diff
From c4cfb739ae66dd256ea1c16273a93994a51225db Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Mon, 21 Sep 2026 09:07:28 -0700
Subject: [PATCH] Prevent GameInput from picking up controllers when
 SDL_HINT_JOYSTICK_GAMEINPUT is disabled

---
 src/joystick/gdk/SDL_gameinputjoystick.cpp | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/joystick/gdk/SDL_gameinputjoystick.cpp b/src/joystick/gdk/SDL_gameinputjoystick.cpp
index 7ee50c06c7c2c..a92ef06ab3cf8 100644
--- a/src/joystick/gdk/SDL_gameinputjoystick.cpp
+++ b/src/joystick/gdk/SDL_gameinputjoystick.cpp
@@ -283,7 +283,11 @@ static void GAMEINPUT_InternalAddOrFind(IGameInputDevice *pDevice)
     }
 #endif
 
- if (!GAMEINPUT_InternalIsGamepad(info) && raw_type == SDL_GAMEINPUT_RAWTYPE_NONE) {
+ if (GAMEINPUT_InternalIsGamepad(info)) {
+ if (!SDL_GetHintBoolean(SDL_HINT_JOYSTICK_GAMEINPUT, SDL_GAMEINPUT_DEFAULT)) {
+ goto done;
+ }
+ } else if (raw_type == SDL_GAMEINPUT_RAWTYPE_NONE) {
 #if defined(SDL_JOYSTICK_DINPUT)
         // Let other backends handle non-gamepad controllers to possibly avoid bugs and/or regressions.
         if (SDL_GetHintBoolean(SDL_HINT_JOYSTICK_DIRECTINPUT, true)) {

```
