[mutter] Add compatibility with GTK+ 2.18



commit e267a633307a5c040b77f75e9cde7b5a2db0bd8a
Author: Florian Müllner <fmuellner gnome org>
Date:   Mon Jun 14 12:48:27 2010 +0200

    Add compatibility with GTK+ 2.18
    
    In order to replace calls to deprecated GDK code, the current
    development version of GTK+ is required. Add some basic compatibility
    code to allow building mutter with GTK+ 2.18.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=587991

 configure.in     |    2 +-
 src/Makefile.am  |    1 +
 src/gdk-compat.h |   35 +++++++++++++++++++++++++++++++++++
 src/ui/frames.c  |    1 +
 src/ui/ui.c      |    1 +
 5 files changed, 39 insertions(+), 1 deletions(-)
---
diff --git a/configure.in b/configure.in
index 836ac6c..eff4b35 100644
--- a/configure.in
+++ b/configure.in
@@ -124,7 +124,7 @@ if test "x$GCC" = "xyes"; then
 fi
 changequote([,])dnl
 
-MUTTER_PC_MODULES='gtk+-2.0 >= 2.21.1 pango >= 1.2.0'
+MUTTER_PC_MODULES='gtk+-2.0 >= 2.18 pango >= 1.2.0'
 
 AC_ARG_ENABLE(gconf,
   AC_HELP_STRING([--disable-gconf],
diff --git a/src/Makefile.am b/src/Makefile.am
index cc1c3a4..1753d4a 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -39,6 +39,7 @@ mutter_SOURCES= 				\
 	compositor/mutter-shaped-texture.h	\
 	compositor/tidy/tidy-texture-frame.c	\
 	compositor/tidy/tidy-texture-frame.h	\
+	gdk-compat.h				\
 	gtk-compat.h				\
 	include/compositor.h			\
 	include/mutter-plugin.h			\
diff --git a/src/gdk-compat.h b/src/gdk-compat.h
new file mode 100644
index 0000000..236efab
--- /dev/null
+++ b/src/gdk-compat.h
@@ -0,0 +1,35 @@
+#ifndef __GDK_COMPAT_H__
+#define __GDK_COMPAT_H__
+
+#include <gdk/gdk.h>
+
+/* Provide a compatibility layer for accessor function introduced
+ * in GTK+ 2.22 which we need to build without deprecated GDK symbols.
+ * That way it is still possible to build with GTK+ 2.18 when not
+ * using GDK_DISABLE_DEPRECATED.
+ */
+
+#if !GTK_CHECK_VERSION (2, 21, 1)
+
+#define gdk_window_get_background(w,c)    *c = GDK_WINDOW_OBJECT (w)->bg_color
+#define gdk_visual_get_depth(v)           GDK_VISUAL(v)->depth
+#define gdk_window_get_back_pixmap(w,p,r)                           \
+  G_STMT_START {                                                    \
+    GdkWindowObject *priv = GDK_WINDOW_OBJECT (w);                  \
+                                                                    \
+    if (p != NULL)                                                  \
+      {                                                             \
+        if (priv->bg_pixmap == GDK_PARENT_RELATIVE_BG ||            \
+            priv->bg_pixmap == GDK_NO_BG)                           \
+          *p = NULL;                                                \
+        else                                                        \
+          *p = priv->bg_pixmap;                                     \
+      }                                                             \
+                                                                    \
+    if (r != NULL)                                                  \
+      *r = (priv->bg_pixmap == GDK_PARENT_RELATIVE_BG);             \
+  } G_STMT_END
+
+#endif /*GTK_CHECK_VERSION */
+
+#endif /* __GDK_COMPAT_H__ */
diff --git a/src/ui/frames.c b/src/ui/frames.c
index a0387c1..dce5f52 100644
--- a/src/ui/frames.c
+++ b/src/ui/frames.c
@@ -36,6 +36,7 @@
 #include "ui.h"
 
 #include "gtk-compat.h"
+#include "gdk-compat.h"
 
 #ifdef HAVE_SHAPE
 #include <X11/extensions/shape.h>
diff --git a/src/ui/ui.c b/src/ui/ui.c
index 8c38002..bdc8cd6 100644
--- a/src/ui/ui.c
+++ b/src/ui/ui.c
@@ -32,6 +32,7 @@
 #include "theme.h"
 
 #include "inlinepixbufs.h"
+#include "gdk-compat.h"
 
 #include <string.h>
 #include <stdlib.h>



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]