1
0
Fork 0
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:
Misa 2020-03-04 18:28:39 -08:00 committed by Ethan Lee
parent a46d5b126c
commit c322ae131e
2 changed files with 9 additions and 5 deletions

View file

@ -248,6 +248,7 @@ void KeyPoll::Poll()
SDL_SetWindowFullscreen(window, 0);
}
SDL_DisableScreenSaver();
resetWindow = true;
}
else if (evt.window.event == SDL_WINDOWEVENT_FOCUS_LOST)
{
@ -260,16 +261,19 @@ void KeyPoll::Poll()
);
}
SDL_EnableScreenSaver();
resetWindow = true;
}
/* Mouse Focus */
else if (evt.window.event == SDL_WINDOWEVENT_ENTER)
{
SDL_DisableScreenSaver();
resetWindow = true;
}
else if (evt.window.event == SDL_WINDOWEVENT_LEAVE)
{
SDL_EnableScreenSaver();
resetWindow = true;
}
}

View file

@ -553,11 +553,11 @@ int main(int argc, char *argv[])
Mix_Volume(-1,MIX_MAX_VOLUME);
}
if(key.resetWindow)
{
key.resetWindow = false;
gameScreen.ResizeScreen(-1, -1);
}
if (key.resetWindow)
{
key.resetWindow = false;
gameScreen.ResizeScreen(-1, -1);
}
music.processmusic();
graphics.processfade();