diff --git a/src/win32/base_sysfb.cpp b/src/win32/base_sysfb.cpp index 8324c250f..6e90ca81c 100644 --- a/src/win32/base_sysfb.cpp +++ b/src/win32/base_sysfb.cpp @@ -71,7 +71,6 @@ EXTERN_CVAR(Int, vid_defheight) // //========================================================================== - //========================================================================== // // @@ -278,14 +277,14 @@ void SystemBaseFrameBuffer::SetWindowSize(int w, int h) // //========================================================================== -void SystemBaseFrameBuffer::PositionWindow(bool fullscreen) +void SystemBaseFrameBuffer::PositionWindow(bool fullscreen, bool initialcall) { RECT r; LONG style, exStyle; RECT monRect; - if (!m_Fullscreen && fullscreen) SaveWindowedPos(); + if (!m_Fullscreen && fullscreen && !initialcall) SaveWindowedPos(); if (m_Monitor) { MONITORINFOEX mi; @@ -296,6 +295,13 @@ void SystemBaseFrameBuffer::PositionWindow(bool fullscreen) strcpy(m_displayDeviceNameBuffer, mi.szDevice); m_displayDeviceName = m_displayDeviceNameBuffer; monRect = mi.rcMonitor; + + // Set the default windowed size if not specified yet. + if (win_w < 0 || win_h < 0) + { + win_w = int(monRect.right - monRect.left) * 8 / 10; + win_h = int(monRect.bottom - monRect.top) * 8 / 10; + } } } @@ -347,7 +353,7 @@ SystemBaseFrameBuffer::SystemBaseFrameBuffer(void *hMonitor, bool fullscreen) : { m_Monitor = hMonitor; m_displayDeviceName = 0; - PositionWindow(fullscreen); + PositionWindow(fullscreen, true); HDC hDC = GetDC(Window); diff --git a/src/win32/base_sysfb.h b/src/win32/base_sysfb.h index 84eb5c981..6d7470cef 100644 --- a/src/win32/base_sysfb.h +++ b/src/win32/base_sysfb.h @@ -10,7 +10,7 @@ class SystemBaseFrameBuffer : public DFrameBuffer void RestoreWindowedPos(); public: - SystemBaseFrameBuffer() {} + SystemBaseFrameBuffer(); // Actually, hMonitor is a HMONITOR, but it's passed as a void * as there // look to be some cross-platform bits in the way. SystemBaseFrameBuffer(void *hMonitor, bool fullscreen); @@ -28,7 +28,7 @@ protected: void GetCenteredPos(int in_w, int in_h, int &winx, int &winy, int &winw, int &winh, int &scrwidth, int &scrheight); void KeepWindowOnScreen(int &winx, int &winy, int winw, int winh, int scrwidth, int scrheight); - void PositionWindow(bool fullscreen); + void PositionWindow(bool fullscreen, bool initialcall = false); void ResetGammaTable(); void SetGammaTable(uint16_t * tbl);