Black screen fix

black screen wasn't properly fixed in certain situation.
Now it's fixed!
This commit is contained in:
Anis 2014-12-12 15:27:49 +01:00
parent 4210c002bb
commit 1131bdd5ab

View file

@ -139,7 +139,6 @@ const GFXVideoMode & Win32Window::getVideoMode()
void Win32Window::setVideoMode( const GFXVideoMode &mode )
{
bool needCurtain = (mVideoMode.fullScreen != mode.fullScreen);
static bool first_load = true;
if(needCurtain)
{
@ -209,12 +208,16 @@ void Win32Window::setVideoMode( const GFXVideoMode &mode )
}
else
{
if (!first_load)
ChangeDisplaySettings(NULL, 0);
DISPLAY_DEVICE dd = GetPrimaryDevice();
DEVMODE dv;
ZeroMemory(&dv, sizeof(dv));
dv.dmSize = sizeof(DEVMODE);
EnumDisplaySettings(dd.DeviceName, ENUM_CURRENT_SETTINGS, &dv);
first_load = false;
if ((mode.resolution.x != dv.dmPelsWidth) || (mode.resolution.y != dv.dmPelsHeight))
ChangeDisplaySettings(NULL, 0);
// Reset device *first*, so that when we call setSize() and let it
// Reset device *first*, so that when we call setSize() and let it
// access the monitor settings, it won't end up with our fullscreen
// geometry that is just about to change.