+
+ /* We'll finish off the fullscreen operation below after the other GLUT_POSITION_WORK|GLUT_SIZE_WORK|GLUT_ZORDER_WORK */
+ }
+ else
+ {
+ /* we are currently not fullscreen, go to fullscreen:
+ * remove window decoration and then maximize
+ */
+ RECT rect;
+ HMONITOR hMonitor;
+ MONITORINFO mi;
+
+ /* save current window rect, style, exstyle and maximized state */
+ window->State.pWState.OldMaximized = !!IsZoomed(window->Window.Handle);
+ if (window->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(window->Window.Handle, WM_SYSCOMMAND, SC_RESTORE, 0);
+
+ fghGetClientArea( &window->State.pWState.OldRect, window, GL_TRUE );
+ window->State.pWState.OldStyle = GetWindowLong(window->Window.Handle, GWL_STYLE);
+ window->State.pWState.OldStyleEx = GetWindowLong(window->Window.Handle, GWL_EXSTYLE);
+
+ /* remove decorations from style */
+ SetWindowLong(window->Window.Handle, GWL_STYLE,
+ window->State.pWState.OldStyle & ~(WS_CAPTION | WS_THICKFRAME));
+ SetWindowLong(window->Window.Handle, GWL_EXSTYLE,
+ window->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.
+ */
+ GetWindowRect(window->Window.Handle, &rect);
+ hMonitor= MonitorFromRect(&rect, MONITOR_DEFAULTTONEAREST);
+ mi.cbSize = sizeof(mi);
+ GetMonitorInfo(hMonitor, &mi);
+ rect = mi.rcMonitor;
+
+ /* then setup window resize, overwriting other work queued on the window */
+ window->State.WorkMask |= GLUT_POSITION_WORK | GLUT_SIZE_WORK;
+ window->State.WorkMask &= ~GLUT_ZORDER_WORK;
+ window->State.DesiredXpos = rect.left;
+ window->State.DesiredYpos = rect.top;
+ window->State.DesiredWidth = rect.right - rect.left;
+ window->State.DesiredHeight = rect.bottom - rect.top;