mirror of
https://github.com/moonlight-stream/moonlight-qt
synced 2025-01-20 23:04:02 +00:00
parent
5309a02f6d
commit
1cd66419d4
4 changed files with 7 additions and 3 deletions
|
@ -27,6 +27,7 @@ SdlInputHandler::SdlInputHandler(StreamingPreferences& prefs, NvComputer*, int s
|
||||||
m_PendingMouseButtonsAllUpOnVideoRegionLeave(false),
|
m_PendingMouseButtonsAllUpOnVideoRegionLeave(false),
|
||||||
m_FakeCaptureActive(false),
|
m_FakeCaptureActive(false),
|
||||||
m_CaptureSystemKeysEnabled(prefs.captureSysKeys || !WMUtils::isRunningWindowManager()),
|
m_CaptureSystemKeysEnabled(prefs.captureSysKeys || !WMUtils::isRunningWindowManager()),
|
||||||
|
m_MouseCursorCapturedVisibilityState(SDL_DISABLE),
|
||||||
m_PendingKeyCombo(KeyComboMax),
|
m_PendingKeyCombo(KeyComboMax),
|
||||||
m_LongPressTimer(0),
|
m_LongPressTimer(0),
|
||||||
m_StreamWidth(streamWidth),
|
m_StreamWidth(streamWidth),
|
||||||
|
@ -520,7 +521,7 @@ void SdlInputHandler::setCaptureActive(bool active)
|
||||||
// If we're in relative mode, try to activate SDL's relative mouse mode
|
// If we're in relative mode, try to activate SDL's relative mouse mode
|
||||||
if (m_AbsoluteMouseMode || SDL_SetRelativeMouseMode(SDL_TRUE) < 0) {
|
if (m_AbsoluteMouseMode || SDL_SetRelativeMouseMode(SDL_TRUE) < 0) {
|
||||||
// Relative mouse mode didn't work or was disabled, so we'll just hide the cursor
|
// Relative mouse mode didn't work or was disabled, so we'll just hide the cursor
|
||||||
SDL_ShowCursor(SDL_DISABLE);
|
SDL_ShowCursor(m_MouseCursorCapturedVisibilityState);
|
||||||
m_FakeCaptureActive = true;
|
m_FakeCaptureActive = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -168,6 +168,7 @@ private:
|
||||||
QString m_OldIgnoreDevices;
|
QString m_OldIgnoreDevices;
|
||||||
QString m_OldIgnoreDevicesExcept;
|
QString m_OldIgnoreDevicesExcept;
|
||||||
bool m_CaptureSystemKeysEnabled;
|
bool m_CaptureSystemKeysEnabled;
|
||||||
|
int m_MouseCursorCapturedVisibilityState;
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
KeyCombo keyCombo;
|
KeyCombo keyCombo;
|
||||||
|
|
|
@ -72,7 +72,8 @@ void SdlInputHandler::performPendingSpecialKeyCombo()
|
||||||
"Detected show mouse combo");
|
"Detected show mouse combo");
|
||||||
|
|
||||||
if (!SDL_GetRelativeMouseMode()) {
|
if (!SDL_GetRelativeMouseMode()) {
|
||||||
SDL_ShowCursor(!SDL_ShowCursor(SDL_QUERY));
|
m_MouseCursorCapturedVisibilityState = !m_MouseCursorCapturedVisibilityState;
|
||||||
|
SDL_ShowCursor(m_MouseCursorCapturedVisibilityState);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
SDL_LogWarn(SDL_LOG_CATEGORY_APPLICATION,
|
SDL_LogWarn(SDL_LOG_CATEGORY_APPLICATION,
|
||||||
|
|
|
@ -146,7 +146,8 @@ void SdlInputHandler::flushMousePositionUpdate()
|
||||||
// executes.
|
// executes.
|
||||||
SDL_Event event;
|
SDL_Event event;
|
||||||
event.type = SDL_USEREVENT;
|
event.type = SDL_USEREVENT;
|
||||||
event.user.code = mouseInVideoRegion ? SDL_CODE_HIDE_CURSOR : SDL_CODE_SHOW_CURSOR;
|
event.user.code = (mouseInVideoRegion && m_MouseCursorCapturedVisibilityState == SDL_DISABLE) ?
|
||||||
|
SDL_CODE_HIDE_CURSOR : SDL_CODE_SHOW_CURSOR;
|
||||||
SDL_PushEvent(&event);
|
SDL_PushEvent(&event);
|
||||||
|
|
||||||
if (!mouseInVideoRegion && buttonState != 0) {
|
if (!mouseInVideoRegion && buttonState != 0) {
|
||||||
|
|
Loading…
Reference in a new issue