Author: dmeyer
Date: Wed May 23 19:15:35 2007
New Revision: 2684

Modified:
   trunk/display/setup.py
   trunk/display/src/x11.py
   trunk/display/src/x11display.c

Log:
check for X composite

Modified: trunk/display/setup.py
==============================================================================
--- trunk/display/setup.py      (original)
+++ trunk/display/setup.py      Wed May 23 19:15:35 2007
@@ -88,6 +88,11 @@
                     libraries = ['png', 'rt'])
 
     config.define('HAVE_X11')
+
+    if check_library('XComposite', ['<X11/extensions/Xcomposite.h>'], 
libraries = ['Xcomposite']):
+        config.define('HAVE_X11_COMPOSITE')
+        x11.add_library('XComposite')
+        
     features = []
     if get_library('imlib2') and 'X11' in get_library('imlib2').libraries:
         config.define('USE_IMLIB2_X11')

Modified: trunk/display/src/x11.py
==============================================================================
--- trunk/display/src/x11.py    (original)
+++ trunk/display/src/x11.py    Wed May 23 19:15:35 2007
@@ -163,6 +163,9 @@
     def glx_supported(self):
         return self._display.glx_supported()
 
+    def composite_supported(self):
+        return self._display.composite_supported()
+
 
 
 X11Display.XEVENT_WINDOW_EVENTS_LIST = filter(lambda x: x.find("XEVENT_") != 
-1, dir(X11Display))

Modified: trunk/display/src/x11display.c
==============================================================================
--- trunk/display/src/x11display.c      (original)
+++ trunk/display/src/x11display.c      Wed May 23 19:15:35 2007
@@ -38,6 +38,10 @@
 #ifdef ENABLE_ENGINE_GL_X11
 #include <GL/glx.h>
 #endif
+#ifdef HAVE_X11_COMPOSITE
+#include <X11/extensions/Xcomposite.h>
+#endif
+
 #include "x11display.h"
 #include "structmember.h"
 
@@ -221,6 +225,32 @@
     return Py_False;
 }
 
+PyObject *
+X11Display_PyObject__composite_supported(X11Display_PyObject * self, PyObject 
* args)
+{
+#ifdef HAVE_X11_COMPOSITE
+    int event_base, error_base;
+    if ( XCompositeQueryExtension( self->display, &event_base, &error_base ) ) 
{
+    // If we get here the server supports the extension
+       int major = 0, minor = 2; // The highest version we support
+
+       XCompositeQueryVersion( self->display, &major, &minor );
+
+       // major and minor will now contain the highest version the server 
supports.
+       // The protocol specifies that the returned version will never be higher
+       // then the one requested. Version 0.2 is the first version to have the
+       // XCompositeNameWindowPixmap() request.
+       if ( major > 0 || minor >= 2 ) {
+           Py_INCREF(Py_True);
+           return Py_True;
+       }
+    }
+#endif    
+    Py_INCREF(Py_False);
+    return Py_False;
+}
+
+
 PyMethodDef X11Display_PyObject_methods[] = {
     { "handle_events", ( PyCFunction ) X11Display_PyObject__handle_events, 
METH_VARARGS },
     { "sync", ( PyCFunction ) X11Display_PyObject__sync, METH_VARARGS },
@@ -229,6 +259,7 @@
     { "get_size", ( PyCFunction ) X11Display_PyObject__get_size, METH_VARARGS 
},
     { "get_string", ( PyCFunction ) X11Display_PyObject__get_string, 
METH_VARARGS },
     { "glx_supported", ( PyCFunction ) X11Display_PyObject__glx_supported, 
METH_VARARGS },
+    { "composite_supported", ( PyCFunction ) 
X11Display_PyObject__composite_supported, METH_VARARGS },
     { NULL, NULL }
 };
 

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Freevo-cvslog mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/freevo-cvslog

Reply via email to