diff --git a/app/gui/SettingsView.qml b/app/gui/SettingsView.qml index 71422d22..d29e6ad9 100644 --- a/app/gui/SettingsView.qml +++ b/app/gui/SettingsView.qml @@ -567,6 +567,22 @@ Flickable { ToolTip.visible: hovered ToolTip.text: "When checked, mouse input is not accelerated or scaled by the OS before passing to Moonlight" } + + CheckBox { + id: gamepadMouseCheck + hoverEnabled: true + text: "Gamepad mouse mode support" + font.pointSize: 12 + checked: StreamingPreferences.gamepadMouse + onCheckedChanged: { + StreamingPreferences.gamepadMouse = checked + } + + ToolTip.delay: 1000 + ToolTip.timeout: 3000 + ToolTip.visible: hovered + ToolTip.text: "When enabled, holding the Start button will toggle mouse mode" + } } } diff --git a/app/settings/streamingpreferences.cpp b/app/settings/streamingpreferences.cpp index f4464be3..47097b80 100644 --- a/app/settings/streamingpreferences.cpp +++ b/app/settings/streamingpreferences.cpp @@ -24,6 +24,7 @@ #define SER_FRAMEPACING "framepacing" #define SER_CONNWARNINGS "connwarnings" #define SER_RICHPRESENCE "richpresence" +#define SER_GAMEPADMOUSE "gamepadmouse" StreamingPreferences::StreamingPreferences(QObject *parent) : QObject(parent) @@ -57,6 +58,7 @@ void StreamingPreferences::reload() framePacing = settings.value(SER_FRAMEPACING, false).toBool(); connectionWarnings = settings.value(SER_CONNWARNINGS, true).toBool(); richPresence = settings.value(SER_RICHPRESENCE, true).toBool(); + gamepadMouse = settings.value(SER_GAMEPADMOUSE, true).toBool(); audioConfig = static_cast(settings.value(SER_AUDIOCFG, static_cast(AudioConfig::AC_STEREO)).toInt()); videoCodecConfig = static_cast(settings.value(SER_VIDEOCFG, @@ -89,6 +91,7 @@ void StreamingPreferences::save() settings.setValue(SER_FRAMEPACING, framePacing); settings.setValue(SER_CONNWARNINGS, connectionWarnings); settings.setValue(SER_RICHPRESENCE, richPresence); + settings.setValue(SER_GAMEPADMOUSE, gamepadMouse); settings.setValue(SER_AUDIOCFG, static_cast(audioConfig)); settings.setValue(SER_VIDEOCFG, static_cast(videoCodecConfig)); settings.setValue(SER_VIDEODEC, static_cast(videoDecoderSelection)); diff --git a/app/settings/streamingpreferences.h b/app/settings/streamingpreferences.h index 531ab3c0..93e10efb 100644 --- a/app/settings/streamingpreferences.h +++ b/app/settings/streamingpreferences.h @@ -64,7 +64,8 @@ public: Q_PROPERTY(bool startWindowed MEMBER startWindowed NOTIFY startWindowedChanged) Q_PROPERTY(bool framePacing MEMBER framePacing NOTIFY framePacingChanged) Q_PROPERTY(bool connectionWarnings MEMBER connectionWarnings NOTIFY connectionWarningsChanged) - Q_PROPERTY(bool richPresence MEMBER richPresence NOTIFY richPresenceChanged); + Q_PROPERTY(bool richPresence MEMBER richPresence NOTIFY richPresenceChanged) + Q_PROPERTY(bool gamepadMouse MEMBER gamepadMouse NOTIFY gamepadMouseChanged) Q_PROPERTY(AudioConfig audioConfig MEMBER audioConfig NOTIFY audioConfigChanged) Q_PROPERTY(VideoCodecConfig videoCodecConfig MEMBER videoCodecConfig NOTIFY videoCodecConfigChanged) Q_PROPERTY(VideoDecoderSelection videoDecoderSelection MEMBER videoDecoderSelection NOTIFY videoDecoderSelectionChanged) @@ -88,6 +89,7 @@ public: bool framePacing; bool connectionWarnings; bool richPresence; + bool gamepadMouse; AudioConfig audioConfig; VideoCodecConfig videoCodecConfig; VideoDecoderSelection videoDecoderSelection; @@ -113,5 +115,6 @@ signals: void framePacingChanged(); void connectionWarningsChanged(); void richPresenceChanged(); + void gamepadMouseChanged(); }; diff --git a/app/streaming/input.cpp b/app/streaming/input.cpp index baf397de..d93541db 100644 --- a/app/streaming/input.cpp +++ b/app/streaming/input.cpp @@ -51,6 +51,7 @@ const int SdlInputHandler::k_ButtonMap[] = { SdlInputHandler::SdlInputHandler(StreamingPreferences& prefs, NvComputer*, int streamWidth, int streamHeight) : m_MultiController(prefs.multiController), + m_GamepadMouse(prefs.gamepadMouse), m_MouseMoveTimer(0), m_LeftButtonReleaseTimer(0), m_RightButtonReleaseTimer(0), @@ -839,7 +840,7 @@ void SdlInputHandler::handleControllerButtonEvent(SDL_ControllerButtonEvent* eve "Mouse emulation deactivated"); Session::get()->notifyMouseEmulationMode(false); } - else { + else if (m_GamepadMouse) { // Send the start button up event to the host, since we won't do it below sendGamepadState(state); diff --git a/app/streaming/input.h b/app/streaming/input.h index 37dc41bc..79281738 100644 --- a/app/streaming/input.h +++ b/app/streaming/input.h @@ -89,6 +89,7 @@ private: Uint32 mouseEmulationTimerCallback(Uint32 interval, void* param); bool m_MultiController; + bool m_GamepadMouse; SDL_TimerID m_MouseMoveTimer; SDL_atomic_t m_MouseDeltaX; SDL_atomic_t m_MouseDeltaY;