mirror of
https://github.com/SFML/SFML.git
synced 2025-01-19 15:55:13 +08:00
Fixed windows bigger than the desktop not appearing on Windows (#215)
This commit is contained in:
parent
73ec7ab483
commit
4d55bbe4ff
@ -103,8 +103,8 @@ m_surrogate (0)
|
|||||||
|
|
||||||
// Compute position and size
|
// Compute position and size
|
||||||
HDC screenDC = GetDC(NULL);
|
HDC screenDC = GetDC(NULL);
|
||||||
int left = (GetDeviceCaps(screenDC, HORZRES) - mode.width) / 2;
|
int left = (GetDeviceCaps(screenDC, HORZRES) - static_cast<int>(mode.width)) / 2;
|
||||||
int top = (GetDeviceCaps(screenDC, VERTRES) - mode.height) / 2;
|
int top = (GetDeviceCaps(screenDC, VERTRES) - static_cast<int>(mode.height)) / 2;
|
||||||
int width = mode.width;
|
int width = mode.width;
|
||||||
int height = mode.height;
|
int height = mode.height;
|
||||||
ReleaseDC(NULL, screenDC);
|
ReleaseDC(NULL, screenDC);
|
||||||
@ -142,6 +142,10 @@ m_surrogate (0)
|
|||||||
m_handle = CreateWindowA(classNameA, title.toAnsiString().c_str(), win32Style, left, top, width, height, NULL, NULL, GetModuleHandle(NULL), this);
|
m_handle = CreateWindowA(classNameA, title.toAnsiString().c_str(), win32Style, left, top, width, height, NULL, NULL, GetModuleHandle(NULL), this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// By default, the OS limits the size of the window the the desktop size,
|
||||||
|
// we have to resize it after creation to apply the real size
|
||||||
|
setSize(Vector2u(mode.width, mode.height));
|
||||||
|
|
||||||
// Switch to fullscreen if requested
|
// Switch to fullscreen if requested
|
||||||
if (fullscreen)
|
if (fullscreen)
|
||||||
switchToFullscreen(mode);
|
switchToFullscreen(mode);
|
||||||
@ -489,6 +493,21 @@ void WindowImplWin32::processEvent(UINT message, WPARAM wParam, LPARAM lParam)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// The system request the min/max window size and position
|
||||||
|
case WM_GETMINMAXINFO :
|
||||||
|
{
|
||||||
|
// We override the returned information to remove the default limit
|
||||||
|
// (the OS doesn't allow windows bigger than the desktop by default)
|
||||||
|
MINMAXINFO* info = reinterpret_cast<MINMAXINFO*>(lParam);
|
||||||
|
info->ptMaxPosition.x = 50000;
|
||||||
|
info->ptMaxPosition.y = 50000;
|
||||||
|
info->ptMaxSize.x = 50000;
|
||||||
|
info->ptMaxSize.y = 50000;
|
||||||
|
info->ptMaxTrackSize.x = 50000;
|
||||||
|
info->ptMaxTrackSize.y = 50000;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
// Gain focus event
|
// Gain focus event
|
||||||
case WM_SETFOCUS :
|
case WM_SETFOCUS :
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user