Merge remote-tracking branch 'svn/trunk' into git_master

This commit is contained in:
Diederick Niehorster 2014-08-27 19:46:30 +08:00
commit 105c4eb685
3 changed files with 14 additions and 5 deletions

View File

@ -334,7 +334,7 @@ void Timer(int unused)
width, height,
x ,y,
x-border,
y-border-caption);
y-caption);
else
printf("child window %dx%d, top-left of client at: (%d,%d), relative to parent\n",
width, height,

View File

@ -256,7 +256,7 @@ int fgPlatformGlutGet ( GLenum eWhat )
* 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*2;
captionHeight = (winRect.bottom-winRect.top)-(clientRect.bottom-clientRect.top)-borderWidth; /* include top border in caption height */
switch( eWhat )
{

View File

@ -88,15 +88,23 @@ int fgPlatformGlutGet ( GLenum eWhat )
case GLUT_WINDOW_HEADER_HEIGHT:
{
int x, y;
Window w;
Window p,w;
if( fgStructure.CurrentWindow == NULL )
return 0;
if (fgStructure.CurrentWindow->Parent)
/* For child window, we should return relative to upper-left
* of parent's client area.
*/
p = fgStructure.CurrentWindow->Parent->Window.Handle;
else
p = fgDisplay.pDisplay.RootWindow;
XTranslateCoordinates(
fgDisplay.pDisplay.Display,
fgStructure.CurrentWindow->Window.Handle,
fgDisplay.pDisplay.RootWindow,
p,
0, 0, &x, &y, &w);
switch ( eWhat )
@ -105,7 +113,8 @@ int fgPlatformGlutGet ( GLenum eWhat )
case GLUT_WINDOW_Y: return y;
}
if ( w == 0 )
if ( w == 0 || fgStructure.CurrentWindow->Parent)
/* logic below needs w, and child windows don't have borders */
return 0;
XTranslateCoordinates(
fgDisplay.pDisplay.Display,