Move sd;_gamepad_added event from remap object to GUI object to avoid conflicts with sdl window

This commit is contained in:
rainmakerv3 2025-06-24 22:32:42 +08:00
parent db65bf48c4
commit cd4931b16f
2 changed files with 9 additions and 8 deletions

View File

@ -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);
}
}

View File

@ -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;