[metacity] Add compatibility with GTK+ 2.20
- From: Thomas James Alexander Thurman <tthurman src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [metacity] Add compatibility with GTK+ 2.20
- Date: Mon, 24 Jan 2011 12:04:09 +0000 (UTC)
commit 25eb6ce67cbd416cd239db6c58e707e133a9a6df
Author: Florian Müllner <fmuellner gnome org>
Date: Mon Jun 14 12:48:27 2010 +0200
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
configure.in | 2 +-
src/Makefile.am | 1 +
src/gdk-compat.h | 35 +++++++++++++++++++++++++++++++++++
src/ui/frames.c | 2 ++
src/ui/ui.c | 2 ++
5 files changed, 41 insertions(+), 1 deletions(-)
---
diff --git a/configure.in b/configure.in
index 6deb7c1..1d2922b 100644
--- a/configure.in
+++ b/configure.in
@@ -120,7 +120,7 @@ AC_MSG_RESULT([$with_gtk])
case "$with_gtk" in
2.0) GTK_API_VERSION=2.0
- GTK_MIN_VERSION=2.21.1
+ GTK_MIN_VERSION=2.20.0
CANBERRA_GTK=libcanberra-gtk
;;
3.0) GTK_API_VERSION=3.0
diff --git a/src/Makefile.am b/src/Makefile.am
index ef9a3a0..5c9c379 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 0000000..b794f24
--- /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 d8fe3cd..0480435 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 5ef4f52..5a4af38 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>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]