From eaf9488ba03c4d33ca82d20e38632b8d2a56e3b7 Mon Sep 17 00:00:00 2001 From: Alexei Kotov Date: Tue, 4 Feb 2025 20:29:53 +0300 Subject: [PATCH] Silence SDL3 window/display events coming from SDL2-compat --- components/sdlutil/sdlinputwrapper.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/components/sdlutil/sdlinputwrapper.cpp b/components/sdlutil/sdlinputwrapper.cpp index 43de84bb70..41a4f13818 100644 --- a/components/sdlutil/sdlinputwrapper.cpp +++ b/components/sdlutil/sdlinputwrapper.cpp @@ -76,6 +76,18 @@ namespace SDLUtil while (SDL_PollEvent(&evt)) { +#if SDL_VERSION_ATLEAST(2, 30, 50) + // SDL2-compat may pass us SDL3 display and window events alongside the SDL2 events for funsies + // Until we are ready to move to SDL3, we'll want to prevent the noise + + // Silence 0x151 to 0x1FF range + if (evt.type > SDL_DISPLAYEVENT && evt.type < SDL_WINDOWEVENT) + continue; + + // Silence 0x202 to 0x2FF range + if (evt.type > SDL_SYSWMEVENT && evt.type < SDL_KEYDOWN) + continue; +#endif switch (evt.type) { case SDL_MOUSEMOTION: