From b61a1bbb7a6237b2febcbda0cdc54cf52de65e48 Mon Sep 17 00:00:00 2001 From: "sixten.hugosson" Date: Sun, 18 Jun 2023 16:47:00 +0200 Subject: [PATCH] Single tweak in Win32 fullscreen handling. --- code/win32_main.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/code/win32_main.cpp b/code/win32_main.cpp index aefbc63..913168e 100644 --- a/code/win32_main.cpp +++ b/code/win32_main.cpp @@ -229,6 +229,9 @@ static PLATFORM_TOGGLE_FULLSCREEN(Win32_ToggleFullscreen) if(GetWindowPlacement(Window, &Global_WindowPosition) && GetMonitorInfo(MonitorFromWindow(Window, MONITOR_DEFAULTTOPRIMARY), &MonitorInfo)) { + // sixten: This doesn't work when the window is maximized. One wordaround would be to set the + // window to "normal" size using ShowWindow(Window, SW_SHOWNORMAL) but it looks *very* scuffed. + SetWindowLong(Window, GWL_STYLE, Style & ~WS_OVERLAPPEDWINDOW); SetWindowPos(Window, HWND_TOP, MonitorInfo.rcMonitor.left, MonitorInfo.rcMonitor.top, MonitorInfo.rcMonitor.right - MonitorInfo.rcMonitor.left, @@ -238,6 +241,7 @@ static PLATFORM_TOGGLE_FULLSCREEN(Win32_ToggleFullscreen) } else { + SetWindowLong(Window, GWL_STYLE, Style | WS_OVERLAPPEDWINDOW); SetWindowPlacement(Window, &Global_WindowPosition); SetWindowPos(Window, 0, 0, 0, 0, 0, SWP_NOMOVE|SWP_NOSIZE|SWP_NOZORDER|SWP_NOOWNERZORDER|SWP_FRAMECHANGED);