+ ShowCursor( TRUE );
+}
+
+
+void fgPlatformDisplayWindow ( SFG_Window *window )
+{
+ RedrawWindow(
+ window->Window.Handle, NULL, NULL,
+ RDW_NOERASE | RDW_INTERNALPAINT | RDW_INVALIDATE | RDW_UPDATENOW
+ );
+}
+
+
+void fgPlatformReshapeWindow ( SFG_Window *window, int width, int height )
+{
+ RECT windowRect;
+
+ /*
+ * HACK HACK HACK:
+ * Before we do anything else, check if this is a newly created window
+ * that did not have its windowStatus/visibility func called yet
+ * we do that on first paint, but because I want to keep the paint
+ * operation as lean as possible, we do it here. The first paint
+ * goes together with a first resize call before the display callback
+ * is called, so this is just in time. Shitty place to do it, but this
+ * is the only reliable way I can think of to call the callback upon
+ * first draw of the window.
+ * More broadly speaking, I know this is an ugly hack, but I'm not sure
+ * what else to do about it. Depending on WM_ACTIVATE would not work
+ * as not all windows get this when you are opening multiple before the
+ * mainloop starts. WM_SHOWWINDOW looked like an interesting candidate,
+ * but it is generated and processed before glutCreate(Sub)Window
+ * returns, so no callback can yet be set on the window.
+ */
+ /* Check windowStatus/visibility func has been notified that window is visible (deferred from creation time to give user opportunity to register callbacks) */
+ if (!window->State.pWState.WindowFuncCalled)
+ {
+ fghNotifyWindowStatus(window);
+ window->State.pWState.WindowFuncCalled = GL_TRUE;
+ }
+
+ /*
+ * For windowed mode, get the current position of the
+ * window and resize taking the size of the frame
+ * decorations into account.
+ *
+ * Note on maximizing behavior of Windows: the resize borders are off
+ * the screen such that the client area extends all the way from the
+ * leftmost corner to the rightmost corner to maximize screen real
+ * estate. A caption is still shown however to allow interaction with
+ * the window controls. This is default behavior of Windows that
+ * FreeGLUT sticks with. To alter, one would have to check if
+ * WS_MAXIMIZE style is set when a resize event is triggered, and
+ * then manually correct the windowRect to put the borders back on
+ * screen.
+ */
+
+ /* "GetWindowRect" returns the pixel coordinates of the outside of the window */
+ GetWindowRect( window->Window.Handle, &windowRect );
+
+ /* Create rect in FreeGLUT format, (X,Y) topleft outside window, WxH of client area */
+ windowRect.right = windowRect.left+width;
+ windowRect.bottom = windowRect.top+height;