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
This commit is contained in:
Florian Müllner 2010-06-14 12:48:27 +02:00
parent c65a24486d
commit e267a63330
5 changed files with 39 additions and 1 deletions

View File

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

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 \
gdk-compat.h \
gtk-compat.h \
include/compositor.h \
include/mutter-plugin.h \

35
src/gdk-compat.h Normal file
View File

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

View File

@ -36,6 +36,7 @@
#include "ui.h"
#include "gtk-compat.h"
#include "gdk-compat.h"
#ifdef HAVE_SHAPE
#include <X11/extensions/shape.h>

View File

@ -32,6 +32,7 @@
#include "theme.h"
#include "inlinepixbufs.h"
#include "gdk-compat.h"
#include <string.h>
#include <stdlib.h>