From 36ad7dd99dbcd00c440d9dc68a9b22dea6e01867 Mon Sep 17 00:00:00 2001 From: Dana Jansens Date: Sun, 20 Jan 2008 02:17:41 -0500 Subject: [PATCH] Check for compositing manager support requested, and the required components. Will turn on compositing, and set USE_COMPOSITING, when XComposite, XDamage, XRender, XFixes, and GL/GLX are available. Also checks for the XFixes, XRender, XComposite, and XDamage extensions at runtime when USE_COMPOSITING is enabled by configure --- Makefile.am | 6 +++++ configure.ac | 70 +++++++++++++++++++++++++++++++++++++++++++++++++++ obt/display.c | 47 +++++++++++++++++++++++++++++++--- obt/display.h | 16 +++++++++++- 4 files changed, 135 insertions(+), 4 deletions(-) diff --git a/Makefile.am b/Makefile.am index 66de3ae7..1065da01 100644 --- a/Makefile.am +++ b/Makefile.am @@ -159,6 +159,9 @@ obt_libobt_la_CPPFLAGS = \ $(XRANDR_CFLAGS) \ $(XSHAPE_CFLAGS) \ $(XSYNC_CFLAGS) \ + $(XRENDER_CFLAGS) \ + $(XDAMAGE_CFLAGS) \ + $(XCOMPOSITE_CFLAGS) \ $(GLIB_CFLAGS) \ $(XML_CFLAGS) \ -DG_LOG_DOMAIN=\"Obt\" \ @@ -173,6 +176,9 @@ obt_libobt_la_LIBADD = \ $(XRANDR_LIBS) \ $(XSHAPE_LIBS) \ $(XSYNC_LIBS) \ + $(XRENDER_LIBS) \ + $(XDAMAGE_LIBS) \ + $(XCOMPOSITE_LIBS) \ $(GLIB_LIBS) \ $(XML_LIBS) obt_libobt_la_SOURCES = \ diff --git a/configure.ac b/configure.ac index 2d3fa7d3..da37f2c8 100644 --- a/configure.ac +++ b/configure.ac @@ -217,6 +217,75 @@ fi AM_CONDITIONAL(USE_IMLIB2, [test $imlib2_found = yes]) +AC_ARG_ENABLE(compositing, + AC_HELP_STRING( + [--disable-compositing], + [disable the built-in compositing manager [[default=enabled]]] + ), + [enable_compositing=$enableval], + [enable_compositing=yes] +) + +AC_MSG_CHECKING(if compositing manager support should be enabled) +AC_MSG_RESULT($enable_compositing) + +if test "$enable_compositing" = yes; then + PKG_CHECK_MODULES(XCOMPOSITE, [xcomposite]) + AC_SUBST(XCOMPOSITE_CFLAGS) + AC_SUBST(XCOMPOSITE_LIBS) + + PKG_CHECK_MODULES([XRENDER], [xrender]) + AC_SUBST(XRENDER_CFLAGS) + AC_SUBST(XRENDER_LIBS) + + PKG_CHECK_MODULES(XDAMAGE, [xdamage]) + AC_SUBST(XDAMAGE_CFLAGS) + AC_SUBST(XDAMAGE_LIBS) + + PKG_CHECK_MODULES(XFIXES, [xfixes]) + AC_SUBST(XDAMAGE_CFLAGS) + AC_SUBST(XDAMAGE_LIBS) + + AC_MSG_CHECKING(for GL_CFLAGS) + AC_ARG_WITH(gl-cflags, [ --with-gl-cflags=CFLAGS ], + [GL_CFLAGS="$withval"], + [GL_CFLAGS=""]) + + AC_MSG_RESULT($GL_CFLAGS) + AC_MSG_CHECKING(for GL_LIBS) + AC_ARG_WITH(gl-libs, [ --with-gl-libs=LIBS ], + [GL_LIBS="$withval"], + [GL_LIBS="-lGL"]) + AC_MSG_RESULT($GL_LIBS) + + AC_CHECK_LIB([GL], [glPopMatrix], , + AC_MSG_ERROR([Could not find glPopMatrix in -lGL.])) + + AC_MSG_CHECKING([for GL/gl.h]) + AC_TRY_COMPILE( + [#include ], + [GLenum e = GL_INVALID_ENUM;], + [AC_MSG_RESULT([yes])], + [AC_MSG_RESULT([no]) + AC_MSG_ERROR([Could not compile with GL/gl.h])]) + + AC_MSG_CHECKING([for GL/glx.h]) + AC_TRY_COMPILE( + [#include ], + [int i = GLX_USE_GL;], + [AC_MSG_RESULT([yes])], + [AC_MSG_RESULT([no]) + AC_MSG_ERROR([Could not compile with GL/glx.h])]) + + AC_SUBST(GL_CFLAGS) + AC_SUBST(GL_LIBS) + + AC_DEFINE(USE_COMPOSITING, [1], [Support being a compositing manager]) + do_compositing="yes" +else + do_compositing="no" +fi + dnl Check for session management X11_SM @@ -255,5 +324,6 @@ AC_MSG_RESULT([Compiling with these options: X Cursor Library... $xcursor_found Session Management... $SM Imlib2 library... $imlib2_found + Compositing manager... $do_compositing ]) AC_MSG_RESULT([configure complete, now type "make"]) diff --git a/obt/display.c b/obt/display.c index 8b06cbfc..5d0d0549 100644 --- a/obt/display.c +++ b/obt/display.c @@ -1,7 +1,7 @@ /* -*- indent-tabs-mode: nil; tab-width: 4; c-basic-offset: 4; -*- obt/display.c for the Openbox window manager - Copyright (c) 2007 Dana Jansens + Copyright (c) 2007-2008 Dana Jansens This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -50,6 +50,14 @@ gboolean obt_display_extension_randr = FALSE; gint obt_display_extension_randr_basep; gboolean obt_display_extension_sync = FALSE; gint obt_display_extension_sync_basep; +gboolean obt_display_extension_composite = FALSE; +gint obt_display_extension_composite_basep; +gboolean obt_display_extension_damage = FALSE; +gint obt_display_extension_damage_basep; +gboolean obt_display_extension_render = FALSE; +gint obt_display_extension_render_basep; +gboolean obt_display_extension_fixes = FALSE; +gint obt_display_extension_fixes_basep; static gint xerror_handler(Display *d, XErrorEvent *e); @@ -112,8 +120,41 @@ gboolean obt_display_open(const char *display_name) XSyncQueryExtension(d, &obt_display_extension_sync_basep, &junk) && XSyncInitialize(d, &junk, &junk); if (!obt_display_extension_sync) - g_message("X Sync extension is not present on the server or is an " - "incompatible version"); + g_message("X Sync extension is not present on the server"); +#endif + +#ifdef USE_COMPOSITING + if (XCompositeQueryExtension(d, &obt_display_extension_composite_basep, + &junk)) + { + gint major = 0, minor = 2; + XCompositeQueryVersion(d, &major, &minor); + /* Version 0.2 is the first version to have the + XCompositeNameWindowPixmap() request. */ + if (major > 0 || minor >= 2) + obt_display_extension_composite = TRUE; + } + if (!obt_display_extension_composite) + g_message("X Composite extension is not present on the server or " + "is an incompatible version"); + + obt_display_extension_damage = + XDamageQueryExtension(d, &obt_display_extension_damage_basep, + &junk); + if (!obt_display_extension_damage) + g_message("X Damage extension is not present on the server"); + + obt_display_extension_render = + XRenderQueryExtension(d, &obt_display_extension_render_basep, + &junk); + if (!obt_display_extension_render) + g_message("X Render extension is not present on the server"); + + obt_display_extension_fixes = + XFixesQueryExtension(d, &obt_display_extension_fixes_basep, + &junk); + if (!obt_display_extension_fixes) + g_message("X Fixes extension is not present on the server"); #endif obt_prop_startup(); diff --git a/obt/display.h b/obt/display.h index b5816a9a..7d4a23c4 100644 --- a/obt/display.h +++ b/obt/display.h @@ -1,7 +1,7 @@ /* -*- indent-tabs-mode: nil; tab-width: 4; c-basic-offset: 4; -*- obt/display.h for the Openbox window manager - Copyright (c) 2007 Dana Jansens + Copyright (c) 2007-2008 Dana Jansens This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -38,6 +38,12 @@ #ifdef SYNC #include #endif +#ifdef USE_COMPOSITING +#include +#include +#include +#include +#endif G_BEGIN_DECLS @@ -53,6 +59,14 @@ extern gboolean obt_display_extension_randr; extern gint obt_display_extension_randr_basep; extern gboolean obt_display_extension_sync; extern gint obt_display_extension_sync_basep; +extern gboolean obt_display_extension_composite; +extern gint obt_display_extension_composite_basep; +extern gboolean obt_display_extension_damage; +extern gint obt_display_extension_damage_basep; +extern gboolean obt_display_extension_render; +extern gint obt_display_extension_render_basep; +extern gboolean obt_display_extension_fixes; +extern gint obt_display_extension_fixes_basep; extern Display* obt_display; -- 2.39.2