-
- /* save current window rect, style, exstyle and maximized state */
- win->State.pWState.OldMaximized = !!IsZoomed(win->Window.Handle);
- if (win->State.pWState.OldMaximized)
- /* We force the window into restored mode before going
- * fullscreen because Windows doesn't seem to hide the
- * taskbar if the window is in the maximized state.
- */
- SendMessage(win->Window.Handle, WM_SYSCOMMAND, SC_RESTORE, 0);
-
- GetWindowRect( win->Window.Handle, &win->State.pWState.OldRect );
- win->State.pWState.OldStyle = GetWindowLong(win->Window.Handle, GWL_STYLE);
- win->State.pWState.OldStyleEx = GetWindowLong(win->Window.Handle, GWL_EXSTYLE);
-
- /* remove decorations from style */
- SetWindowLong(win->Window.Handle, GWL_STYLE,
- win->State.pWState.OldStyle & ~(WS_CAPTION | WS_THICKFRAME));
- SetWindowLong(win->Window.Handle, GWL_EXSTYLE,
- win->State.pWState.OldStyleEx & ~(WS_EX_DLGMODALFRAME |
- WS_EX_WINDOWEDGE | WS_EX_CLIENTEDGE | WS_EX_STATICEDGE));
-
- /* For fullscreen mode, find the monitor that is covered the most
- * by the window and get its rect as the resize target.
- */
- hMonitor= MonitorFromRect(&win->State.pWState.OldRect, MONITOR_DEFAULTTONEAREST);
- mi.cbSize = sizeof(mi);
- GetMonitorInfo(hMonitor, &mi);
- rect = mi.rcMonitor;
-#else /* if (WINVER >= 0x0500) */
- RECT rect;
-
- /* For fullscreen mode, force the top-left corner to 0,0
- * and adjust the window rectangle so that the client area
- * covers the whole screen.
- */
-
- rect.left = 0;
- rect.top = 0;
- rect.right = fgDisplay.ScreenWidth;
- rect.bottom = fgDisplay.ScreenHeight;
-
- AdjustWindowRect ( &rect, WS_OVERLAPPEDWINDOW | WS_CLIPSIBLINGS |
- WS_CLIPCHILDREN, FALSE );
-#endif /* (WINVER >= 0x0500) */
-
- /*
- * then resize window
- * SWP_NOACTIVATE Do not activate the window
- * SWP_NOOWNERZORDER Do not change position in z-order
- * SWP_NOSENDCHANGING Suppress WM_WINDOWPOSCHANGING message
- * SWP_NOZORDER Retains the current Z order (ignore 2nd param)
- */
- SetWindowPos( fgStructure.CurrentWindow->Window.Handle,
- HWND_TOP,
- rect.left,
- rect.top,
- rect.right - rect.left,
- rect.bottom - rect.top,
- SWP_NOACTIVATE | SWP_NOOWNERZORDER | SWP_NOSENDCHANGING |
- SWP_NOZORDER
- );
-
- win->State.IsFullscreen = GL_TRUE;
- }
-#endif
-}
-
-/*
- * If we are fullscreen, resize the current window back to its original size
- */
-void fgPlatformGlutLeaveFullScreen( SFG_Window *win )
-{
-#if !defined(_WIN32_WCE) /* FIXME: what about WinCE */
- if (!glutGet(GLUT_FULL_SCREEN))
- {
- /* nothing to do */
- return;
- }
-
- /* restore style of window before making it fullscreen */
- SetWindowLong(win->Window.Handle, GWL_STYLE, win->State.pWState.OldStyle);
- SetWindowLong(win->Window.Handle, GWL_EXSTYLE, win->State.pWState.OldStyleEx);
-
- /* Then resize */
- SetWindowPos(win->Window.Handle,
- HWND_TOP,
- win->State.pWState.OldRect.left,
- win->State.pWState.OldRect.top,
- win->State.pWState.OldRect.right - win->State.pWState.OldRect.left,
- win->State.pWState.OldRect.bottom - win->State.pWState.OldRect.top,
- SWP_NOACTIVATE | SWP_NOOWNERZORDER | SWP_NOSENDCHANGING |
- SWP_NOZORDER
- );
-
- if (win->State.pWState.OldMaximized)
- SendMessage(win->Window.Handle, WM_SYSCOMMAND, SC_MAXIMIZE, 0);
-
- win->State.IsFullscreen = GL_FALSE;
-#endif
-}
-
-/*
- * Toggle the window's full screen state.
- */
-void fgPlatformGlutFullScreenToggle( SFG_Window *win )
-{
- if (!win->State.IsFullscreen)
- glutFullScreen();
- else
- glutLeaveFullScreen();