Author: tack
Date: Tue Jan 16 15:32:23 2007
New Revision: 2406

Modified:
   trunk/display/src/x11.py
   trunk/display/src/x11window.c

Log:
Handle long/int types equally.


Modified: trunk/display/src/x11.py
==============================================================================
--- trunk/display/src/x11.py    (original)
+++ trunk/display/src/x11.py    Tue Jan 16 15:32:23 2007
@@ -187,11 +187,11 @@
 class X11Window(object):
     def __init__(self, display = None, window = None, **kwargs):
         """
-        Create a new X11 window or wrap an existing X11 window.  If display
-        is None, it will use the default display (based on the DISPLAY
-        environment variable).  If window is an integer, it will wrap an
-        existing X11 window.  The window parameter may also be a lower
-        level _X11.X11Window object.
+        Create a new X11 window or wrap an existing X11 window.  If display is
+        None, it will use the default display (based on the DISPLAY environment
+        variable).  If window is a numeric, it will consider it a window id and
+        can be used to wrap an existing X11 window.  The window parameter may
+        also be a lower level _X11.X11Window object.
 
         If window is none, then a new window will be created, and the
         following kwargs apply:
@@ -202,9 +202,9 @@
         """
         display = _get_display(display)
         if window:
-            if isinstance(window, int):
+            if isinstance(window, (long, int)):
                 # Create new X11Window object based on existing window id.
-                self._window = _X11.X11Window(display._display, (-1, -1), 
window = window)
+                self._window = _X11.X11Window(display._display, (-1, -1), 
window = long(window))
             elif isinstance(window, _X11.X11Window):
                 self._window = window
             else:

Modified: trunk/display/src/x11window.c
==============================================================================
--- trunk/display/src/x11window.c       (original)
+++ trunk/display/src/x11window.c       Tue Jan 16 15:32:23 2007
@@ -116,7 +116,7 @@
     XLockDisplay(self->display);
 
     if (PyMapping_HasKeyString(kwargs, "window")) {
-        self->window = (Window)PyInt_AsLong(PyDict_GetItemString(kwargs, 
"window"));
+        self->window = (Window)PyLong_AsVoidPtr(PyDict_GetItemString(kwargs, 
"window"));
     } else {
         screen = DefaultScreen(self->display);
         attr.backing_store = NotUseful;

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Freevo-cvslog mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/freevo-cvslog

Reply via email to