Update of /cvsroot/freevo/kaa/display/src
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14962

Modified Files:
        display.c evas.c imlib2.c x11display.c x11window.c 
Log Message:
Support for threaded Xlib, which will be necessary for kaa-xine.


Index: x11display.c
===================================================================
RCS file: /cvsroot/freevo/kaa/display/src/x11display.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** x11display.c        13 Jul 2005 18:07:25 -0000      1.7
--- x11display.c        15 Jul 2005 17:29:55 -0000      1.8
***************
*** 88,91 ****
--- 88,92 ----
      XEvent ev;
  
+     XLockDisplay(self->display);
      XSync(self->display, False);
      while (XPending(self->display)) {
***************
*** 121,124 ****
--- 122,126 ----
          }
      }
+     XUnlockDisplay(self->display);
      return events;
  }
***************
*** 127,131 ****
--- 129,135 ----
  X11Display_PyObject__sync(X11Display_PyObject * self, PyObject * args)
  {
+     XLockDisplay(self->display);
      XSync(self->display, False);
+     XUnlockDisplay(self->display);
      return Py_INCREF(Py_None), Py_None;
  }

Index: display.c
===================================================================
RCS file: /cvsroot/freevo/kaa/display/src/display.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** display.c   13 Jul 2005 18:07:25 -0000      1.8
--- display.c   15 Jul 2005 17:29:55 -0000      1.9
***************
*** 52,57 ****
  };
  
- PyTypeObject *Evas_PyObject_Type;
- 
  void **get_module_api(char *module)
  {
--- 52,55 ----
***************
*** 112,114 ****
--- 110,115 ----
      Evas_PyObject_Type = NULL;
  #endif
+ 
+     if (!XInitThreads())
+         PyErr_Format(PyExc_SystemError, "Unable to initialize X11 threads.");
  }

Index: x11window.c
===================================================================
RCS file: /cvsroot/freevo/kaa/display/src/x11window.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** x11window.c 13 Jul 2005 18:07:25 -0000      1.7
--- x11window.c 15 Jul 2005 17:29:55 -0000      1.8
***************
*** 86,89 ****
--- 86,90 ----
      Py_INCREF(display);
      self->display = display->display;
+     XLockDisplay(self->display);
      self->window = XCreateSimpleWindow(self->display,
              DefaultRootWindow(self->display), 0, 0, w, h, 0, 0, 0);
***************
*** 93,96 ****
--- 94,98 ----
      self->ptr = PyInt_FromLong(self->window);
      _make_invisible_cursor(self);
+     XUnlockDisplay(self->display);
      return (PyObject *)self;
  }
***************
*** 108,114 ****
--- 110,118 ----
      if (self->window) {
          //printf("X11Window destroy\n");
+         XLockDisplay(self->display);
          XDestroyWindow(self->display, self->window);
          Py_XDECREF(self->ptr);
          XFreeCursor(self->display, self->invisible_cursor);
+         XUnlockDisplay(self->display);
      }
      Py_XDECREF(self->display_pyobject);
***************
*** 121,127 ****
  X11Window_PyObject__show(X11Window_PyObject * self, PyObject * args)
  {
!     XMapWindow(self->display, self->window);
!     XRaiseWindow(self->display, self->window);
      XSync(self->display, False);
      return Py_INCREF(Py_None), Py_None;
  }
--- 125,132 ----
  X11Window_PyObject__show(X11Window_PyObject * self, PyObject * args)
  {
!     XLockDisplay(self->display);
!     XMapRaised(self->display, self->window);
      XSync(self->display, False);
+     XUnlockDisplay(self->display);
      return Py_INCREF(Py_None), Py_None;
  }
***************
*** 130,135 ****
--- 135,142 ----
  X11Window_PyObject__hide(X11Window_PyObject * self, PyObject * args)
  {
+     XLockDisplay(self->display);
      XUnmapWindow(self->display, self->window);
      XSync(self->display, False);
+     XUnlockDisplay(self->display);
      return Py_INCREF(Py_None), Py_None;
  }
***************
*** 143,146 ****
--- 150,154 ----
          return NULL;
  
+     XLockDisplay(self->display);
      if (x != -1 && w != -1)
          XMoveResizeWindow(self->display, self->window, x, y, w, h);
***************
*** 151,154 ****
--- 159,163 ----
  
      XSync(self->display, False);
+     XUnlockDisplay(self->display);
      return Py_INCREF(Py_None), Py_None;
  }
***************
*** 162,169 ****
--- 171,180 ----
          return NULL;
  
+     XLockDisplay(self->display);
      if (!visible)
          XDefineCursor(self->display, self->window, self->invisible_cursor);
      else
          XUndefineCursor(self->display, self->window);
+     XUnlockDisplay(self->display);
  
      return Py_INCREF(Py_None), Py_None;
***************
*** 174,178 ****
--- 185,191 ----
  {
      XWindowAttributes attrs;
+     XLockDisplay(self->display);
      XGetWindowAttributes(self->display, self->window, &attrs);
+     XUnlockDisplay(self->display);
      return Py_BuildValue("((ii)(ii))", attrs.x, attrs.y, attrs.width,
                           attrs.height);
***************
*** 205,209 ****
--- 218,224 ----
      o->window = window;
      o->ptr = PyInt_FromLong(window);
+     XLockDisplay(o->display);
      _make_invisible_cursor(o);
+     XUnlockDisplay(o->display);
      return o;
  }

Index: evas.c
===================================================================
RCS file: /cvsroot/freevo/kaa/display/src/evas.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** evas.c      11 Jul 2005 13:54:44 -0000      1.5
--- evas.c      15 Jul 2005 17:29:55 -0000      1.6
***************
*** 32,39 ****
  
  #include "config.h"
  
  #ifdef USE_EVAS
  
- #include <Python.h>
  #include "evas.h"
  #include "x11display.h"
--- 32,42 ----
  
  #include "config.h"
+ #include <Python.h>
+ 
+ PyTypeObject *Evas_PyObject_Type;
+ 
  
  #ifdef USE_EVAS
  
  #include "evas.h"
  #include "x11display.h"
***************
*** 82,85 ****
--- 85,89 ----
      attr.bit_gravity = ForgetGravity;
  
+     XLockDisplay(o->display);
      screen = DefaultScreen(disp->display);
  
***************
*** 96,99 ****
--- 100,104 ----
      *ei_drawable = win;
      XStoreName(disp->display, win, title);
+     XUnlockDisplay(o->display);
  
      win_object = X11Window_PyObject__wrap((PyObject *)disp, win);

Index: imlib2.c
===================================================================
RCS file: /cvsroot/freevo/kaa/display/src/imlib2.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** imlib2.c    10 Jul 2005 17:53:17 -0000      1.3
--- imlib2.c    15 Jul 2005 17:29:55 -0000      1.4
***************
*** 34,40 ****
  #include <Python.h>
  
  #ifdef USE_IMLIB2
  #include "imlib2.h"
- PyTypeObject *Image_PyObject_Type;
  Imlib_Image *(*imlib_image_from_pyobject)(PyObject *pyimg);
  #endif
--- 34,41 ----
  #include <Python.h>
  
+ PyTypeObject *Image_PyObject_Type;
+ 
  #ifdef USE_IMLIB2
  #include "imlib2.h"
  Imlib_Image *(*imlib_image_from_pyobject)(PyObject *pyimg);
  #endif



-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
_______________________________________________
Freevo-cvslog mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/freevo-cvslog

Reply via email to