From: Christopher John Purnell Date: Mon, 4 Aug 2003 18:56:30 +0000 (+0000) Subject: Replacing glutGet(GLUT_WINDOW_X) and glutGet(GLUT_WINDOW_Y) on X11 with X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?a=commitdiff_plain;h=6fadb32a79a194e7d09a553d425c7e2e26db258b;p=freeglut Replacing glutGet(GLUT_WINDOW_X) and glutGet(GLUT_WINDOW_Y) on X11 with something that works. Also a minor correction to the xf86vidmode autoconf stuff. git-svn-id: svn+ssh://svn.code.sf.net/p/freeglut/code/trunk/freeglut/freeglut@157 7f0cb862-5218-0410-a997-914c9d46530a --- diff --git a/src/freeglut_internal.h b/src/freeglut_internal.h index 48489c5..b8b8882 100644 --- a/src/freeglut_internal.h +++ b/src/freeglut_internal.h @@ -89,7 +89,7 @@ #include #include - #if HAVE_X11_EXTENSIONS_XF86VMODE_H + #ifdef HAVE_X11_EXTENSIONS_XF86VMODE_H #include #endif #endif diff --git a/src/freeglut_state.c b/src/freeglut_state.c index 3dbc4bb..f628c7e 100644 --- a/src/freeglut_state.c +++ b/src/freeglut_state.c @@ -215,6 +215,26 @@ int FGAPIENTRY glutGet( GLenum eWhat ) */ case GLUT_WINDOW_X: case GLUT_WINDOW_Y: + { + int x, y; + Window w; + + if( fgStructure.Window == NULL ) + return( 0 ); + + XTranslateCoordinates( + fgDisplay.Display, + fgStructure.Window->Window.Handle, + fgDisplay.RootWindow, + 0, 0, &x, &y, &w); + + switch ( eWhat ) + { + case GLUT_WINDOW_X: return x; + case GLUT_WINDOW_Y: return y; + } + } + case GLUT_WINDOW_WIDTH: case GLUT_WINDOW_HEIGHT: case GLUT_WINDOW_BORDER_WIDTH : @@ -242,8 +262,6 @@ int FGAPIENTRY glutGet( GLenum eWhat ) */ switch ( eWhat ) { - case GLUT_WINDOW_X: return winAttributes.x ; - case GLUT_WINDOW_Y: return winAttributes.y ; case GLUT_WINDOW_WIDTH: return winAttributes.width ; case GLUT_WINDOW_HEIGHT: return winAttributes.height ; case GLUT_WINDOW_BORDER_WIDTH : return winAttributes.border_width ;