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
This commit is contained in:
Florian Müllner 2010-05-11 00:46:36 +02:00
parent 5526e91b6e
commit c6c7b05d7b
11 changed files with 44 additions and 3 deletions

View File

@ -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"

View File

@ -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 \

26
src/gtk-compat.h Normal file
View File

@ -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__ */

View File

@ -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\"

View File

@ -24,6 +24,8 @@
#include <X11/Xatom.h>
#include <unistd.h>
#include "gtk-compat.h"
static GtkWidget* do_appwindow (void);
static gboolean aspect_on;

View File

@ -35,6 +35,8 @@
#include "prefs.h"
#include "ui.h"
#include "gtk-compat.h"
#ifdef HAVE_SHAPE
#include <X11/extensions/shape.h>
#endif

View File

@ -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);

View File

@ -26,6 +26,7 @@
#include "util.h"
#include <gtk/gtk.h>
#include <gdk/gdkx.h>
#include "gtk-compat.h"
struct _MetaResizePopup
{

View File

@ -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

View File

@ -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) | \

View File

@ -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,