Author: ArcRiley
Date: 2008-03-05 14:02:09 -0500 (Wed, 05 Mar 2008)
New Revision: 1047

Modified:
   trunk/pysoy/src/_core/Window-w32.pxi
   trunk/pysoy/src/_core/Window-x11.pxi
Log:
Ticket #901 :
  * more work on Window (x11 and w32), a few things I missed


Modified: trunk/pysoy/src/_core/Window-w32.pxi
===================================================================
--- trunk/pysoy/src/_core/Window-w32.pxi        2008-03-05 18:50:20 UTC (rev 
1046)
+++ trunk/pysoy/src/_core/Window-w32.pxi        2008-03-05 19:02:09 UTC (rev 
1047)
@@ -147,7 +147,6 @@
 
 
   cdef void _destroy(self) :
-    #_windows.lock()
     windows.wglDeleteContext(self._glRenderContext)
     self._glRenderContext = NULL
     windows.ReleaseDC(self._window, self._deviceContext)
@@ -156,7 +155,6 @@
     self._window = NULL
     self._opened = -1
     _windows.remove(<void *> self)
-    #_windows.unlock()
     
 
   cdef void _registerClass(self) :
@@ -277,10 +275,9 @@
 
     def __set__(self, value) :
       if type(value) == str :
-        _windows.lock()
+        # self lock here
         self._request = self._request | _TITLE
         self._title = value
-        _windows.unlock()
 
 
   property background:
@@ -307,23 +304,22 @@
     '''
     def __get__(self) :
       cdef int _x, _y
-      _windows.lock()
+      # self lock here
       if not get_window_pos(self._window, &_x, &_y) :
-        _windows.unlock()
+        # self unlock
         raise SystemError("Couldn't get window position.")
-      _windows.unlock()
+      # self unlock
       return (_x, _y)
 
     def __set__(self, value) :
       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()
+      # self lock
       self._x = value[0]
       self._y = value[1]
       self._request = self._request | _POSITION
       #if not set_window_pos(self._window, value[0], value[1]):
       #  raise SystemError("Couldn't set window position.")
-      _windows.unlock()
 
 
   property size :
@@ -340,14 +336,13 @@
     def __set__(self, value) :
       if len(value)!=2 or type(value[0])!=int or type(value[1])!=int :
         raise TypeError('Must provide an (int,int) for size')
-      _windows.lock()
+      # self lock
       self._resize(value[0], value[1])
       self._request = self._request | _SIZE
       #if not set_window_size(self._window, value[0], value[1]):
       #  raise SystemError("Couldn't set window size.")
       #self._width = value[0]
       #self._height = value[1]
-      _windows.unlock()
 
 
   property minimized :

Modified: trunk/pysoy/src/_core/Window-x11.pxi
===================================================================
--- trunk/pysoy/src/_core/Window-x11.pxi        2008-03-05 18:50:20 UTC (rev 
1046)
+++ trunk/pysoy/src/_core/Window-x11.pxi        2008-03-05 19:02:09 UTC (rev 
1047)
@@ -328,9 +328,8 @@
       else :
         self._title = ''
       if self._opened :
-        _windows.lock()
+        # self lock here
         self._setProperties()
-        _windows.unlock()
 
 
   property icon:
@@ -373,11 +372,10 @@
       cdef glx.Window   *_children
       cdef int           _xpos, _ypos
       cdef unsigned int  _width, _height, _border, _depth, _nchildren
-      _windows.lock()
+      #
       _status = glx.XQueryTree(_display, self._windowID,
                                &_root, &_parent, &_children, &_nchildren)
       if not _status :
-        _windows.unlock()
         raise RuntimeError('could not XQueryTree')
       if _root == _parent :
         _status = glx.XGetGeometry(_display, self._windowID, &_root, 
@@ -388,25 +386,26 @@
         _status = glx.XGetGeometry(_display, _parent, &_root, 
                                    &_xpos, &_ypos, &_width, &_height, 
                                    &_border, &_depth)
-      _windows.unlock()
       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()
+      #
+      # We may need a lock here
+      #
       _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 :
-        _windows.unlock()
         raise RuntimeError('could not XFlush')
-      _windows.unlock()
+
   
   property size :
     '''Window size
@@ -418,23 +417,24 @@
     '''
     def __get__(self) :
       return (self._width, self._height)
+
     def __set__(self, value) :
       cdef int           _status
       if len(value)!=2 or type(value[0])!=int or type(value[1])!=int :
         raise TypeError('Must provide an (int,int) for size')
-      _windows.lock()
+      #
+      # We may need a lock here
+      #
       _status = glx.XResizeWindow(_display, self._windowID, value[0], value[1])
       if not _status :
-        _windows.unlock()
         raise RuntimeError('could not XResizeWindow')
       _status = glx.XFlush(_display)
       if not _status :
-        _windows.unlock()
         raise RuntimeError('could not XFlush')
       self._width = value[0]
       self._height = value[1]
-      _windows.unlock()
 
+
   def __repr__(self) :
     report = []
     if self._widgets._current == 1 :

_______________________________________________
PySoy-SVN mailing list
PySoy-SVN@pysoy.org
http://www.pysoy.org/mailman/listinfo/pysoy-svn

Reply via email to