From cd4931b16f97a353ad7557bf391ef35f6a4891c1 Mon Sep 17 00:00:00 2001 From: rainmakerv3 <30595646+rainmakerv3@users.noreply.github.com> Date: Tue, 24 Jun 2025 22:32:42 +0800 Subject: [PATCH] Move sd;_gamepad_added event from remap object to GUI object to avoid conflicts with sdl window --- src/qt_gui/control_settings.cpp | 14 +++++++++----- src/qt_gui/sdl_event_wrapper.cpp | 3 --- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/qt_gui/control_settings.cpp b/src/qt_gui/control_settings.cpp index e743e6f2d..9f287ea60 100644 --- a/src/qt_gui/control_settings.cpp +++ b/src/qt_gui/control_settings.cpp @@ -779,11 +779,6 @@ bool ControlSettings::eventFilter(QObject* obj, QEvent* event) { } void ControlSettings::processSDLEvents(int Type, int Input, int Value) { - if (Type == SDL_EVENT_GAMEPAD_ADDED) { - if (!GameRunning) - CheckGamePad(); - } - if (EnableButtonMapping) { if (Type == SDL_EVENT_GAMEPAD_BUTTON_DOWN) { switch (Input) { @@ -891,10 +886,19 @@ void ControlSettings::processSDLEvents(int Type, int Input, int Value) { void ControlSettings::pollSDLEvents() { SDL_Event event; while (SdlEventWrapper::Wrapper::wrapperActive) { + if (!SDL_WaitEvent(&event)) { return; } + if (event.type == SDL_EVENT_QUIT) { + return; + } + + if (event.type == SDL_EVENT_GAMEPAD_ADDED) { + CheckGamePad(); + } + SdlEventWrapper::Wrapper::GetInstance()->Wrapper::ProcessEvent(&event); } } diff --git a/src/qt_gui/sdl_event_wrapper.cpp b/src/qt_gui/sdl_event_wrapper.cpp index 736a29ea8..c45d4d448 100644 --- a/src/qt_gui/sdl_event_wrapper.cpp +++ b/src/qt_gui/sdl_event_wrapper.cpp @@ -22,9 +22,6 @@ bool Wrapper::ProcessEvent(SDL_Event* event) { case SDL_EVENT_QUIT: emit SDLEvent(SDL_EVENT_QUIT, 0, 0); return true; - case SDL_EVENT_GAMEPAD_ADDED: - emit SDLEvent(SDL_EVENT_GAMEPAD_ADDED, 0, 0); - return true; case SDL_EVENT_GAMEPAD_BUTTON_DOWN: emit SDLEvent(SDL_EVENT_GAMEPAD_BUTTON_DOWN, event->gbutton.button, 0); return true;