Replacing glutGet(GLUT_WINDOW_X) and glutGet(GLUT_WINDOW_Y) on X11 with
authorChristopher John Purnell <cjp@lost.org.uk>
Mon, 4 Aug 2003 18:56:30 +0000 (18:56 +0000)
committerChristopher John Purnell <cjp@lost.org.uk>
Mon, 4 Aug 2003 18:56:30 +0000 (18:56 +0000)
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

src/freeglut_internal.h
src/freeglut_state.c

index 48489c5..b8b8882 100644 (file)
@@ -89,7 +89,7 @@
     #include <X11/Xatom.h>
     #include <X11/keysym.h>
 
-    #if HAVE_X11_EXTENSIONS_XF86VMODE_H
+    #ifdef HAVE_X11_EXTENSIONS_XF86VMODE_H
     #include <X11/extensions/xf86vmode.h>
     #endif
 #endif
index 3dbc4bb..f628c7e 100644 (file)
@@ -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 ;