- /* This asks us to toggle fullscreen mode */
- flags |= SWP_FRAMECHANGED;
-
- if (window->State.IsFullscreen)
- {
- /* If we are fullscreen, resize the current window back to its original size */
- /* printf("OldRect %i,%i to %i,%i\n",window->State.pWState.OldRect.left,window->State.pWState.OldRect.top,window->State.pWState.OldRect.right,window->State.pWState.OldRect.bottom); */
-
- /* restore style of window before making it fullscreen */
- SetWindowLong(window->Window.Handle, GWL_STYLE, window->State.pWState.OldStyle);
- SetWindowLong(window->Window.Handle, GWL_EXSTYLE, window->State.pWState.OldStyleEx);
-
- /* Then set up resize/reposition, unless user already queued up reshape/position work */
- if (!(workMask & GLUT_POSITION_WORK))
- {
- workMask |= GLUT_POSITION_WORK;
- window->State.DesiredXpos = window->State.pWState.OldRect.left;
- window->State.DesiredYpos = window->State.pWState.OldRect.top;
- }
- if (!(workMask & GLUT_SIZE_WORK))
- {
- workMask |= GLUT_SIZE_WORK;
- window->State.DesiredWidth = window->State.pWState.OldRect.right - window->State.pWState.OldRect.left;
- window->State.DesiredHeight = window->State.pWState.OldRect.bottom - window->State.pWState.OldRect.top;
- }
-
- /* 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;
- }
- }
-#endif /*!defined(_WIN32_WCE) */