From dd2f55c6f6bbc2f0a12b70ccf90cf7840b6e2212 Mon Sep 17 00:00:00 2001 From: Emmanuele Bassi Date: Tue, 19 Oct 2010 10:40:57 +0100 Subject: [PATCH] x11: Protect XComposite API calls Since we allow compiling Clutter without the XComposite extension available, we need to protect the calls to the XComposite API with the guards provided by the configure script. --- clutter/x11/clutter-backend-x11.c | 8 +++++++- clutter/x11/clutter-x11-texture-pixmap.c | 16 ++++++++++++---- 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/clutter/x11/clutter-backend-x11.c b/clutter/x11/clutter-backend-x11.c index 9b9d1c96f..084839674 100644 --- a/clutter/x11/clutter-backend-x11.c +++ b/clutter/x11/clutter-backend-x11.c @@ -46,9 +46,11 @@ #include "xsettings/xsettings-common.h" +#if HAVE_XCOMPOSITE #include +#endif -#ifdef HAVE_XINPUT +#if HAVE_XINPUT #include #endif @@ -940,6 +942,7 @@ clutter_x11_has_xinput (void) gboolean clutter_x11_has_composite_extension (void) { +#if HAVE_XCOMPOSITE static gboolean have_composite = FALSE, done_check = FALSE; int error = 0, event = 0; Display *dpy; @@ -968,6 +971,9 @@ clutter_x11_has_composite_extension (void) done_check = TRUE; return have_composite; +#else + return FALSE; +#endif /* HAVE_XCOMPOSITE */ } /** diff --git a/clutter/x11/clutter-x11-texture-pixmap.c b/clutter/x11/clutter-x11-texture-pixmap.c index d647e0046..47a34ce3e 100644 --- a/clutter/x11/clutter-x11-texture-pixmap.c +++ b/clutter/x11/clutter-x11-texture-pixmap.c @@ -52,7 +52,10 @@ #include "cogl/winsys/cogl-texture-pixmap-x11.h" #include + +#if HAVE_XCOMPOSITE #include +#endif enum { @@ -920,7 +923,9 @@ clutter_x11_texture_pixmap_set_pixmap (ClutterX11TexturePixmap *texture, * clutter_x11_texture_pixmap_set_pixmap(). * * If you want to display a window in a #ClutterTexture, you probably want - * this function, or its older sister, clutter_glx_texture_pixmap_set_window() + * this function, or its older sister, clutter_glx_texture_pixmap_set_window(). + * + * This function has no effect unless the XComposite extension is available. * * Since: 0.8 */ @@ -935,11 +940,12 @@ clutter_x11_texture_pixmap_set_window (ClutterX11TexturePixmap *texture, g_return_if_fail (CLUTTER_X11_IS_TEXTURE_PIXMAP (texture)); - priv = texture->priv; - - if (!clutter_x11_has_composite_extension()) + if (!clutter_x11_has_composite_extension ()) return; +#if HAVE_XCOMPOSITE + priv = texture->priv; + if (priv->window == window && automatic == priv->window_redirect_automatic) return; @@ -1001,6 +1007,8 @@ clutter_x11_texture_pixmap_set_window (ClutterX11TexturePixmap *texture, clutter_x11_texture_pixmap_sync_window (texture); g_object_unref (texture); + +#endif /* HAVE_XCOMPOSITE */ } /**