mirror of
https://github.com/moonlight-stream/moonlight-qt
synced 2024-12-14 21:32:27 +00:00
Change raw input checkbox to adjust absolute vs relative mouse mode
This commit is contained in:
parent
07128cc7fe
commit
80bfd3b8e9
5 changed files with 19 additions and 18 deletions
|
@ -297,7 +297,7 @@ void StreamCommandLineParser::parse(const QStringList &args, StreamingPreference
|
||||||
parser.addChoiceOption("audio-config", "audio config", m_AudioConfigMap.keys());
|
parser.addChoiceOption("audio-config", "audio config", m_AudioConfigMap.keys());
|
||||||
parser.addToggleOption("multi-controller", "multiple controller support");
|
parser.addToggleOption("multi-controller", "multiple controller support");
|
||||||
parser.addToggleOption("quit-after", "quit app after session");
|
parser.addToggleOption("quit-after", "quit app after session");
|
||||||
parser.addToggleOption("mouse-acceleration", "mouse acceleration");
|
parser.addToggleOption("absolute-mouse", "enable direct mouse control (best for remote desktop rather than games)");
|
||||||
parser.addToggleOption("game-optimization", "game optimizations");
|
parser.addToggleOption("game-optimization", "game optimizations");
|
||||||
parser.addToggleOption("audio-on-host", "audio on host PC");
|
parser.addToggleOption("audio-on-host", "audio on host PC");
|
||||||
parser.addToggleOption("frame-pacing", "frame pacing");
|
parser.addToggleOption("frame-pacing", "frame pacing");
|
||||||
|
@ -385,8 +385,8 @@ void StreamCommandLineParser::parse(const QStringList &args, StreamingPreference
|
||||||
// Resolve --quit-after and --no-quit-after options
|
// Resolve --quit-after and --no-quit-after options
|
||||||
preferences->quitAppAfter = parser.getToggleOptionValue("quit-after", preferences->quitAppAfter);
|
preferences->quitAppAfter = parser.getToggleOptionValue("quit-after", preferences->quitAppAfter);
|
||||||
|
|
||||||
// Resolve --mouse-acceleration and --no-mouse-acceleration options
|
// Resolve --absolute-mouse and --no-absolute-mouse options
|
||||||
preferences->mouseAcceleration = parser.getToggleOptionValue("mouse-acceleration", preferences->mouseAcceleration);
|
preferences->absoluteMouseMode = parser.getToggleOptionValue("absolute-mouse", preferences->absoluteMouseMode);
|
||||||
|
|
||||||
// Resolve --game-optimization and --no-game-optimization options
|
// Resolve --game-optimization and --no-game-optimization options
|
||||||
preferences->gameOptimizations = parser.getToggleOptionValue("game-optimization", preferences->gameOptimizations);
|
preferences->gameOptimizations = parser.getToggleOptionValue("game-optimization", preferences->gameOptimizations);
|
||||||
|
|
|
@ -579,19 +579,20 @@ Flickable {
|
||||||
}
|
}
|
||||||
|
|
||||||
CheckBox {
|
CheckBox {
|
||||||
id: rawInputCheck
|
id: absoluteMouseCheck
|
||||||
hoverEnabled: true
|
hoverEnabled: true
|
||||||
text: "Raw mouse input"
|
text: "Optimize mouse for remote desktop instead of games"
|
||||||
font.pointSize: 12
|
font.pointSize: 12
|
||||||
checked: !StreamingPreferences.mouseAcceleration
|
checked: StreamingPreferences.absoluteMouseMode
|
||||||
onCheckedChanged: {
|
onCheckedChanged: {
|
||||||
StreamingPreferences.mouseAcceleration = !checked
|
StreamingPreferences.absoluteMouseMode = checked
|
||||||
}
|
}
|
||||||
|
|
||||||
ToolTip.delay: 1000
|
ToolTip.delay: 1000
|
||||||
ToolTip.timeout: 3000
|
ToolTip.timeout: 5000
|
||||||
ToolTip.visible: hovered
|
ToolTip.visible: hovered
|
||||||
ToolTip.text: "When checked, mouse input is not accelerated or scaled by the OS before passing to Moonlight"
|
ToolTip.text: "This enables mouse control without capturing the client's mouse cursor. It will not work in most games.\n
|
||||||
|
You can toggle this while streaming using Ctrl+Alt+Shift+M."
|
||||||
}
|
}
|
||||||
|
|
||||||
CheckBox {
|
CheckBox {
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
#define SER_UNSUPPORTEDFPS "unsupportedfps"
|
#define SER_UNSUPPORTEDFPS "unsupportedfps"
|
||||||
#define SER_MDNS "mdns"
|
#define SER_MDNS "mdns"
|
||||||
#define SER_QUITAPPAFTER "quitAppAfter"
|
#define SER_QUITAPPAFTER "quitAppAfter"
|
||||||
#define SER_MOUSEACCELERATION "mouseacceleration"
|
#define SER_ABSMOUSEMODE "mouseacceleration"
|
||||||
#define SER_STARTWINDOWED "startwindowed"
|
#define SER_STARTWINDOWED "startwindowed"
|
||||||
#define SER_FRAMEPACING "framepacing"
|
#define SER_FRAMEPACING "framepacing"
|
||||||
#define SER_CONNWARNINGS "connwarnings"
|
#define SER_CONNWARNINGS "connwarnings"
|
||||||
|
@ -59,7 +59,7 @@ void StreamingPreferences::reload()
|
||||||
unsupportedFps = settings.value(SER_UNSUPPORTEDFPS, false).toBool();
|
unsupportedFps = settings.value(SER_UNSUPPORTEDFPS, false).toBool();
|
||||||
enableMdns = settings.value(SER_MDNS, true).toBool();
|
enableMdns = settings.value(SER_MDNS, true).toBool();
|
||||||
quitAppAfter = settings.value(SER_QUITAPPAFTER, false).toBool();
|
quitAppAfter = settings.value(SER_QUITAPPAFTER, false).toBool();
|
||||||
mouseAcceleration = settings.value(SER_MOUSEACCELERATION, false).toBool();
|
absoluteMouseMode = settings.value(SER_ABSMOUSEMODE, false).toBool();
|
||||||
startWindowed = settings.value(SER_STARTWINDOWED, false).toBool();
|
startWindowed = settings.value(SER_STARTWINDOWED, false).toBool();
|
||||||
framePacing = settings.value(SER_FRAMEPACING, false).toBool();
|
framePacing = settings.value(SER_FRAMEPACING, false).toBool();
|
||||||
connectionWarnings = settings.value(SER_CONNWARNINGS, true).toBool();
|
connectionWarnings = settings.value(SER_CONNWARNINGS, true).toBool();
|
||||||
|
@ -103,7 +103,7 @@ void StreamingPreferences::save()
|
||||||
settings.setValue(SER_UNSUPPORTEDFPS, unsupportedFps);
|
settings.setValue(SER_UNSUPPORTEDFPS, unsupportedFps);
|
||||||
settings.setValue(SER_MDNS, enableMdns);
|
settings.setValue(SER_MDNS, enableMdns);
|
||||||
settings.setValue(SER_QUITAPPAFTER, quitAppAfter);
|
settings.setValue(SER_QUITAPPAFTER, quitAppAfter);
|
||||||
settings.setValue(SER_MOUSEACCELERATION, mouseAcceleration);
|
settings.setValue(SER_ABSMOUSEMODE, absoluteMouseMode);
|
||||||
settings.setValue(SER_STARTWINDOWED, startWindowed);
|
settings.setValue(SER_STARTWINDOWED, startWindowed);
|
||||||
settings.setValue(SER_FRAMEPACING, framePacing);
|
settings.setValue(SER_FRAMEPACING, framePacing);
|
||||||
settings.setValue(SER_CONNWARNINGS, connectionWarnings);
|
settings.setValue(SER_CONNWARNINGS, connectionWarnings);
|
||||||
|
|
|
@ -61,7 +61,7 @@ public:
|
||||||
Q_PROPERTY(bool unsupportedFps MEMBER unsupportedFps NOTIFY unsupportedFpsChanged)
|
Q_PROPERTY(bool unsupportedFps MEMBER unsupportedFps NOTIFY unsupportedFpsChanged)
|
||||||
Q_PROPERTY(bool enableMdns MEMBER enableMdns NOTIFY enableMdnsChanged)
|
Q_PROPERTY(bool enableMdns MEMBER enableMdns NOTIFY enableMdnsChanged)
|
||||||
Q_PROPERTY(bool quitAppAfter MEMBER quitAppAfter NOTIFY quitAppAfterChanged)
|
Q_PROPERTY(bool quitAppAfter MEMBER quitAppAfter NOTIFY quitAppAfterChanged)
|
||||||
Q_PROPERTY(bool mouseAcceleration MEMBER mouseAcceleration NOTIFY mouseAccelerationChanged)
|
Q_PROPERTY(bool absoluteMouseMode MEMBER absoluteMouseMode NOTIFY absoluteMouseModeChanged)
|
||||||
Q_PROPERTY(bool startWindowed MEMBER startWindowed NOTIFY startWindowedChanged)
|
Q_PROPERTY(bool startWindowed MEMBER startWindowed NOTIFY startWindowedChanged)
|
||||||
Q_PROPERTY(bool framePacing MEMBER framePacing NOTIFY framePacingChanged)
|
Q_PROPERTY(bool framePacing MEMBER framePacing NOTIFY framePacingChanged)
|
||||||
Q_PROPERTY(bool connectionWarnings MEMBER connectionWarnings NOTIFY connectionWarningsChanged)
|
Q_PROPERTY(bool connectionWarnings MEMBER connectionWarnings NOTIFY connectionWarningsChanged)
|
||||||
|
@ -85,7 +85,7 @@ public:
|
||||||
bool unsupportedFps;
|
bool unsupportedFps;
|
||||||
bool enableMdns;
|
bool enableMdns;
|
||||||
bool quitAppAfter;
|
bool quitAppAfter;
|
||||||
bool mouseAcceleration;
|
bool absoluteMouseMode;
|
||||||
bool startWindowed;
|
bool startWindowed;
|
||||||
bool framePacing;
|
bool framePacing;
|
||||||
bool connectionWarnings;
|
bool connectionWarnings;
|
||||||
|
@ -108,7 +108,7 @@ signals:
|
||||||
void unsupportedFpsChanged();
|
void unsupportedFpsChanged();
|
||||||
void enableMdnsChanged();
|
void enableMdnsChanged();
|
||||||
void quitAppAfterChanged();
|
void quitAppAfterChanged();
|
||||||
void mouseAccelerationChanged();
|
void absoluteMouseModeChanged();
|
||||||
void audioConfigChanged();
|
void audioConfigChanged();
|
||||||
void videoCodecConfigChanged();
|
void videoCodecConfigChanged();
|
||||||
void videoDecoderSelectionChanged();
|
void videoDecoderSelectionChanged();
|
||||||
|
|
|
@ -66,17 +66,17 @@ SdlInputHandler::SdlInputHandler(StreamingPreferences& prefs, NvComputer*, int s
|
||||||
m_LongPressTimer(0),
|
m_LongPressTimer(0),
|
||||||
m_StreamWidth(streamWidth),
|
m_StreamWidth(streamWidth),
|
||||||
m_StreamHeight(streamHeight),
|
m_StreamHeight(streamHeight),
|
||||||
m_AbsoluteMouseMode(false)
|
m_AbsoluteMouseMode(prefs.absoluteMouseMode)
|
||||||
{
|
{
|
||||||
// Allow gamepad input when the app doesn't have focus
|
// Allow gamepad input when the app doesn't have focus
|
||||||
SDL_SetHint(SDL_HINT_JOYSTICK_ALLOW_BACKGROUND_EVENTS, "1");
|
SDL_SetHint(SDL_HINT_JOYSTICK_ALLOW_BACKGROUND_EVENTS, "1");
|
||||||
|
|
||||||
// If mouse acceleration is enabled, use relative mode warp (which
|
// If absolute mouse mode is enabled, use relative mode warp (which
|
||||||
// is via normal motion events that are influenced by mouse acceleration).
|
// is via normal motion events that are influenced by mouse acceleration).
|
||||||
// Otherwise, we'll use raw input capture which is straight from the device
|
// Otherwise, we'll use raw input capture which is straight from the device
|
||||||
// without modification by the OS.
|
// without modification by the OS.
|
||||||
SDL_SetHintWithPriority(SDL_HINT_MOUSE_RELATIVE_MODE_WARP,
|
SDL_SetHintWithPriority(SDL_HINT_MOUSE_RELATIVE_MODE_WARP,
|
||||||
prefs.mouseAcceleration ? "1" : "0",
|
prefs.absoluteMouseMode ? "1" : "0",
|
||||||
SDL_HINT_OVERRIDE);
|
SDL_HINT_OVERRIDE);
|
||||||
|
|
||||||
#if defined(Q_OS_DARWIN) && !SDL_VERSION_ATLEAST(2, 0, 10)
|
#if defined(Q_OS_DARWIN) && !SDL_VERSION_ATLEAST(2, 0, 10)
|
||||||
|
|
Loading…
Reference in a new issue