BACKENDS: OPENGLSDL: Remember maximized window state

This commit is contained in:
Lothar Serra Mari 2021-08-20 18:43:26 +02:00 committed by Eugene Sandulenko
parent e94b88f586
commit d07c97f3cd

View file

@ -305,9 +305,11 @@ void OpenGLSdlGraphicsManager::notifyResize(const int width, const int height) {
if (SDL_GetWindowFlags(_window->getSDLWindow()) & SDL_WINDOW_MAXIMIZED) {
ConfMan.setInt("window_maximized_width", currentWidth, Common::ConfigManager::kApplicationDomain);
ConfMan.setInt("window_maximized_height", currentHeight, Common::ConfigManager::kApplicationDomain);
ConfMan.setBool("window_maximized", true, Common::ConfigManager::kApplicationDomain);
} else {
ConfMan.setInt("last_window_width", currentWidth, Common::ConfigManager::kApplicationDomain);
ConfMan.setInt("last_window_height", currentHeight, Common::ConfigManager::kApplicationDomain);
ConfMan.setBool("window_maximized", false, Common::ConfigManager::kApplicationDomain);
}
ConfMan.flushToDisk();
}
@ -513,6 +515,10 @@ bool OpenGLSdlGraphicsManager::setupMode(uint width, uint height) {
flags |= SDL_WINDOW_FULLSCREEN_DESKTOP;
}
if (ConfMan.getBool("window_maximized", Common::ConfigManager::kApplicationDomain)) {
flags |= SDL_WINDOW_MAXIMIZED;
}
// Request a OpenGL (ES) context we can use.
SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, _glContextProfileMask);
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, _glContextMajor);