From 5a8dae56837010153f89541f421faa9d7278498b Mon Sep 17 00:00:00 2001
From: Cameron Gutman <[EMAIL REDACTED]>
Date: Fri, 28 Mar 2025 16:56:58 -0500
Subject: [PATCH] events: Disable joystick/gamepad update complete events
There is no SDL2 equivalent of these, so it just needlessly wastes CPU time to generate them.
---
src/sdl2_compat.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/src/sdl2_compat.c b/src/sdl2_compat.c
index dccb665..49947ad 100644
--- a/src/sdl2_compat.c
+++ b/src/sdl2_compat.c
@@ -6773,6 +6773,10 @@ static void PostInitSubsystem(SDL_InitFlags new_flags)
if (new_flags & SDL_INIT_EVENTS) {
(void)SDL_EventState(SDL2_SYSWMEVENT, SDL2_DISABLE);
+ /* These are potentially noisy and have no SDL2 equivalent */
+ SDL3_SetEventEnabled(SDL_EVENT_JOYSTICK_UPDATE_COMPLETE, false);
+ SDL3_SetEventEnabled(SDL_EVENT_GAMEPAD_UPDATE_COMPLETE, false);
+
/* SDL_GetRelativeMouseState() resets when the event subsystem initializes */
relative_mouse_state_x_frac = 0.0f;
relative_mouse_state_y_frac = 0.0f;