mirror of
https://github.com/moonlight-stream/moonlight-qt.git
synced 2026-06-17 14:11:33 +00:00
Don't batch mouse motion for Sunshine
This commit is contained in:
@@ -11,12 +11,13 @@
|
|||||||
|
|
||||||
#define MOUSE_POLLING_INTERVAL 5
|
#define MOUSE_POLLING_INTERVAL 5
|
||||||
|
|
||||||
SdlInputHandler::SdlInputHandler(StreamingPreferences& prefs, NvComputer*, int streamWidth, int streamHeight)
|
SdlInputHandler::SdlInputHandler(StreamingPreferences& prefs, NvComputer* computer, int streamWidth, int streamHeight)
|
||||||
: m_MultiController(prefs.multiController),
|
: m_MultiController(prefs.multiController),
|
||||||
m_GamepadMouse(prefs.gamepadMouse),
|
m_GamepadMouse(prefs.gamepadMouse),
|
||||||
m_SwapMouseButtons(prefs.swapMouseButtons),
|
m_SwapMouseButtons(prefs.swapMouseButtons),
|
||||||
m_ReverseScrollDirection(prefs.reverseScrollDirection),
|
m_ReverseScrollDirection(prefs.reverseScrollDirection),
|
||||||
m_SwapFaceButtons(prefs.swapFaceButtons),
|
m_SwapFaceButtons(prefs.swapFaceButtons),
|
||||||
|
m_BatchMouseMotion(computer->isNvidiaServerSoftware),
|
||||||
m_MouseMoveTimer(0),
|
m_MouseMoveTimer(0),
|
||||||
m_MousePositionLock(0),
|
m_MousePositionLock(0),
|
||||||
m_MouseWasInVideoRegion(false),
|
m_MouseWasInVideoRegion(false),
|
||||||
@@ -193,17 +194,19 @@ SdlInputHandler::SdlInputHandler(StreamingPreferences& prefs, NvComputer*, int s
|
|||||||
SDL_AtomicSet(&m_MouseDeltaY, 0);
|
SDL_AtomicSet(&m_MouseDeltaY, 0);
|
||||||
SDL_AtomicSet(&m_MousePositionUpdated, 0);
|
SDL_AtomicSet(&m_MousePositionUpdated, 0);
|
||||||
|
|
||||||
Uint32 pollingInterval = QString(qgetenv("MOUSE_POLLING_INTERVAL")).toUInt();
|
if (m_BatchMouseMotion) {
|
||||||
if (pollingInterval == 0) {
|
Uint32 pollingInterval = QString(qgetenv("MOUSE_POLLING_INTERVAL")).toUInt();
|
||||||
pollingInterval = MOUSE_POLLING_INTERVAL;
|
if (pollingInterval == 0) {
|
||||||
}
|
pollingInterval = MOUSE_POLLING_INTERVAL;
|
||||||
else {
|
}
|
||||||
SDL_LogWarn(SDL_LOG_CATEGORY_APPLICATION,
|
else {
|
||||||
"Using custom mouse polling interval: %u ms",
|
SDL_LogWarn(SDL_LOG_CATEGORY_APPLICATION,
|
||||||
pollingInterval);
|
"Using custom mouse polling interval: %u ms",
|
||||||
}
|
pollingInterval);
|
||||||
|
}
|
||||||
|
|
||||||
m_MouseMoveTimer = SDL_AddTimer(pollingInterval, SdlInputHandler::mouseMoveTimerCallback, this);
|
m_MouseMoveTimer = SDL_AddTimer(pollingInterval, SdlInputHandler::mouseMoveTimerCallback, this);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SdlInputHandler::~SdlInputHandler()
|
SdlInputHandler::~SdlInputHandler()
|
||||||
|
|||||||
@@ -147,6 +147,7 @@ private:
|
|||||||
bool m_SwapMouseButtons;
|
bool m_SwapMouseButtons;
|
||||||
bool m_ReverseScrollDirection;
|
bool m_ReverseScrollDirection;
|
||||||
bool m_SwapFaceButtons;
|
bool m_SwapFaceButtons;
|
||||||
|
bool m_BatchMouseMotion;
|
||||||
SDL_TimerID m_MouseMoveTimer;
|
SDL_TimerID m_MouseMoveTimer;
|
||||||
SDL_atomic_t m_MouseDeltaX;
|
SDL_atomic_t m_MouseDeltaX;
|
||||||
SDL_atomic_t m_MouseDeltaY;
|
SDL_atomic_t m_MouseDeltaY;
|
||||||
|
|||||||
@@ -181,14 +181,26 @@ void SdlInputHandler::handleMouseMotionEvent(SDL_MouseMotionEvent* event)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Batch until the next mouse polling window or we'll get awful
|
if (m_BatchMouseMotion) {
|
||||||
// input lag everything except GFE 3.14 and 3.15.
|
// Batch until the next mouse polling window or we'll get awful
|
||||||
if (m_AbsoluteMouseMode) {
|
// input lag everything except GFE 3.14 and 3.15.
|
||||||
updateMousePositionReport(event->x, event->y);
|
if (m_AbsoluteMouseMode) {
|
||||||
|
updateMousePositionReport(event->x, event->y);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
SDL_AtomicAdd(&m_MouseDeltaX, event->xrel);
|
||||||
|
SDL_AtomicAdd(&m_MouseDeltaY, event->yrel);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
SDL_AtomicAdd(&m_MouseDeltaX, event->xrel);
|
// On Sunshine, we can send input immediately
|
||||||
SDL_AtomicAdd(&m_MouseDeltaY, event->yrel);
|
if (m_AbsoluteMouseMode) {
|
||||||
|
updateMousePositionReport(event->x, event->y);
|
||||||
|
flushMousePositionUpdate();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
LiSendMouseMoveEvent(event->xrel, event->yrel);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user