1
0
Fork 0

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.
This commit is contained in:
Emmanuele Bassi 2010-10-19 10:40:57 +01:00
parent 21eb49098a
commit dd2f55c6f6
2 changed files with 19 additions and 5 deletions

View file

@ -46,9 +46,11 @@
#include "xsettings/xsettings-common.h" #include "xsettings/xsettings-common.h"
#if HAVE_XCOMPOSITE
#include <X11/extensions/Xcomposite.h> #include <X11/extensions/Xcomposite.h>
#endif
#ifdef HAVE_XINPUT #if HAVE_XINPUT
#include <X11/extensions/XInput.h> #include <X11/extensions/XInput.h>
#endif #endif
@ -940,6 +942,7 @@ clutter_x11_has_xinput (void)
gboolean gboolean
clutter_x11_has_composite_extension (void) clutter_x11_has_composite_extension (void)
{ {
#if HAVE_XCOMPOSITE
static gboolean have_composite = FALSE, done_check = FALSE; static gboolean have_composite = FALSE, done_check = FALSE;
int error = 0, event = 0; int error = 0, event = 0;
Display *dpy; Display *dpy;
@ -968,6 +971,9 @@ clutter_x11_has_composite_extension (void)
done_check = TRUE; done_check = TRUE;
return have_composite; return have_composite;
#else
return FALSE;
#endif /* HAVE_XCOMPOSITE */
} }
/** /**

View file

@ -52,7 +52,10 @@
#include "cogl/winsys/cogl-texture-pixmap-x11.h" #include "cogl/winsys/cogl-texture-pixmap-x11.h"
#include <X11/extensions/Xdamage.h> #include <X11/extensions/Xdamage.h>
#if HAVE_XCOMPOSITE
#include <X11/extensions/Xcomposite.h> #include <X11/extensions/Xcomposite.h>
#endif
enum enum
{ {
@ -920,7 +923,9 @@ clutter_x11_texture_pixmap_set_pixmap (ClutterX11TexturePixmap *texture,
* clutter_x11_texture_pixmap_set_pixmap(). * clutter_x11_texture_pixmap_set_pixmap().
* *
* If you want to display a window in a #ClutterTexture, you probably want * 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 * 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)); 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; return;
#if HAVE_XCOMPOSITE
priv = texture->priv;
if (priv->window == window && automatic == priv->window_redirect_automatic) if (priv->window == window && automatic == priv->window_redirect_automatic)
return; return;
@ -1001,6 +1007,8 @@ clutter_x11_texture_pixmap_set_window (ClutterX11TexturePixmap *texture,
clutter_x11_texture_pixmap_sync_window (texture); clutter_x11_texture_pixmap_sync_window (texture);
g_object_unref (texture); g_object_unref (texture);
#endif /* HAVE_XCOMPOSITE */
} }
/** /**