Author: ArcRiley
Date: 2007-07-05 18:01:08 -0400 (Thu, 05 Jul 2007)
New Revision: 370

Modified:
   trunk/pysoy/src/_core-x11/Window.pxi
   trunk/pysoy/src/_core-x11/glx.pxd
Log:
working on #247 (Window.position)


Modified: trunk/pysoy/src/_core-x11/Window.pxi
===================================================================
--- trunk/pysoy/src/_core-x11/Window.pxi        2007-07-05 21:10:41 UTC (rev 
369)
+++ trunk/pysoy/src/_core-x11/Window.pxi        2007-07-05 22:01:08 UTC (rev 
370)
@@ -174,17 +174,30 @@
     window manager chooses.
     '''
     def __get__(self) :
+      cdef int          _status
+      cdef glx.Window   _root
+      cdef int          _xpos, _ypos
+      cdef unsigned int _width, _height, _border, _depth
+      cdef glx.Display  *_display
+      _display = glx.DisplayOfScreen(self._screen._screen)
       _windows.lock()
-      gl.glutSetWindow(self._windowID)
-      position = ( gl.glutGet(gl.GLUT_WINDOW_X), gl.glutGet(gl.GLUT_WINDOW_Y) )
+      _status = glx.XGetGeometry(_display, self._windowID, &_root, 
+                                 &_xpos, &_ypos, &_width, &_height, 
+                                 &_border, &_depth)
+      glx.XFlush(_display)
       _windows.unlock()
-      return position
+      if _status :
+        return (_xpos, _ypos)
+      else :
+        return (-1, -1)
     def __set__(self, value) :
+      cdef glx.Display *_display
+      _display = glx.DisplayOfScreen(self._screen._screen)
       if len(value)!=2 or type(value[0])!=int or type(value[1])!=int :
         raise TypeError('Must provide an (int,int) for position')
       _windows.lock()
-      gl.glutSetWindow(self._windowID)
-      gl.glutPositionWindow(value[0], value[1])
+      glx.XMoveWindow(_display, self._windowID, value[0], value[1])
+      glx.XFlush(_display)
       _windows.unlock()
   
   property size :

Modified: trunk/pysoy/src/_core-x11/glx.pxd
===================================================================
--- trunk/pysoy/src/_core-x11/glx.pxd   2007-07-05 21:10:41 UTC (rev 369)
+++ trunk/pysoy/src/_core-x11/glx.pxd   2007-07-05 22:01:08 UTC (rev 370)
@@ -301,11 +301,18 @@
   cdef int          XSetWMProtocols        ( Display*, Window, Atom*, int )
   cdef int          XSetStandardProperties ( Display*, Window, char*, char*,
                                              Pixmap, char**, int, XSizeHints* )
+  cdef int          XFlush                 ( Display* )
   cdef int          XMapWindow             ( Display*, Window )
   cdef int          XMapRaised             ( Display*, Window )
   cdef int          XUnmapWindow           ( Display*, Window )
+  cdef int          XMoveWindow            ( Display*, Window, int, int )
+  cdef int          XResizeWindow          ( Display*, Window, int, int )
+  cdef int          XGetGeometry           ( Display*, Window, Window*,
+                                             int*, int*, 
+                                             unsigned int*, unsigned int*,
+                                             unsigned int*, unsigned int* )
+
   
-  
 cdef extern from "X11/extensions/xf86vmode.h" :
   ctypedef int INT32
   ctypedef struct XF86VidModeModeInfo :

_______________________________________________
PySoy-SVN mailing list
[email protected]
http://www.pysoy.org/mailman/listinfo/pysoy-svn

Reply via email to