From 29e5531486c2fab470d71c802d9e644e124a6ecb Mon Sep 17 00:00:00 2001 From: Emmanuele Bassi Date: Tue, 12 Apr 2011 20:28:36 +0100 Subject: [PATCH] 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. --- cogl/winsys/cogl-winsys-glx.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/cogl/winsys/cogl-winsys-glx.c b/cogl/winsys/cogl-winsys-glx.c index 6bd6850ba..358ef33b5 100644 --- a/cogl/winsys/cogl-winsys-glx.c +++ b/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; }