mirror of
https://port.numenaute.org/aleajactaest/khanat-opennel-code.git
synced 2024-12-15 14:08:42 +00:00
Fixed: #1198 Window is too large when switching from fullscreen to windowed mode
This commit is contained in:
parent
f0d4de6243
commit
c131829a15
1 changed files with 36 additions and 8 deletions
|
@ -3217,18 +3217,46 @@ class CHandlerGameConfigApply : public IActionHandler
|
||||||
}
|
}
|
||||||
|
|
||||||
ClientCfg.Windowed = !bFullscreen;
|
ClientCfg.Windowed = !bFullscreen;
|
||||||
// Write the modified client.cfg
|
|
||||||
ClientCfg.writeInt("FullScreen", bFullscreen?1:0);
|
UDriver::CMode screenMode;
|
||||||
|
Driver->getCurrentScreenMode(screenMode);
|
||||||
|
|
||||||
if (bFullscreen)
|
if (bFullscreen)
|
||||||
{
|
{
|
||||||
|
ClientCfg.Depth = screenMode.Depth;
|
||||||
|
ClientCfg.Frequency = freq;
|
||||||
|
}
|
||||||
|
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.Width = w;
|
||||||
ClientCfg.Height = h;
|
ClientCfg.Height = h;
|
||||||
ClientCfg.Depth = GAME_CONFIG_VIDEO_DEPTH_REQ;
|
|
||||||
ClientCfg.Frequency = freq;
|
// Write the modified client.cfg
|
||||||
|
ClientCfg.writeBool("FullScreen", bFullscreen);
|
||||||
ClientCfg.writeInt("Width", w);
|
ClientCfg.writeInt("Width", w);
|
||||||
ClientCfg.writeInt("Height", h);
|
ClientCfg.writeInt("Height", h);
|
||||||
ClientCfg.writeInt("Depth", GAME_CONFIG_VIDEO_DEPTH_REQ);
|
|
||||||
|
if (bFullscreen)
|
||||||
|
{
|
||||||
|
ClientCfg.writeInt("Depth", screenMode.Depth);
|
||||||
ClientCfg.writeInt("Frequency", freq);
|
ClientCfg.writeInt("Frequency", freq);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue