- make the non-fullscreen window default to 80% of the current display size on Windows.

This commit is contained in:
Christoph Oelckers 2018-07-28 11:57:05 +02:00
parent d58fe1f78a
commit 843e9e950f
2 changed files with 12 additions and 6 deletions

View file

@ -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);

View file

@ -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);