win32: Use the nearest monitor size for calculating maximized window dimensions

Default to using the nearest monitor, instead of null, as a null monitor can be sent when restoring from minimized, which results in the restored, maximized window being the wrong size.
This commit is contained in:
Frank Praznik
2024-12-27 13:02:55 -05:00
parent 599b4ef254
commit bc448fa445

View File

@@ -1879,7 +1879,7 @@ LRESULT CALLBACK WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPara
WINDOWPLACEMENT placement;
if (GetWindowPlacement(hwnd, &placement) && placement.showCmd == SW_MAXIMIZE) {
// Maximized borderless windows should use the monitor work area.
HMONITOR hMonitor = MonitorFromWindow(hwnd, MONITOR_DEFAULTTONULL);
HMONITOR hMonitor = MonitorFromWindow(hwnd, MONITOR_DEFAULTTONEAREST);
if (hMonitor) {
MONITORINFO info;
SDL_zero(info);