From 785618afec8226cfba17288a6c02b728b66259a1 Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Wed, 8 Apr 2015 02:14:59 -0400 Subject: [PATCH] DirectInput: ignore everything but joysticks and gamepads (thanks, Justin!). Fixes Bugzilla #2460. --- src/joystick/windows/SDL_dinputjoystick.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/joystick/windows/SDL_dinputjoystick.c b/src/joystick/windows/SDL_dinputjoystick.c index 179f99283e860..d5456c7563df6 100644 --- a/src/joystick/windows/SDL_dinputjoystick.c +++ b/src/joystick/windows/SDL_dinputjoystick.c @@ -345,6 +345,11 @@ EnumJoysticksCallback(const DIDEVICEINSTANCE * pdidInstance, VOID * pContext) return DIENUM_CONTINUE; /* ignore XInput devices here, keep going. */ } + const DWORD devtype = (pdidInstance->dwDevType & 0xFF); + if ((devtype != DI8DEVTYPE_JOYSTICK) && (devtype != DI8DEVTYPE_GAMEPAD)) { + return DIENUM_CONTINUE; /* Ignore touchpads, etc. */ + } + pNewJoystick = *(JoyStick_DeviceData **)pContext; while (pNewJoystick) { if (!SDL_memcmp(&pNewJoystick->dxdevice.guidInstance, &pdidInstance->guidInstance, sizeof(pNewJoystick->dxdevice.guidInstance))) {