make obt check for composite
authorDana Jansens <danakj@orodu.net>
Sun, 20 Jan 2008 07:17:41 +0000 (02:17 -0500)
committerDana Jansens <danakj@orodu.net>
Mon, 4 Feb 2008 14:33:29 +0000 (09:33 -0500)
Makefile.am
configure.ac
obt/display.c
obt/display.h

index 7eaa194..a27eba2 100644 (file)
@@ -100,6 +100,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\" \
@@ -114,6 +117,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 463e7fb..b26065f 100644 (file)
@@ -160,6 +160,51 @@ else
   xcursor_found=no
 fi
 
+AC_ARG_ENABLE(xcomposite,
+  AC_HELP_STRING(
+    [--disable-xcomposite],
+    [disable use of the X Composite library. [[default=enabled]]]
+  ),
+  [enable_xcomposite=$enableval],
+  [enable_xcomposite=yes]
+)
+
+if test "$enable_xcomposite" = yes; then
+PKG_CHECK_MODULES(XRENDER, [xrender],
+  [
+    AC_DEFINE(USE_XRENDER, [1], [Use X Render library])
+    AC_SUBST(XRENDER_CFLAGS)
+    AC_SUBST(XRENDER_LIBS)
+    PKG_CHECK_MODULES(XDAMAGE, [xdamage],
+      [
+        AC_DEFINE(USE_XDAMAGE, [1], [Use X Damage library])
+        AC_SUBST(XDAMAGE_CFLAGS)
+        AC_SUBST(XDAMAGE_LIBS)
+        PKG_CHECK_MODULES(XCOMPOSITE, [xcomposite],
+          [
+            AC_DEFINE(USE_XCOMPOSITE, [1], [Use X Composite library])
+            AC_SUBST(XCOMPOSITE_CFLAGS)
+            AC_SUBST(XCOMPOSITE_LIBS)
+            xcomposite_found=yes
+          ],
+          [
+            xcomposite_found=no
+          ]
+        )
+      ],
+      [
+        xcomposite_found=no
+      ]
+    )
+  ],
+  [
+    xcomposite_found=no
+  ]
+)
+else
+  xcomposite_found=no
+fi
+
 dnl Check for session management
 X11_SM
 
@@ -195,6 +240,7 @@ AC_MSG_RESULT
 AC_MSG_RESULT([Compiling with these options:
                Startup Notification... $sn_found
                X Cursor Library... $xcursor_found
+               X Composite Library... $xcomposite_found
                Session Management... $SM
                ])
 AC_MSG_RESULT([configure complete, now type "make"])
index d72f8ad..97a2992 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
@@ -45,6 +45,8 @@ 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;
 
 static gint xerror_handler(Display *d, XErrorEvent *e);
 
@@ -109,6 +111,22 @@ gboolean obt_display_open(const char *display_name)
                       "incompatible version");
 #endif
 
+#ifdef USE_XCOMPOSITE
+        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");
+#endif
+
         obt_prop_startup();
         obt_keyboard_reload();
     }
index 8c074b5..5d99533 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_XCOMPOSITE
+#include <X11/extensions/Xcomposite.h>
+#include <X11/extensions/Xdamage.h>
+#include <X11/extensions/Xrender.h>
+#endif
 
 G_BEGIN_DECLS
 
@@ -53,6 +58,8 @@ 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 Display* obt_display;