[clutter] glx: Protect GLX SwapEvent symbols



commit 6aafb7d3de95cd90f7f7273265edc84d4d91e7c1
Author: Emmanuele Bassi <ebassi linux intel com>
Date:   Tue Apr 12 20:28:36 2011 +0100

    glx: Protect GLX SwapEvent symbols
    
    We need to guard the usage of symbols related to the
    GLX_INTEL_swap_event extension, to avoid breaking on platforms and/or
    versions of Mesa that do not expose that extension.

 clutter/cogl/cogl/winsys/cogl-winsys-glx.c |   14 +++++++++++---
 1 files changed, 11 insertions(+), 3 deletions(-)
---
diff --git a/clutter/cogl/cogl/winsys/cogl-winsys-glx.c b/clutter/cogl/cogl/winsys/cogl-winsys-glx.c
index 6bd6850..358ef33 100644
--- a/clutter/cogl/cogl/winsys/cogl-winsys-glx.c
+++ b/clutter/cogl/cogl/winsys/cogl-winsys-glx.c
@@ -238,14 +238,22 @@ glx_event_filter_cb (XEvent *xevent, void *data)
                                                 xevent->xconfigure.width,
                                                 xevent->xconfigure.height);
         }
+
+      /* we let ConfigureNotify pass through */
+      return COGL_XLIB_FILTER_CONTINUE;
     }
-  else if (xevent->type ==
-           (glx_renderer->glx_event_base + GLX_BufferSwapComplete))
+
+#ifdef GLX_INTEL_swap_event
+  if (xevent->type == (glx_renderer->glx_event_base + GLX_BufferSwapComplete))
     {
-      GLXBufferSwapComplete *swap_event = (GLXBufferSwapComplete *)xevent;
+      GLXBufferSwapComplete *swap_event = (GLXBufferSwapComplete *) xevent;
+
       notify_swap_buffers (context, swap_event->drawable);
+
+      /* remove SwapComplete events from the queue */
       return COGL_XLIB_FILTER_REMOVE;
     }
+#endif /* GLX_INTEL_swap_event */
 
   return COGL_XLIB_FILTER_CONTINUE;
 }



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]