X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?a=blobdiff_plain;f=src%2Fx11%2Ffg_state_x11.c;h=79a7ac93fa3993415a6f97e28ebb81f12626fbb1;hb=6b36c1d54fc34b2ead05d4bfb4ad9bcdae7246b5;hp=206478f718ea40f60f3276f607a22060dba76120;hpb=55a8bc593affc3565d63453d35773cdbf1046216;p=freeglut diff --git a/src/x11/fg_state_x11.c b/src/x11/fg_state_x11.c index 206478f..79a7ac9 100644 --- a/src/x11/fg_state_x11.c +++ b/src/x11/fg_state_x11.c @@ -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,