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, width, height,
x ,y, x ,y,
x-border, x-border,
y-border-caption); y-caption);
else else
printf("child window %dx%d, top-left of client at: (%d,%d), relative to parent\n", printf("child window %dx%d, top-left of client at: (%d,%d), relative to parent\n",
width, height, 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. * all other extra pixels are assumed to be atop the window, forming the caption.
*/ */
borderWidth = ((winRect.right-winRect.left)-(clientRect.right-clientRect.left))/2; 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 ) switch( eWhat )
{ {

View File

@ -88,15 +88,23 @@ int fgPlatformGlutGet ( GLenum eWhat )
case GLUT_WINDOW_HEADER_HEIGHT: case GLUT_WINDOW_HEADER_HEIGHT:
{ {
int x, y; int x, y;
Window w; Window p,w;
if( fgStructure.CurrentWindow == NULL ) if( fgStructure.CurrentWindow == NULL )
return 0; 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( XTranslateCoordinates(
fgDisplay.pDisplay.Display, fgDisplay.pDisplay.Display,
fgStructure.CurrentWindow->Window.Handle, fgStructure.CurrentWindow->Window.Handle,
fgDisplay.pDisplay.RootWindow, p,
0, 0, &x, &y, &w); 0, 0, &x, &y, &w);
switch ( eWhat ) switch ( eWhat )
@ -105,7 +113,8 @@ int fgPlatformGlutGet ( GLenum eWhat )
case GLUT_WINDOW_Y: return y; 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; return 0;
XTranslateCoordinates( XTranslateCoordinates(
fgDisplay.pDisplay.Display, fgDisplay.pDisplay.Display,