mirror of
https://github.com/TerryCavanagh/VVVVVV.git
synced 2024-12-22 17:49:43 +01:00
Fix unfocusing the game while in fullscreen mode
If you Alt+Tabbed while in fullscreen mode, the game would stay in fullscreen instead of switching to windowed, but there was a chance it would EITHER use the same internal resolution which would mismatch the window resolution (don't know when exactly this happens, but still) and stay being in an actual windowed mode, OR switch between fullscreen/windowed every other time you re-focused the window, which is annoying. Now, whenever you Alt+Tab in fullscreen, the game will be in windowed mode, and then when you re-focus it will go back to fullscreen. Consistently.
This commit is contained in:
parent
a46d5b126c
commit
c322ae131e
2 changed files with 9 additions and 5 deletions
|
@ -248,6 +248,7 @@ void KeyPoll::Poll()
|
||||||
SDL_SetWindowFullscreen(window, 0);
|
SDL_SetWindowFullscreen(window, 0);
|
||||||
}
|
}
|
||||||
SDL_DisableScreenSaver();
|
SDL_DisableScreenSaver();
|
||||||
|
resetWindow = true;
|
||||||
}
|
}
|
||||||
else if (evt.window.event == SDL_WINDOWEVENT_FOCUS_LOST)
|
else if (evt.window.event == SDL_WINDOWEVENT_FOCUS_LOST)
|
||||||
{
|
{
|
||||||
|
@ -260,16 +261,19 @@ void KeyPoll::Poll()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
SDL_EnableScreenSaver();
|
SDL_EnableScreenSaver();
|
||||||
|
resetWindow = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Mouse Focus */
|
/* Mouse Focus */
|
||||||
else if (evt.window.event == SDL_WINDOWEVENT_ENTER)
|
else if (evt.window.event == SDL_WINDOWEVENT_ENTER)
|
||||||
{
|
{
|
||||||
SDL_DisableScreenSaver();
|
SDL_DisableScreenSaver();
|
||||||
|
resetWindow = true;
|
||||||
}
|
}
|
||||||
else if (evt.window.event == SDL_WINDOWEVENT_LEAVE)
|
else if (evt.window.event == SDL_WINDOWEVENT_LEAVE)
|
||||||
{
|
{
|
||||||
SDL_EnableScreenSaver();
|
SDL_EnableScreenSaver();
|
||||||
|
resetWindow = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -553,11 +553,11 @@ int main(int argc, char *argv[])
|
||||||
Mix_Volume(-1,MIX_MAX_VOLUME);
|
Mix_Volume(-1,MIX_MAX_VOLUME);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(key.resetWindow)
|
if (key.resetWindow)
|
||||||
{
|
{
|
||||||
key.resetWindow = false;
|
key.resetWindow = false;
|
||||||
gameScreen.ResizeScreen(-1, -1);
|
gameScreen.ResizeScreen(-1, -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
music.processmusic();
|
music.processmusic();
|
||||||
graphics.processfade();
|
graphics.processfade();
|
||||||
|
|
Loading…
Reference in a new issue