mirror of
https://github.com/moonlight-stream/moonlight-qt
synced 2025-03-04 22:57:14 +00:00
Confine the cursor to the window in full-screen exclusive mode
This commit is contained in:
parent
e44d8ac7e9
commit
65d53e800b
1 changed files with 14 additions and 0 deletions
|
@ -863,10 +863,18 @@ void Session::toggleFullscreen()
|
|||
bool fullScreen = !(SDL_GetWindowFlags(m_Window) & m_FullScreenFlag);
|
||||
|
||||
if (fullScreen) {
|
||||
if (m_FullScreenFlag == SDL_WINDOW_FULLSCREEN) {
|
||||
// Confine the cursor to the window
|
||||
SDL_SetWindowGrab(m_Window, SDL_TRUE);
|
||||
}
|
||||
|
||||
SDL_SetWindowResizable(m_Window, SDL_FALSE);
|
||||
SDL_SetWindowFullscreen(m_Window, m_FullScreenFlag);
|
||||
}
|
||||
else {
|
||||
// Unconfine the cursor
|
||||
SDL_SetWindowGrab(m_Window, SDL_FALSE);
|
||||
|
||||
SDL_SetWindowFullscreen(m_Window, 0);
|
||||
SDL_SetWindowResizable(m_Window, SDL_TRUE);
|
||||
|
||||
|
@ -1106,6 +1114,11 @@ void Session::exec(int displayOriginX, int displayOriginY)
|
|||
SDL_SetWindowResizable(m_Window, SDL_TRUE);
|
||||
}
|
||||
else {
|
||||
if (m_FullScreenFlag == SDL_WINDOW_FULLSCREEN) {
|
||||
// Confine the cursor to the window
|
||||
SDL_SetWindowGrab(m_Window, SDL_TRUE);
|
||||
}
|
||||
|
||||
// Update the window display mode based on our current monitor
|
||||
updateOptimalWindowDisplayMode();
|
||||
|
||||
|
@ -1362,6 +1375,7 @@ DispatchDeferredCleanup:
|
|||
// Uncapture the mouse and hide the window immediately,
|
||||
// so we can return to the Qt GUI ASAP.
|
||||
m_InputHandler->setCaptureActive(false);
|
||||
SDL_SetWindowGrab(m_Window, SDL_FALSE);
|
||||
SDL_EnableScreenSaver();
|
||||
SDL_SetHint(SDL_HINT_TIMER_RESOLUTION, "0");
|
||||
if (QGuiApplication::platformName() == "eglfs") {
|
||||
|
|
Loading…
Add table
Reference in a new issue