Check for compositing manager support requested, and the required components.
authorDana Jansens <danakj@orodu.net>
Sun, 20 Jan 2008 07:17:41 +0000 (02:17 -0500)
committerDana Jansens <danakj@orodu.net>
Sat, 26 Jun 2010 23:30:46 +0000 (01:30 +0200)
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
configure.ac
obt/display.c
obt/display.h

index 66de3ae78c3b3c992f204ef97d94aa9868cc818d..1065da012a139de7f546fed81dbc5e2d39727dc6 100644 (file)
@@ -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 = \
index 2d3fa7d38abbcb56e971b27183571b01f25d820d..da37f2c8a628343f9a4d12330334e746bad113f9 100644 (file)
@@ -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 <GL/gl.h>],
+    [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 <GL/glx.h>],
+    [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"])
index 8b06cbfcf6cac47d213fe5a7ec33f12e6fbd1359..5d0d0549615a6c3cf6a7843bfef2df4b6576a957 100644 (file)
@@ -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();
index b5816a9a58e5770e0910297e09f752cb4afa8c5b..7d4a23c4ceaab5fe0722fd9452fe71daf3546e74 100644 (file)
@@ -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
 #ifdef    SYNC
 #include <X11/extensions/sync.h>
 #endif
+#ifdef    USE_COMPOSITING
+#include <X11/extensions/Xcomposite.h>
+#include <X11/extensions/Xdamage.h>
+#include <X11/extensions/Xrender.h>
+#include <X11/extensions/Xfixes.h>
+#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;