From 6a9ac1cacdcea501468a9ac0bca0447524db5d46 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Sat, 20 Sep 2025 11:13:39 -0700 Subject: [PATCH] Always poll udev on supported platforms Fixes https://github.com/libsdl-org/SDL/issues/13995 --- src/core/linux/SDL_evdev.c | 4 ---- src/events/SDL_events.c | 5 +++++ src/joystick/linux/SDL_sysjoystick.c | 2 +- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/core/linux/SDL_evdev.c b/src/core/linux/SDL_evdev.c index b25afe1ff0..a966bfcfaf 100644 --- a/src/core/linux/SDL_evdev.c +++ b/src/core/linux/SDL_evdev.c @@ -322,10 +322,6 @@ void SDL_EVDEV_Poll(void) return; } -#ifdef SDL_USE_LIBUDEV - SDL_UDEV_Poll(); -#endif - SDL_EVDEV_kbd_update(_this->kbd); mouse = SDL_GetMouse(); diff --git a/src/events/SDL_events.c b/src/events/SDL_events.c index 93e5d51e6b..35e460df22 100644 --- a/src/events/SDL_events.c +++ b/src/events/SDL_events.c @@ -29,6 +29,7 @@ #include "../audio/SDL_audio_c.h" #include "../camera/SDL_camera_c.h" #include "../timer/SDL_timer_c.h" +#include "../core/linux/SDL_udev.h" #ifndef SDL_JOYSTICK_DISABLED #include "../joystick/SDL_joystick_c.h" #endif @@ -1423,6 +1424,10 @@ bool SDL_RunOnMainThread(SDL_MainThreadCallback callback, void *userdata, bool w void SDL_PumpEventMaintenance(void) { +#ifdef SDL_USE_LIBUDEV + SDL_UDEV_Poll(); +#endif + #ifndef SDL_AUDIO_DISABLED SDL_UpdateAudio(); #endif diff --git a/src/joystick/linux/SDL_sysjoystick.c b/src/joystick/linux/SDL_sysjoystick.c index 224a3dce37..dba4d2258c 100644 --- a/src/joystick/linux/SDL_sysjoystick.c +++ b/src/joystick/linux/SDL_sysjoystick.c @@ -973,7 +973,7 @@ static void LINUX_JoystickDetect(void) { #ifdef SDL_USE_LIBUDEV if (enumeration_method == ENUMERATION_LIBUDEV) { - SDL_UDEV_Poll(); + // Polling will happen in the main event loop } else #endif #ifdef HAVE_INOTIFY