mirror of
https://port.numenaute.org/aleajactaest/khanat-code-old.git
synced 2024-11-23 23:36:18 +00:00
Fixed: #1198 Window is too large when switching from fullscreen to windowed mode
This commit is contained in:
parent
b113f3465a
commit
a5dbd29c04
1 changed files with 36 additions and 8 deletions
|
@ -3217,18 +3217,46 @@ class CHandlerGameConfigApply : public IActionHandler
|
|||
}
|
||||
|
||||
ClientCfg.Windowed = !bFullscreen;
|
||||
// Write the modified client.cfg
|
||||
ClientCfg.writeInt("FullScreen", bFullscreen?1:0);
|
||||
|
||||
UDriver::CMode screenMode;
|
||||
Driver->getCurrentScreenMode(screenMode);
|
||||
|
||||
if (bFullscreen)
|
||||
{
|
||||
ClientCfg.Width = w;
|
||||
ClientCfg.Height = h;
|
||||
ClientCfg.Depth = GAME_CONFIG_VIDEO_DEPTH_REQ;
|
||||
ClientCfg.Depth = screenMode.Depth;
|
||||
ClientCfg.Frequency = freq;
|
||||
ClientCfg.writeInt("Width", w);
|
||||
ClientCfg.writeInt("Height", h);
|
||||
ClientCfg.writeInt("Depth", GAME_CONFIG_VIDEO_DEPTH_REQ);
|
||||
}
|
||||
else
|
||||
{
|
||||
uint32 width, height;
|
||||
Driver->getWindowSize(width, height);
|
||||
|
||||
// window is too large
|
||||
if (width >= screenMode.Width || height >= screenMode.Height)
|
||||
{
|
||||
// choose a smaller size
|
||||
w = 1024;
|
||||
h = 768;
|
||||
}
|
||||
else
|
||||
{
|
||||
// take previous mode
|
||||
w = width;
|
||||
h = height;
|
||||
}
|
||||
}
|
||||
|
||||
ClientCfg.Width = w;
|
||||
ClientCfg.Height = h;
|
||||
|
||||
// Write the modified client.cfg
|
||||
ClientCfg.writeBool("FullScreen", bFullscreen);
|
||||
ClientCfg.writeInt("Width", w);
|
||||
ClientCfg.writeInt("Height", h);
|
||||
|
||||
if (bFullscreen)
|
||||
{
|
||||
ClientCfg.writeInt("Depth", screenMode.Depth);
|
||||
ClientCfg.writeInt("Frequency", freq);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue