From 0f5ec6c0b4f0470e681e0929b66b20a1be83688c Mon Sep 17 00:00:00 2001 From: Nimetu Date: Thu, 12 Jan 2017 13:29:47 +0200 Subject: [PATCH] Fixed: Windowed resolution resetting when closing from login/outgame views. --HG-- branch : develop --- code/ryzom/client/src/client_cfg.cpp | 6 +----- code/ryzom/client/src/release.cpp | 17 +++++++++++++++++ 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/code/ryzom/client/src/client_cfg.cpp b/code/ryzom/client/src/client_cfg.cpp index 8fe4b4754..7f308c8d2 100644 --- a/code/ryzom/client/src/client_cfg.cpp +++ b/code/ryzom/client/src/client_cfg.cpp @@ -2043,13 +2043,9 @@ void CClientConfig::release () // Are we in window mode ? if (ClientCfg.Windowed /* && !isWindowMaximized() */) { - // Save windows position + // Save windows position. width/height are saved when leaving ingame. writeInt("PositionX", x); writeInt("PositionY", y); - - // Save windows size - writeInt("Width", std::max((sint)width, 800)); - writeInt("Height", std::max((sint)height, 600)); } } diff --git a/code/ryzom/client/src/release.cpp b/code/ryzom/client/src/release.cpp index 78465f093..96673db89 100644 --- a/code/ryzom/client/src/release.cpp +++ b/code/ryzom/client/src/release.cpp @@ -132,6 +132,19 @@ extern void selectTipsOfTheDay (uint tips); // FUNCTIONS // /////////////// +// *************************************************************************** +// Saving ingame resolution when in windowed mode +static void saveIngameResolution() +{ + if (ClientCfg.Windowed) + { + uint32 width, height; + Driver->getWindowSize(width, height); + ClientCfg.writeInt("Width", std::max((sint)width, 800)); + ClientCfg.writeInt("Height", std::max((sint)height, 600)); + } +} + // *************************************************************************** // 3D element release, called from both releaseMainLoopReselect() and releaseMainLoop() static void releaseMainLoopScenes() @@ -209,6 +222,8 @@ void releaseMainLoopReselect() { ProgressBar.release(); + saveIngameResolution(); + CInterfaceManager *pIM= CInterfaceManager::getInstance(); // save keys loaded and interface cfg (not done in releaseMainLoop() because done at end of mainLoop()...) @@ -364,6 +379,8 @@ void releaseMainLoop(bool closeConnection) { ProgressBar.release(); + saveIngameResolution(); + // Release R2 editor if applicable R2::getEditor().autoConfigRelease(IsInRingSession);