Except I don't want full screen if, say, the console (or really the menu) is up. Especially since you can't get out of full-screen maximized size without it.
This link was very helpful, with bits and pieces of this both right and wrong all over the internet in a frustrating way.
[This gets called from within the window resize function, so if going to full screen maximized or the reverse changes something, that change does get recorded right after exiting the function.]
Code: Select all
void Platform_Window_Check_Maximized (void)
{
static fbool oldSuperMaximized = False;
static fbool oldMaximized = False;
static WINDOWPLACEMENT wpPrev = { sizeof(wpPrev) };
{
// We super maximize when maximized, no console, and non already supermaximized
// We un-super maximize when supermaximized, maximized, console is showing.
fbool Action = False;
if (oldSuperMaximized == False && !host.isConsoleUp /*&& oldMaximized*/ && host.isMaximized)
{
// Go to super-maximized
DWORD dwStyle = GetWindowLong(w32_plat.mainwindow, GWL_STYLE);
if (dwStyle & WS_OVERLAPPEDWINDOW)
{
GetWindowPlacement (w32_plat.mainwindow, &wpPrev);
SetWindowLong (w32_plat.mainwindow, GWL_STYLE, dwStyle & ~WS_OVERLAPPEDWINDOW);
SetWindowPos (w32_plat.mainwindow, HWND_TOP, 0, 0, host.deviceWidth, host.deviceHeight, SWP_NOOWNERZORDER | SWP_FRAMECHANGED);
oldSuperMaximized = True;
}
oldSuperMaximized = True;
Action = True;
}
else if (oldSuperMaximized == True && host.isConsoleUp && host.isMaximized /*&& oldMaximized == True*/)
{
DWORD dwStyle = GetWindowLong(w32_plat.mainwindow, GWL_STYLE);
SetWindowLong (w32_plat.mainwindow, GWL_STYLE, dwStyle | WS_OVERLAPPEDWINDOW);
SetWindowPlacement(w32_plat.mainwindow, &wpPrev);
SetWindowPos (
w32_plat.mainwindow,
NULL,
0,0,0,0,
SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_NOOWNERZORDER | SWP_FRAMECHANGED
);
oldSuperMaximized = False;
Action = True;
}
oldMaximized = host.isMaximized;
}
}