Fix UI restore when window is resized while in loading screen

develop
Nimetu 3 years ago
parent d893d15daf
commit 5064f0417b

@ -1290,19 +1290,7 @@ TInterfaceState globalMenu()
// Restore video mode
if (ClientCfg.SelectCharacter == -1)
{
if (ClientCfg.Windowed)
{
// if used changed window resolution in char select
// if we don't update ClientCfg, then UI from icfg is restored wrong
uint32 width, height;
Driver->getWindowSize(width, height);
ClientCfg.Width = width;
ClientCfg.Height = height;
}
connectionRestoreVideoMode ();
}
// Skip intro next time
ClientCfg.writeBool("SkipIntro", true);

@ -1899,9 +1899,12 @@ bool CInterfaceManager::loadConfig (const string &filename)
// NB: we are typically InGame here (even though the _InGame flag is not yet set)
// Use the screen size of the config file. Don't update current UI, just _Modes
//
// ClientCfg has W/H set to screen size, but interface expects scaled size
sint32 scaledW = ClientCfg.Width / ClientCfg.InterfaceScale;
sint32 scaledH = ClientCfg.Height / ClientCfg.InterfaceScale;
uint32 width, height;
// get non-scaled width/height
Driver->getWindowSize(width, height);
// convert to scaled width/height for ui
sint32 scaledW = width / ClientCfg.InterfaceScale;
sint32 scaledH = height / ClientCfg.InterfaceScale;
CWidgetManager::getInstance()->moveAllWindowsToNewScreenSize(scaledW, scaledH, false);
updateDesktops(scaledW, scaledH);
}

Loading…
Cancel
Save