Single tweak in Win32 fullscreen handling.

main
sixten.hugosson 2023-06-18 16:47:00 +02:00
parent 1fa199512d
commit b61a1bbb7a
1 changed files with 4 additions and 0 deletions

View File

@ -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);