mirror of
https://port.numenaute.org/aleajactaest/khanat-opennel-code.git
synced 2024-11-20 06:06:13 +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.Width = w;
|
ClientCfg.Depth = screenMode.Depth;
|
||||||
ClientCfg.Height = h;
|
|
||||||
ClientCfg.Depth = GAME_CONFIG_VIDEO_DEPTH_REQ;
|
|
||||||
ClientCfg.Frequency = freq;
|
ClientCfg.Frequency = freq;
|
||||||
ClientCfg.writeInt("Width", w);
|
}
|
||||||
ClientCfg.writeInt("Height", h);
|
else
|
||||||
ClientCfg.writeInt("Depth", GAME_CONFIG_VIDEO_DEPTH_REQ);
|
{
|
||||||
|
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);
|
ClientCfg.writeInt("Frequency", freq);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue