Author: ArcRiley
Date: 2007-07-05 18:38:44 -0400 (Thu, 05 Jul 2007)
New Revision: 371
Modified:
trunk/pysoy/src/_core-x11/Window.pxi
trunk/pysoy/src/_core-x11/glx.pxd
Log:
soy.Window.position now works perfectly, fixes #247
Modified: trunk/pysoy/src/_core-x11/Window.pxi
===================================================================
--- trunk/pysoy/src/_core-x11/Window.pxi 2007-07-05 22:01:08 UTC (rev
370)
+++ trunk/pysoy/src/_core-x11/Window.pxi 2007-07-05 22:38:44 UTC (rev
371)
@@ -174,30 +174,47 @@
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 int _status
+ cdef glx.Window _root, _parent
+ cdef glx.Window *_children
+ cdef int _xpos, _ypos
+ cdef unsigned int _width, _height, _border, _depth, _nchildren
cdef glx.Display *_display
+
_display = glx.DisplayOfScreen(self._screen._screen)
+ _xpos2 = 0
+ _ypos2 = 0
_windows.lock()
- _status = glx.XGetGeometry(_display, self._windowID, &_root,
- &_xpos, &_ypos, &_width, &_height,
- &_border, &_depth)
- glx.XFlush(_display)
+ _status = glx.XQueryTree(_display, self._windowID,
+ &_root, &_parent, &_children, &_nchildren)
+ if not _status :
+ raise RuntimeError('could not XQueryTree')
+ if _root == _parent :
+ _status = glx.XGetGeometry(_display, self._windowID, &_root,
+ &_xpos, &_ypos, &_width, &_height,
+ &_border, &_depth)
+ else :
+ # Help, we're in a decoration window!
+ _status = glx.XGetGeometry(_display, _parent, &_root,
+ &_xpos, &_ypos, &_width, &_height,
+ &_border, &_depth)
_windows.unlock()
- if _status :
- return (_xpos, _ypos)
- else :
- return (-1, -1)
+ if not _status :
+ raise RuntimeError('could not XGetGeometry')
+ return (_xpos, _ypos)
def __set__(self, value) :
+ cdef int _status
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()
- glx.XMoveWindow(_display, self._windowID, value[0], value[1])
- glx.XFlush(_display)
+ _status = glx.XMoveWindow(_display, self._windowID, value[0], value[1])
+ if not _status :
+ raise RuntimeError('could not XMoveWindow')
+ _status = glx.XFlush(_display)
+ if not _status :
+ raise RuntimeError('could not XFlush')
_windows.unlock()
property size :
Modified: trunk/pysoy/src/_core-x11/glx.pxd
===================================================================
--- trunk/pysoy/src/_core-x11/glx.pxd 2007-07-05 22:01:08 UTC (rev 370)
+++ trunk/pysoy/src/_core-x11/glx.pxd 2007-07-05 22:38:44 UTC (rev 371)
@@ -311,7 +311,10 @@
int*, int*,
unsigned int*, unsigned int*,
unsigned int*, unsigned int* )
+ cdef int XQueryTree ( Display*, Window, Window*,
+ Window*, Window**, unsigned int* )
+
cdef extern from "X11/extensions/xf86vmode.h" :
ctypedef int INT32
_______________________________________________
PySoy-SVN mailing list
[email protected]
http://www.pysoy.org/mailman/listinfo/pysoy-svn