From cf544a870333f653de0eef0e2f198fd278fa9ffc Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Sun, 31 Mar 2024 14:54:36 -0500 Subject: [PATCH] Don't reload preferences every time we poll for GUI gamepad input --- app/gui/sdlgamepadkeynavigation.cpp | 4 +--- app/gui/sdlgamepadkeynavigation.h | 3 +++ 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/app/gui/sdlgamepadkeynavigation.cpp b/app/gui/sdlgamepadkeynavigation.cpp index 4f457d1e..f0bd3433 100644 --- a/app/gui/sdlgamepadkeynavigation.cpp +++ b/app/gui/sdlgamepadkeynavigation.cpp @@ -4,7 +4,6 @@ #include #include -#include "settings/streamingpreferences.h" #include "settings/mappingmanager.h" #define AXIS_NAVIGATION_REPEAT_DELAY 150 @@ -93,7 +92,6 @@ void SdlGamepadKeyNavigation::disable() void SdlGamepadKeyNavigation::onPollingTimerFired() { SDL_Event event; - StreamingPreferences prefs; // Discard any pending button events on the first poll to avoid picking up // stale input data from the stream session (like the quit combo). @@ -121,7 +119,7 @@ void SdlGamepadKeyNavigation::onPollingTimerFired() QEvent::Type::KeyPress : QEvent::Type::KeyRelease; // Swap face buttons if needed - if (prefs.swapFaceButtons) { + if (m_Prefs.swapFaceButtons) { switch (event.cbutton.button) { case SDL_CONTROLLER_BUTTON_A: event.cbutton.button = SDL_CONTROLLER_BUTTON_B; diff --git a/app/gui/sdlgamepadkeynavigation.h b/app/gui/sdlgamepadkeynavigation.h index 4fcb1c32..feb6cf3c 100644 --- a/app/gui/sdlgamepadkeynavigation.h +++ b/app/gui/sdlgamepadkeynavigation.h @@ -5,6 +5,8 @@ #include +#include "settings/streamingpreferences.h" + class SdlGamepadKeyNavigation : public QObject { Q_OBJECT @@ -35,4 +37,5 @@ private: bool m_UiNavMode; bool m_FirstPoll; Uint32 m_LastAxisNavigationEventTime; + StreamingPreferences m_Prefs; };