[mutter] Add compatibility with GTK+ 2.18
- From: Florian Müllner <fmuellner src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter] Add compatibility with GTK+ 2.18
- Date: Wed, 12 May 2010 12:51:15 +0000 (UTC)
commit c6c7b05d7bb54e114e00342eb3a43999009cdc35
Author: Florian Müllner <fmuellner src gnome org>
Date: Tue May 11 00:46:36 2010 +0200
Add compatibility with GTK+ 2.18
To replace all calls to deprecated code, GTK+ 2.20 is required - add
some basic compatibility code, so that it is still possible to build
mutter with GTK+ 2.18 when not using -DGSEAL_ENABLE.
https://bugzilla.gnome.org/show_bug.cgi?id=595496
configure.in | 6 +++---
src/Makefile.am | 1 +
src/gtk-compat.h | 26 ++++++++++++++++++++++++++
src/tools/Makefile.am | 1 +
src/tools/mutter-window-demo.c | 2 ++
src/ui/frames.c | 2 ++
src/ui/metaaccellabel.c | 2 ++
src/ui/resizepopup.c | 1 +
src/ui/tabpopup.c | 2 ++
src/ui/theme.c | 2 ++
src/ui/themewidget.c | 2 ++
11 files changed, 44 insertions(+), 3 deletions(-)
---
diff --git a/configure.in b/configure.in
index dc71a76..58b88a0 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.20 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],
@@ -184,8 +184,8 @@ AM_GLIB_GNU_GETTEXT
# GRegex requires Glib-2.14.0
PKG_CHECK_MODULES(ALL, glib-2.0 >= 2.14.0)
# gtk_window_set_icon_name requires gtk2+-2.6.0
-PKG_CHECK_MODULES(MUTTER_MESSAGE, gtk+-2.0 >= 2.20)
-PKG_CHECK_MODULES(MUTTER_WINDOW_DEMO, gtk+-2.0 >= 2.20)
+PKG_CHECK_MODULES(MUTTER_MESSAGE, gtk+-2.0 >= 2.18)
+PKG_CHECK_MODULES(MUTTER_WINDOW_DEMO, gtk+-2.0 >= 2.18)
# Unconditionally use this dir to avoid a circular dep with gnomecc
GNOME_KEYBINDINGS_KEYSDIR="${datadir}/gnome-control-center/keybindings"
diff --git a/src/Makefile.am b/src/Makefile.am
index a3d892d..cc1c3a4 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 \
+ gtk-compat.h \
include/compositor.h \
include/mutter-plugin.h \
include/mutter-window.h \
diff --git a/src/gtk-compat.h b/src/gtk-compat.h
new file mode 100644
index 0000000..5e029be
--- /dev/null
+++ b/src/gtk-compat.h
@@ -0,0 +1,26 @@
+#ifndef __GTK_COMPAT_H__
+#define __GTK_COMPAT_H__
+
+#include <gtk/gtk.h>
+
+/* Provide a compatibility layer for accessor function introduces
+ * in GTK+ 2.20 which we need to build with GSEAL_ENABLE.
+ * That way it is still possible to build with GTK+ 2.18 when not
+ * using GSEAL_ENABLE
+ */
+
+#if !GTK_CHECK_VERSION (2, 20, 0)
+
+#define gtk_widget_get_realized(w) GTK_WIDGET_REALIZED (w)
+#define gtk_widget_get_requisition(w,r) (*r = GTK_WIDGET (w)->requisition)
+#define gtk_widget_set_mapped(w,m) \
+ G_STMT_START { \
+ if (m) \
+ GTK_WIDGET_SET_FLAGS (w, GTK_MAPPED); \
+ else \
+ GTK_WIDGET_UNSET_FLAGS (w, GTK_MAPPED); \
+ } G_STMT_END
+
+#endif /* GTK_CHECK_VERSION */
+
+#endif /* __GTK_COMPAT_H__ */
diff --git a/src/tools/Makefile.am b/src/tools/Makefile.am
index e9c93ab..c9a47a7 100644
--- a/src/tools/Makefile.am
+++ b/src/tools/Makefile.am
@@ -4,6 +4,7 @@ icondir=$(pkgdatadir)/icons
icon_DATA=mutter-window-demo.png
INCLUDES= MUTTER_WINDOW_DEMO_CFLAGS@ @MUTTER_MESSAGE_CFLAGS@ \
+ -I$(top_srcdir)/src \
-DMUTTER_ICON_DIR=\"$(pkgdatadir)/icons\" \
-DMUTTER_LOCALEDIR=\"$(prefix)/@DATADIRNAME@/locale\"
diff --git a/src/tools/mutter-window-demo.c b/src/tools/mutter-window-demo.c
index be5584c..facc8c9 100644
--- a/src/tools/mutter-window-demo.c
+++ b/src/tools/mutter-window-demo.c
@@ -24,6 +24,8 @@
#include <X11/Xatom.h>
#include <unistd.h>
+#include "gtk-compat.h"
+
static GtkWidget* do_appwindow (void);
static gboolean aspect_on;
diff --git a/src/ui/frames.c b/src/ui/frames.c
index 49862a5..ba6c81c 100644
--- a/src/ui/frames.c
+++ b/src/ui/frames.c
@@ -35,6 +35,8 @@
#include "prefs.h"
#include "ui.h"
+#include "gtk-compat.h"
+
#ifdef HAVE_SHAPE
#include <X11/extensions/shape.h>
#endif
diff --git a/src/ui/metaaccellabel.c b/src/ui/metaaccellabel.c
index cf6e35e..565f07c 100644
--- a/src/ui/metaaccellabel.c
+++ b/src/ui/metaaccellabel.c
@@ -37,6 +37,8 @@
#include <string.h>
#include "util.h"
+#include "gtk-compat.h"
+
static void meta_accel_label_class_init (MetaAccelLabelClass *klass);
static void meta_accel_label_init (MetaAccelLabel *accel_label);
static void meta_accel_label_destroy (GtkObject *object);
diff --git a/src/ui/resizepopup.c b/src/ui/resizepopup.c
index c9e69fc..7efbb24 100644
--- a/src/ui/resizepopup.c
+++ b/src/ui/resizepopup.c
@@ -26,6 +26,7 @@
#include "util.h"
#include <gtk/gtk.h>
#include <gdk/gdkx.h>
+#include "gtk-compat.h"
struct _MetaResizePopup
{
diff --git a/src/ui/tabpopup.c b/src/ui/tabpopup.c
index fe4a36c..4aa1e98 100644
--- a/src/ui/tabpopup.c
+++ b/src/ui/tabpopup.c
@@ -36,6 +36,8 @@
#include <gtk/gtk.h>
#include <math.h>
+#include "gtk-compat.h"
+
#define OUTSIDE_SELECT_RECT 2
#define INSIDE_SELECT_RECT 2
diff --git a/src/ui/theme.c b/src/ui/theme.c
index 59ff90b..3e90f4c 100644
--- a/src/ui/theme.c
+++ b/src/ui/theme.c
@@ -62,6 +62,8 @@
#include <stdlib.h>
#include <math.h>
+#include "gtk-compat.h"
+
#define GDK_COLOR_RGBA(color) \
((guint32) (0xff | \
(((color).red / 256) << 24) | \
diff --git a/src/ui/themewidget.c b/src/ui/themewidget.c
index 05bd839..59f91bb 100644
--- a/src/ui/themewidget.c
+++ b/src/ui/themewidget.c
@@ -24,6 +24,8 @@
#include "themewidget.h"
#include <math.h>
+#include "gtk-compat.h"
+
static void meta_area_class_init (MetaAreaClass *klass);
static void meta_area_init (MetaArea *area);
static void meta_area_size_request (GtkWidget *widget,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]