- /* If no window, return sizes for a default window with title bar and border */
- windowStyle = WS_OVERLAPPEDWINDOW;
-
+ {
+ SetRect(&clientRect,0,0,200,200);
+ CopyRect(&winRect,&clientRect);
+ fghComputeWindowRectFromClientArea_UseStyle(&winRect,windowStyle,windowExStyle,FALSE);
+ }
+
+ /* Calculate border width by taking width of whole window minus width of client area and divide by two
+ * NB: we assume horizontal and vertical borders have the same size, which should always be the case
+ * unless the user bypassed FreeGLUT and messed with the windowstyle himself.
+ * Once borderwidth is known, account for it when comparing height of window to height of client area.
+ * all other extra pixels are assumed to be atop the window, forming the caption.
+ */
+ borderWidth = ((winRect.right-winRect.left)-(clientRect.right-clientRect.left))/2;
+ captionHeight = (winRect.bottom-winRect.top)-(clientRect.bottom-clientRect.top)-borderWidth; /* include top border in caption height */
+