mirror of
https://github.com/moonlight-stream/moonlight-qt.git
synced 2026-06-16 21:51:17 +00:00
Auto-lock the cursor in single display borderless windowed scenarios
This commit is contained in:
@@ -269,8 +269,10 @@ void SdlInputHandler::updatePointerRegionLock()
|
|||||||
// toggled it themselves using the keyboard shortcut. If that's the case, they
|
// toggled it themselves using the keyboard shortcut. If that's the case, they
|
||||||
// have full control over it and we don't touch it anymore.
|
// have full control over it and we don't touch it anymore.
|
||||||
if (!m_PointerRegionLockToggledByUser) {
|
if (!m_PointerRegionLockToggledByUser) {
|
||||||
// Lock the pointer in true full-screen mode and leave it unlocked in other modes
|
// Lock the pointer in true full-screen mode or in any fullscreen mode when only a single monitor is present
|
||||||
m_PointerRegionLockActive = (SDL_GetWindowFlags(m_Window) & SDL_WINDOW_FULLSCREEN_DESKTOP) == SDL_WINDOW_FULLSCREEN;
|
Uint32 fullscreenFlags = SDL_GetWindowFlags(m_Window) & SDL_WINDOW_FULLSCREEN_DESKTOP;
|
||||||
|
m_PointerRegionLockActive = (fullscreenFlags == SDL_WINDOW_FULLSCREEN) ||
|
||||||
|
(fullscreenFlags != 0 && SDL_GetNumVideoDisplays() == 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
// If region lock is enabled, grab the cursor so it can't accidentally leave our window.
|
// If region lock is enabled, grab the cursor so it can't accidentally leave our window.
|
||||||
|
|||||||
@@ -2351,6 +2351,13 @@ void Session::execInternal()
|
|||||||
case SDL_FINGERUP:
|
case SDL_FINGERUP:
|
||||||
m_InputHandler->handleTouchFingerEvent(&event.tfinger);
|
m_InputHandler->handleTouchFingerEvent(&event.tfinger);
|
||||||
break;
|
break;
|
||||||
|
case SDL_DISPLAYEVENT:
|
||||||
|
switch (event.display.event) {
|
||||||
|
case SDL_DISPLAYEVENT_CONNECTED:
|
||||||
|
case SDL_DISPLAYEVENT_DISCONNECTED:
|
||||||
|
m_InputHandler->updatePointerRegionLock();
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user