Add support for unlimited window size if MaximumSize is set to Zero

#1824
This commit is contained in:
Wojtek Figat
2023-11-06 14:42:29 +01:00
parent 51c0a6e100
commit c025b4414c
6 changed files with 23 additions and 21 deletions

View File

@@ -1056,22 +1056,23 @@ LRESULT WindowsWindow::WndProc(UINT msg, WPARAM wParam, LPARAM lParam)
case WM_GETMINMAXINFO:
{
const auto minMax = reinterpret_cast<MINMAXINFO*>(lParam);
int32 borderWidth = 0, borderHeight = 0;
if (_settings.HasBorder)
{
const DWORD windowStyle = GetWindowLongW(_handle, GWL_STYLE);
const DWORD windowExStyle = GetWindowLongW(_handle, GWL_EXSTYLE);
RECT borderRect = { 0, 0, 0, 0 };
AdjustWindowRectEx(&borderRect, windowStyle, false, windowExStyle);
borderWidth = borderRect.right - borderRect.left;
borderHeight = borderRect.bottom - borderRect.top;
}
minMax->ptMinTrackSize.x = (int32)_settings.MinimumSize.X;
minMax->ptMinTrackSize.y = (int32)_settings.MinimumSize.Y;
minMax->ptMaxTrackSize.x = (int32)_settings.MaximumSize.X + borderWidth;
minMax->ptMaxTrackSize.y = (int32)_settings.MaximumSize.Y + borderHeight;
if (_settings.MaximumSize.SumValues() > 0)
{
int32 borderWidth = 0, borderHeight = 0;
if (_settings.HasBorder)
{
const DWORD windowStyle = GetWindowLongW(_handle, GWL_STYLE);
const DWORD windowExStyle = GetWindowLongW(_handle, GWL_EXSTYLE);
RECT borderRect = { 0, 0, 0, 0 };
AdjustWindowRectEx(&borderRect, windowStyle, false, windowExStyle);
borderWidth = borderRect.right - borderRect.left;
borderHeight = borderRect.bottom - borderRect.top;
}
minMax->ptMaxTrackSize.x = (int32)_settings.MaximumSize.X + borderWidth;
minMax->ptMaxTrackSize.y = (int32)_settings.MaximumSize.Y + borderHeight;
}
// Include Windows task bar size into maximized tool window
WINDOWPLACEMENT e;