windisplay: Prevent window resize to zero (#1705)

This commit is contained in:
burningbuffer 2024-12-21 14:53:07 -03:00 committed by GitHub
parent 899af61e2a
commit 5965d5bbec
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 20 additions and 0 deletions

View File

@ -1515,6 +1515,26 @@ window_proc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) {
WindowProperties properties;
switch (msg) {
case WM_GETMINMAXINFO:
{
MINMAXINFO* minmaxinfo = (MINMAXINFO*)lparam;
int minClientWidth = 1; // Minimum client area width
int minClientHeight = 1; // Minimum client area height
// Adjust window for non-client area
RECT rect = { 0, 0, minClientWidth, minClientHeight };
AdjustWindowRect(&rect, GetWindowLong(hwnd, GWL_STYLE), FALSE);
// Calculate final size
int minWidth = rect.right - rect.left;
int minHeight = rect.bottom - rect.top;
// Set the minimum track size in MINMAXINFO
minmaxinfo->ptMinTrackSize.x = minWidth; // Minimum window width
minmaxinfo->ptMinTrackSize.y = minHeight; // Minimum window height
}
break;
case WM_MOUSEMOVE:
if (!_tracking_mouse_leaving) {
// need to re-call TrackMouseEvent every time mouse re-enters window