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: https://svn.code.sf.net/p/freeglut/code/trunk@157 7f0cb862-5218-0410-a997-914c9d46530a
This commit is contained in:
cjp 2003-08-04 18:56:30 +00:00
parent 6e4af43b5f
commit ddce3e728d
2 changed files with 21 additions and 3 deletions

View File

@ -89,7 +89,7 @@
#include <X11/Xatom.h> #include <X11/Xatom.h>
#include <X11/keysym.h> #include <X11/keysym.h>
#if HAVE_X11_EXTENSIONS_XF86VMODE_H #ifdef HAVE_X11_EXTENSIONS_XF86VMODE_H
#include <X11/extensions/xf86vmode.h> #include <X11/extensions/xf86vmode.h>
#endif #endif
#endif #endif

View File

@ -215,6 +215,26 @@ int FGAPIENTRY glutGet( GLenum eWhat )
*/ */
case GLUT_WINDOW_X: case GLUT_WINDOW_X:
case GLUT_WINDOW_Y: 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_WIDTH:
case GLUT_WINDOW_HEIGHT: case GLUT_WINDOW_HEIGHT:
case GLUT_WINDOW_BORDER_WIDTH : case GLUT_WINDOW_BORDER_WIDTH :
@ -242,8 +262,6 @@ int FGAPIENTRY glutGet( GLenum eWhat )
*/ */
switch ( 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_WIDTH: return winAttributes.width ;
case GLUT_WINDOW_HEIGHT: return winAttributes.height ; case GLUT_WINDOW_HEIGHT: return winAttributes.height ;
case GLUT_WINDOW_BORDER_WIDTH : return winAttributes.border_width ; case GLUT_WINDOW_BORDER_WIDTH : return winAttributes.border_width ;