summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorFlorian Müllner <fmuellner@gnome.org>2010-06-14 12:48:27 +0200
committerThomas Thurman <tthurman@gnome.org>2011-01-24 07:06:14 -0500
commit25eb6ce67cbd416cd239db6c58e707e133a9a6df (patch)
tree7d7d26cd0abb5df59f74e48a6786a7af0c73d2d7 /src
parent155c85ae8b999c607a27668498f540337d8be4a6 (diff)
downloadmetacity-25eb6ce67cbd416cd239db6c58e707e133a9a6df.tar.gz
Add compatibility with GTK+ 2.20
In order to replace calls to deprecated GDK code, yet-unreleased GTK+ 2.22 is required. Add some basic compatibility code to allow building mutter with GTK+ 2.20. https://bugzilla.gnome.org/show_bug.cgi?id=572332
Diffstat (limited to 'src')
-rw-r--r--src/Makefile.am1
-rw-r--r--src/gdk-compat.h35
-rw-r--r--src/ui/frames.c2
-rw-r--r--src/ui/ui.c2
4 files changed, 40 insertions, 0 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
index ef9a3a07..5c9c3797 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -38,6 +38,7 @@ metacity_SOURCES= \
core/frame.c \
core/frame-private.h \
include/frame.h \
+ gdk-compat.h \
ui/gradient.c \
ui/gradient.h \
core/group-private.h \
diff --git a/src/gdk-compat.h b/src/gdk-compat.h
new file mode 100644
index 00000000..b794f24c
--- /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.20 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 d8fe3cdc..04804355 100644
--- a/src/ui/frames.c
+++ b/src/ui/frames.c
@@ -35,6 +35,8 @@
#include "prefs.h"
#include "ui.h"
+#include "gdk-compat.h"
+
#ifdef HAVE_SHAPE
#include <X11/extensions/shape.h>
#endif
diff --git a/src/ui/ui.c b/src/ui/ui.c
index 5ef4f525..5a4af380 100644
--- a/src/ui/ui.c
+++ b/src/ui/ui.c
@@ -32,6 +32,8 @@
#include "inlinepixbufs.h"
+#include "gdk-compat.h"
+
#include <string.h>
#include <stdlib.h>