-#ifdef _WIN32_WCE
- {
- wchar_t* wstr = fghWstrFromStr(title);
- SetWindowText( fgStructure.CurrentWindow->Window.Handle, wstr );
- free(wstr);
- }
-#else
- SetWindowText( fgStructure.CurrentWindow->Window.Handle, title );
-#endif
-}
-
-/*
- * Change the current window's position
- */
-void fgPlatformGlutPositionWindow( int x, int y )
-{
- RECT winRect;
-
- /* "GetWindowRect" returns the pixel coordinates of the outside of the window */
- GetWindowRect( fgStructure.CurrentWindow->Window.Handle, &winRect );
- MoveWindow(
- fgStructure.CurrentWindow->Window.Handle,
- x,
- y,
- winRect.right - winRect.left,
- winRect.bottom - winRect.top,
- TRUE
- );
-}
-
-/*
- * Lowers the current window (by Z order change)
- */
-void fgPlatformGlutPushWindow( void )
-{
- SetWindowPos(
- fgStructure.CurrentWindow->Window.Handle,
- HWND_BOTTOM,
- 0, 0, 0, 0,
- SWP_NOSIZE | SWP_NOMOVE
- );
-}
-
-/*
- * Raises the current window (by Z order change)
- */
-void fgPlatformGlutPopWindow( void )
-{
- SetWindowPos(
- fgStructure.CurrentWindow->Window.Handle,
- HWND_TOP,
- 0, 0, 0, 0,
- SWP_NOSIZE | SWP_NOMOVE
- );
-}
-
-/*
- * Resize the current window so that it fits the whole screen
- */
-void fgPlatformGlutFullScreen( SFG_Window *win )
-{
-#if !defined(_WIN32_WCE) /* FIXME: what about WinCE */
-
- if (glutGet(GLUT_FULL_SCREEN))
- {
- /* Leave full screen state before entering fullscreen again (resizing?) */
- glutLeaveFullScreen();
- }
-
- {
-#if(WINVER >= 0x0500) /* Windows 2000 or later */
- RECT rect;
- HMONITOR hMonitor;
- MONITORINFO mi;
-
- /* For fullscreen mode, first remove all window decoration
- * and set style to popup so it will overlap the taskbar
- * then force to maximize on the screen on which it has the most
- * overlap.
- */
-
-
- /* 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;