Bug 793634 - Force builds to be compatible with gtk 2.18/glib 2.22. r=karlt
authorMike Hommey <mh+mozilla@glandium.org>
Tue, 25 Sep 2012 14:47:18 +0200
changeset 108008 3218db438fdfeb51fb025b31bbfe9114fc682452
parent 108007 3ee0ff72fdf3e433db2c5670234803b60ff18ec7
child 108009 a7f0c7c7eb61f7b7c55b86e37525e632127aebb4
push id23527
push userryanvm@gmail.com
push dateTue, 25 Sep 2012 21:30:26 +0000
treeherdermozilla-central@a1e7318fabc5 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskarlt
bugs793634
milestone18.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 793634 - Force builds to be compatible with gtk 2.18/glib 2.22. r=karlt
config/config.mk
configure.in
dom/plugins/base/nsPluginNativeWindowGtk2.cpp
dom/plugins/ipc/PluginModuleChild.cpp
gfx/thebes/gfxPlatformGtk.cpp
js/src/config/config.mk
widget/gtk2/Makefile.in
widget/gtk2/compat/gdk/gdkdnd.h
widget/gtk2/compat/gdk/gdkvisual.h
widget/gtk2/compat/gdk/gdkwindow.h
widget/gtk2/compat/gdk/gdkx.h
widget/gtk2/compat/glib/gmem.h
widget/gtk2/compat/gtk/gtkwidget.h
widget/gtk2/compat/gtk/gtkwindow.h
widget/gtk2/gtk2compat.h
widget/gtk2/mozcontainer.c
widget/gtk2/nsClipboard.cpp
widget/gtk2/nsDragService.cpp
widget/gtk2/nsGtkIMModule.cpp
widget/gtk2/nsIdleServiceGTK.cpp
widget/gtk2/nsPrintDialogGTK.cpp
widget/gtk2/nsScreenGtk.cpp
widget/gtk2/nsWindow.cpp
--- a/config/config.mk
+++ b/config/config.mk
@@ -809,8 +809,12 @@ EXPAND_LIBNAME_PATH = $(foreach lib,$(1)
 EXPAND_MOZLIBNAME = $(foreach lib,$(1),$(DIST)/lib/$(LIB_PREFIX)$(lib).$(LIB_SUFFIX))
 
 # Include internal ply only if needed
 ifndef MOZ_SYSTEM_PLY
 PLY_INCLUDE = -I$(topsrcdir)/other-licenses/ply
 endif
 
 export CL_INCLUDES_PREFIX
+
+ifeq ($(MOZ_WIDGET_GTK),2)
+MOZ_GTK2_CFLAGS := -I$(topsrcdir)/widget/gtk2/compat $(MOZ_GTK2_CFLAGS)
+endif
--- a/configure.in
+++ b/configure.in
@@ -60,17 +60,17 @@ NSS_VERSION=3
 dnl Set the minimum version of toolkit libs used by mozilla
 dnl ========================================================
 GLIB_VERSION=1.2.0
 PERL_VERSION=5.006
 PYTHON_VERSION_MAJOR=2
 PYTHON_VERSION_MINOR=5
 CAIRO_VERSION=1.10
 PANGO_VERSION=1.14.0
-GTK2_VERSION=2.10.0
+GTK2_VERSION=2.18.0
 WINDRES_VERSION=2.14.90
 W32API_VERSION=3.14
 GNOMEVFS_VERSION=2.0
 GNOMEUI_VERSION=2.2.0
 GCONF_VERSION=1.2.1
 GIO_VERSION=2.18
 STARTUP_NOTIFICATION_VERSION=0.8
 DBUS_VERSION=0.60
@@ -4430,16 +4430,18 @@ MOZ_ARG_HEADER(Toolkit Options)
 MOZ_ARG_WITHOUT_BOOL(x,
 [  --without-x              Build without X11],
     WITHOUT_X11=1)
 
 dnl ========================================================
 dnl = Enable the toolkit as needed                         =
 dnl ========================================================
 
+MOZ_WIDGET_GTK=
+
 case "$MOZ_WIDGET_TOOLKIT" in
 
 cairo-windows)
     MOZ_WIDGET_TOOLKIT=windows
     MOZ_WEBGL=1
     MOZ_PDF_PRINTING=1
     MOZ_INSTRUMENT_EVENT_LOOP=1
     ;;
@@ -4453,17 +4455,18 @@ cairo-gtk2|cairo-gtk2-x11)
 
     AC_DEFINE(MOZ_X11)
     MOZ_X11=1
     USE_FC_FREETYPE=1
 
     TK_CFLAGS='$(MOZ_GTK2_CFLAGS)'
     TK_LIBS='$(MOZ_GTK2_LIBS)'
     AC_DEFINE(MOZ_WIDGET_GTK2)
-    AC_DEFINE(MOZ_WIDGET_GTK,2)
+    MOZ_WIDGET_GTK=2
+    AC_DEFINE_UNQUOTED(MOZ_WIDGET_GTK,$MOZ_WIDGET_GTK)
     MOZ_PDF_PRINTING=1
     MOZ_INSTRUMENT_EVENT_LOOP=1
     ;;
 
 cairo-qt)
     MOZ_WIDGET_TOOLKIT=qt
     MOZ_ENABLE_QT=1
     if test -z "$WITHOUT_X11"; then
@@ -4727,16 +4730,17 @@ AC_SUBST(TK_LIBS)
 AC_SUBST(MOZ_ENABLE_GTK2)
 AC_SUBST(MOZ_ENABLE_QT)
 AC_SUBST(MOZ_ENABLE_QTNETWORK)
 AC_SUBST(MOZ_ENABLE_QMSYSTEM2)
 AC_SUBST(MOZ_ENABLE_QTMOBILITY)
 AC_SUBST(MOZ_ENABLE_XREMOTE)
 AC_SUBST(MOZ_GTK2_CFLAGS)
 AC_SUBST(MOZ_GTK2_LIBS)
+AC_SUBST(MOZ_WIDGET_GTK)
 AC_SUBST(MOZ_QT_CFLAGS)
 AC_SUBST(MOZ_QT_LIBS)
 
 AC_SUBST(MOC)
 AC_SUBST(RCC)
 
 AC_SUBST(MOZ_X11)
 
--- a/dom/plugins/base/nsPluginNativeWindowGtk2.cpp
+++ b/dom/plugins/base/nsPluginNativeWindowGtk2.cpp
@@ -12,17 +12,16 @@
 #include "nsDebug.h"
 #include "nsPluginNativeWindow.h"
 #include "nsNPAPIPlugin.h"
 #include "npapi.h"
 #include <gtk/gtk.h>
 #include <gdk/gdkx.h>
 #include <gdk/gdk.h>
 
-#include "gtk2compat.h"
 #include "gtk2xtbin.h"
 #include "mozilla/X11Util.h"
 
 class nsPluginNativeWindowGtk2 : public nsPluginNativeWindow {
 public: 
   nsPluginNativeWindowGtk2();
   virtual ~nsPluginNativeWindowGtk2();
 
--- a/dom/plugins/ipc/PluginModuleChild.cpp
+++ b/dom/plugins/ipc/PluginModuleChild.cpp
@@ -18,17 +18,16 @@
 
 #include "mozilla/ipc/SyncChannel.h"
 
 #ifdef MOZ_WIDGET_GTK
 #include <gtk/gtk.h>
 #if (MOZ_WIDGET_GTK == 3)
 #include <gtk/gtkx.h>
 #endif
-#include "gtk2compat.h"
 #endif
 
 #include "nsIFile.h"
 
 #include "pratom.h"
 #include "nsDebug.h"
 #include "nsCOMPtr.h"
 #include "nsPluginsDir.h"
--- a/gfx/thebes/gfxPlatformGtk.cpp
+++ b/gfx/thebes/gfxPlatformGtk.cpp
@@ -23,19 +23,16 @@
 #include FT_FREETYPE_H
 #include "gfxFT2Fonts.h"
 #endif
 
 #include "mozilla/gfx/2D.h"
 
 #include "cairo.h"
 #include <gtk/gtk.h>
-#if (MOZ_WIDGET_GTK == 2)
-#include "gtk2compat.h"
-#endif
 
 #include "gfxImageSurface.h"
 #ifdef MOZ_X11
 #include <gdk/gdkx.h>
 #include "gfxXlibSurface.h"
 #include "cairo-xlib.h"
 #include "mozilla/Preferences.h"
 
--- a/js/src/config/config.mk
+++ b/js/src/config/config.mk
@@ -809,8 +809,12 @@ EXPAND_LIBNAME_PATH = $(foreach lib,$(1)
 EXPAND_MOZLIBNAME = $(foreach lib,$(1),$(DIST)/lib/$(LIB_PREFIX)$(lib).$(LIB_SUFFIX))
 
 # Include internal ply only if needed
 ifndef MOZ_SYSTEM_PLY
 PLY_INCLUDE = -I$(topsrcdir)/other-licenses/ply
 endif
 
 export CL_INCLUDES_PREFIX
+
+ifeq ($(MOZ_WIDGET_GTK),2)
+MOZ_GTK2_CFLAGS := -I$(topsrcdir)/widget/gtk2/compat $(MOZ_GTK2_CFLAGS)
+endif
--- a/widget/gtk2/Makefile.in
+++ b/widget/gtk2/Makefile.in
@@ -73,17 +73,16 @@ endif
 # build our subdirs, too
 
 SHARED_LIBRARY_LIBS = ../xpwidgets/libxpwidgets_s.a
 
 EXPORTS		= \
                 nsGTKToolkit.h \
 		nsIImageToPixbuf.h \
 		mozcontainer.h \
-		gtk2compat.h \
 		$(NULL)
 
 ifdef NATIVE_THEME_SUPPORT
 CSRCS		+= gtk2drawing.c
 CPPSRCS		+= nsNativeThemeGTK.cpp
 DEFINES		+= -DNATIVE_THEME_SUPPORT
 endif
 
new file mode 100644
--- /dev/null
+++ b/widget/gtk2/compat/gdk/gdkdnd.h
@@ -0,0 +1,33 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+#ifndef GDKDND_WRAPPER_H
+#define GDKDND_WRAPPER_H
+
+#define gdk_drag_context_get_actions gdk_drag_context_get_actions_
+#define gdk_drag_context_list_targets gdk_drag_context_list_targets_
+#define gdk_drag_context_get_dest_window gdk_drag_context_get_dest_window_
+#include_next <gdk/gdkdnd.h>
+#undef gdk_drag_context_get_actions
+#undef gdk_drag_context_list_targets
+#undef gdk_drag_context_get_dest_window
+
+static inline GdkDragAction
+gdk_drag_context_get_actions(GdkDragContext *context)
+{
+  return context->actions;
+}
+
+static inline GList *
+gdk_drag_context_list_targets(GdkDragContext *context)
+{
+  return context->targets;
+}
+
+static inline GdkWindow *
+gdk_drag_context_get_dest_window(GdkDragContext *context)
+{
+  return context->dest_window;
+}
+#endif /* GDKDND_WRAPPER_H */
new file mode 100644
--- /dev/null
+++ b/widget/gtk2/compat/gdk/gdkvisual.h
@@ -0,0 +1,17 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+#ifndef GDKVISUAL_WRAPPER_H
+#define GDKVISUAL_WRAPPER_H
+
+#define gdk_visual_get_depth gdk_visual_get_depth_
+#include_next <gdk/gdkvisual.h>
+#undef gdk_visual_get_depth
+
+static inline gint
+gdk_visual_get_depth(GdkVisual *visual)
+{
+  return visual->depth;
+}
+#endif /* GDKVISUAL_WRAPPER_H */
new file mode 100644
--- /dev/null
+++ b/widget/gtk2/compat/gdk/gdkwindow.h
@@ -0,0 +1,25 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+#ifndef GDKWINDOW_WRAPPER_H
+#define GDKWINDOW_WRAPPER_H
+
+#define gdk_window_get_display gdk_window_get_display_
+#define gdk_window_get_screen gdk_window_get_screen_
+#include_next <gdk/gdkwindow.h>
+#undef gdk_window_get_display
+#undef gdk_window_get_screen
+
+static inline GdkDisplay *
+gdk_window_get_display(GdkWindow *window)
+{
+  return gdk_drawable_get_display(GDK_DRAWABLE(window));
+}
+
+static inline GdkScreen*
+gdk_window_get_screen(GdkWindow *window)
+{
+  return gdk_drawable_get_screen (window);
+}
+#endif /* GDKWINDOW_WRAPPER_H */
new file mode 100644
--- /dev/null
+++ b/widget/gtk2/compat/gdk/gdkx.h
@@ -0,0 +1,25 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+#ifndef GDKX_WRAPPER_H
+#define GDKX_WRAPPER_H
+
+#define gdk_x11_window_lookup_for_display gdk_x11_window_lookup_for_display_
+#define gdk_x11_window_get_xid gdk_x11_window_get_xid_
+#include_next <gdk/gdkx.h>
+#undef gdk_x11_window_lookup_for_display
+#undef gdk_x11_window_get_xid
+
+static inline GdkWindow *
+gdk_x11_window_lookup_for_display(GdkDisplay *display, Window window)
+{
+  return gdk_window_lookup_for_display(display, window);
+}
+
+static inline Window
+gdk_x11_window_get_xid(GdkWindow *window)
+{
+  return(GDK_WINDOW_XWINDOW(window));
+}
+#endif /* GDKX_WRAPPER_H */
new file mode 100644
--- /dev/null
+++ b/widget/gtk2/compat/glib/gmem.h
@@ -0,0 +1,56 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+#ifndef GMEM_WRAPPER_H
+#define GMEM_WRAPPER_H
+
+#define g_malloc_n g_malloc_n_
+#define g_malloc0_n g_malloc0_n_
+#define g_realloc_n g_realloc_n_
+#include_next <glib/gmem.h>
+#undef g_malloc_n
+#undef g_malloc0_n
+#undef g_realloc_n
+
+#include <glib/gmessages.h>
+
+#undef g_new
+#define g_new(type, num) \
+    ((type *) g_malloc_n((num), sizeof(type)))
+
+#undef g_new0
+#define g_new0(type, num) \
+    ((type *) g_malloc0_n((num), sizeof(type)))
+
+#undef g_renew
+#define g_renew(type, ptr, num) \
+    ((type *) g_realloc_n(ptr, (num), sizeof(type)))
+
+#define _CHECK_OVERFLOW(num, type_size) \
+    if (G_UNLIKELY(type_size > 0 && num > G_MAXSIZE / type_size)) { \
+      g_error("%s: overflow allocating %" G_GSIZE_FORMAT "*%" G_GSIZE_FORMAT " bytes", \
+              G_STRLOC, num, type_size); \
+    }
+
+static inline gpointer
+g_malloc_n(gsize num, gsize type_size)
+{
+  _CHECK_OVERFLOW(num, type_size)
+  return g_malloc(num * type_size);
+}
+
+static inline gpointer
+g_malloc0_n(gsize num, gsize type_size)
+{
+  _CHECK_OVERFLOW(num, type_size)
+  return g_malloc0(num * type_size);
+}
+
+static inline gpointer
+g_realloc_n(gpointer ptr, gsize num, gsize type_size)
+{
+  _CHECK_OVERFLOW(num, type_size)
+  return g_realloc(ptr, num * type_size);
+}
+#endif /* GMEM_WRAPPER_H */
new file mode 100644
--- /dev/null
+++ b/widget/gtk2/compat/gtk/gtkwidget.h
@@ -0,0 +1,47 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+#ifndef GTKWIDGET_WRAPPER_H
+#define GTKWIDGET_WRAPPER_H
+
+#define gtk_widget_set_mapped gtk_widget_set_mapped_
+#define gtk_widget_get_mapped gtk_widget_get_mapped_
+#define gtk_widget_set_realized gtk_widget_set_realized_
+#define gtk_widget_get_realized gtk_widget_get_realized_
+#include_next <gtk/gtkwidget.h>
+#undef gtk_widget_set_mapped
+#undef gtk_widget_get_mapped
+#undef gtk_widget_set_realized
+#undef gtk_widget_get_realized
+
+static inline void
+gtk_widget_set_mapped(GtkWidget *widget, gboolean mapped)
+{
+  if (mapped)
+    GTK_WIDGET_SET_FLAGS (widget, GTK_MAPPED);
+  else
+    GTK_WIDGET_UNSET_FLAGS (widget, GTK_MAPPED);
+}
+
+static inline gboolean
+gtk_widget_get_mapped(GtkWidget *widget)
+{
+  return GTK_WIDGET_MAPPED (widget);
+}
+
+static inline void
+gtk_widget_set_realized(GtkWidget *widget, gboolean realized)
+{
+  if (realized)
+    GTK_WIDGET_SET_FLAGS(widget, GTK_REALIZED);
+  else
+    GTK_WIDGET_UNSET_FLAGS(widget, GTK_REALIZED);
+}
+
+static inline gboolean
+gtk_widget_get_realized(GtkWidget *widget)
+{
+  return GTK_WIDGET_REALIZED (widget);
+}
+#endif /* GTKWIDGET_WRAPPER_H */
new file mode 100644
--- /dev/null
+++ b/widget/gtk2/compat/gtk/gtkwindow.h
@@ -0,0 +1,20 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+#ifndef GTKWINDOW_WRAPPER_H
+#define GTKWINDOW_WRAPPER_H
+
+#define gtk_window_group_get_current_grab gtk_window_group_get_current_grab_
+#include_next <gtk/gtkwindow.h>
+#undef gtk_window_group_get_current_grab
+
+static inline GtkWidget *
+gtk_window_group_get_current_grab(GtkWindowGroup *window_group)
+{
+  if (!window_group->grabs)
+    return NULL;
+
+  return GTK_WIDGET(window_group->grabs->data);
+}
+#endif /* GTKWINDOW_WRAPPER_H */
deleted file mode 100644
--- a/widget/gtk2/gtk2compat.h
+++ /dev/null
@@ -1,229 +0,0 @@
-/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim:expandtab:shiftwidth=2:tabstop=2:
- */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-/**
- * gtk2compat.h: GTK2 compatibility routines
- *
- * gtk2compat provides an API which is not defined in GTK2.
- */
-
-#ifndef _GTK2_COMPAT_H_
-#define _GTK2_COMPAT_H_
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-#if !GTK_CHECK_VERSION(2, 14, 0)
-static inline GdkWindow*
-gtk_widget_get_window(GtkWidget *widget)
-{
-  return widget->window;
-}
-
-static inline const guchar *
-gtk_selection_data_get_data(GtkSelectionData *selection_data)
-{
-  return selection_data->data;
-}
-
-static inline gint
-gtk_selection_data_get_length(GtkSelectionData *selection_data)
-{
-  return selection_data->length;
-}
-
-static inline GdkAtom
-gtk_selection_data_get_target(GtkSelectionData *selection_data)
-{
-  return selection_data->target;
-}
-
-static inline GtkWidget *
-gtk_dialog_get_content_area(GtkDialog *dialog)
-{
-  return dialog->vbox;
-}
-
-static inline GdkWindow *
-gtk_plug_get_socket_window(GtkPlug *plug)
-{
-  return plug->socket_window;
-}
-#endif
-
-
-#if !GTK_CHECK_VERSION(2, 16, 0)
-static inline GdkAtom
-gtk_selection_data_get_selection(GtkSelectionData *selection_data)
-{
-  return selection_data->selection;
-}
-#endif
-
-#if !GTK_CHECK_VERSION(2, 18, 0)
-static inline gboolean
-gtk_widget_get_visible(GtkWidget *widget)
-{
-  return GTK_WIDGET_VISIBLE(widget);
-}
-
-static inline gboolean
-gtk_widget_has_focus(GtkWidget *widget)
-{
-  return GTK_WIDGET_HAS_FOCUS(widget);
-}
-
-static inline gboolean
-gtk_widget_has_grab(GtkWidget *widget)
-{
-  return GTK_WIDGET_HAS_GRAB(widget);
-}
-
-static inline void
-gtk_widget_get_allocation(GtkWidget *widget, GtkAllocation *allocation)
-{
-  *allocation = widget->allocation;
-}
-
-static inline void
-gtk_widget_set_allocation(GtkWidget *widget, const GtkAllocation *allocation)
-{
-  widget->allocation = *allocation;
-}
-
-static inline gboolean
-gdk_window_is_destroyed(GdkWindow *window)
-{
-  return GDK_WINDOW_OBJECT(window)->destroyed;
-}
-
-static inline void 
-gtk_widget_set_can_focus(GtkWidget *widget, gboolean can_focus)
-{
-  if (can_focus)
-    GTK_WIDGET_SET_FLAGS (widget, GTK_CAN_FOCUS);
-  else
-    GTK_WIDGET_UNSET_FLAGS (widget, GTK_CAN_FOCUS);
-}
-
-static inline void
-gtk_widget_set_window(GtkWidget *widget, GdkWindow *window)
-{
-  widget->window = window;
-}
-
-static inline gboolean
-gtk_widget_is_toplevel(GtkWidget *widget)
-{
-  return GTK_WIDGET_TOPLEVEL(widget);
-}
-#endif
-
-#if !GTK_CHECK_VERSION(2, 20, 0)
-static inline void
-gtk_widget_set_mapped(GtkWidget *widget, gboolean mapped)
-{
-  if (mapped)
-    GTK_WIDGET_SET_FLAGS (widget, GTK_MAPPED);
-  else
-    GTK_WIDGET_UNSET_FLAGS (widget, GTK_MAPPED);
-}
-
-static inline gboolean
-gtk_widget_get_mapped(GtkWidget *widget)
-{
-  return GTK_WIDGET_MAPPED (widget);
-}
-
-static inline void
-gtk_widget_set_realized(GtkWidget *widget, gboolean realized)
-{
-  if (realized)
-    GTK_WIDGET_SET_FLAGS(widget, GTK_REALIZED);
-  else
-    GTK_WIDGET_UNSET_FLAGS(widget, GTK_REALIZED);
-}
-
-static inline gboolean
-gtk_widget_get_realized(GtkWidget *widget)
-{
-  return GTK_WIDGET_REALIZED (widget);
-}
-#endif
-
-#if !GTK_CHECK_VERSION(2, 22, 0)
-static inline gint
-gdk_visual_get_depth(GdkVisual *visual)
-{
-  return visual->depth;
-}
-
-static inline GdkDragAction
-gdk_drag_context_get_actions(GdkDragContext *context)
-{
-  return context->actions;
-}
-
-static inline GtkWidget *
-gtk_window_group_get_current_grab(GtkWindowGroup *window_group)
-{
-  if (!window_group->grabs)
-    return NULL;
-
-  return GTK_WIDGET(window_group->grabs->data);
-}
-
-static inline GList *
-gdk_drag_context_list_targets(GdkDragContext *context)
-{
-  return context->targets;
-}
-#endif
-
-#if !GTK_CHECK_VERSION(2, 23, 3)
-static inline GdkWindow *
-gdk_drag_context_get_dest_window(GdkDragContext *context)
-{
-  return context->dest_window;
-}
-#endif
-
-#if !GTK_CHECK_VERSION(2, 24, 0)
-#ifdef GDK_WINDOW_XDISPLAY
-static inline GdkWindow *
-gdk_x11_window_lookup_for_display(GdkDisplay *display, Window window)
-{
-  return gdk_window_lookup_for_display(display, window);
-}
-#endif
-static inline GdkDisplay *
-gdk_window_get_display(GdkWindow *window)
-{
-  return gdk_drawable_get_display(GDK_DRAWABLE(window));
-}
-
-static inline GdkScreen*
-gdk_window_get_screen (GdkWindow *window)
-{
-  return gdk_drawable_get_screen (window);
-}
-#endif
-
-#ifdef GDK_WINDOW_XWINDOW
-static inline Window 
-gdk_x11_window_get_xid(GdkWindow *window)
-{
-  return(GDK_WINDOW_XWINDOW(window));
-}
-#endif
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* _GTK2_COMPAT_H_ */
--- a/widget/gtk2/mozcontainer.c
+++ b/widget/gtk2/mozcontainer.c
@@ -9,20 +9,16 @@
 #include <gtk/gtk.h>
 #include <stdio.h>
 
 #ifdef ACCESSIBILITY
 #include <atk/atk.h>
 #include "maiRedundantObjectFactory.h"
 #endif 
 
-#if defined(MOZ_WIDGET_GTK2)
-#include "gtk2compat.h"
-#endif
-
 /* init methods */
 static void moz_container_class_init          (MozContainerClass *klass);
 static void moz_container_init                (MozContainer      *container);
 
 /* widget class methods */
 static void moz_container_map                 (GtkWidget         *widget);
 static void moz_container_unmap               (GtkWidget         *widget);
 static void moz_container_realize             (GtkWidget         *widget);
--- a/widget/gtk2/nsClipboard.cpp
+++ b/widget/gtk2/nsClipboard.cpp
@@ -26,20 +26,16 @@
 
 // For manipulation of the X event queue
 #include <X11/Xlib.h>
 #include <gdk/gdkx.h>
 #include <sys/time.h>
 #include <sys/types.h>
 #include <unistd.h>
 
-#if (MOZ_WIDGET_GTK == 2)
-#include "gtk2compat.h"
-#endif
-
 using namespace mozilla;
 
 // Callback when someone asks us for the data
 void
 clipboard_get_cb(GtkClipboard *aGtkClipboard,
                  GtkSelectionData *aSelectionData,
                  guint info,
                  gpointer user_data);
--- a/widget/gtk2/nsDragService.cpp
+++ b/widget/gtk2/nsDragService.cpp
@@ -20,20 +20,16 @@
 #include "nsPrimitiveHelpers.h"
 #include "prtime.h"
 #include "prthread.h"
 #include <gtk/gtk.h>
 #include <gdk/gdkx.h>
 #include "nsCRT.h"
 #include "mozilla/Services.h"
 
-#if (MOZ_WIDGET_GTK == 2)
-#include "gtk2compat.h"
-#endif
-
 #include "gfxASurface.h"
 #include "gfxXlibSurface.h"
 #include "gfxContext.h"
 #include "nsImageToPixbuf.h"
 #include "nsPresContext.h"
 #include "nsIDocument.h"
 #include "nsISelection.h"
 #include "nsIViewManager.h"
--- a/widget/gtk2/nsGtkIMModule.cpp
+++ b/widget/gtk2/nsGtkIMModule.cpp
@@ -19,20 +19,16 @@
 #include "mozilla/Preferences.h"
 
 #ifdef MOZ_PLATFORM_MAEMO
 #include "nsServiceManagerUtils.h"
 #include "nsIObserverService.h"
 #include "mozilla/Services.h"
 #endif
 
-#if (MOZ_WIDGET_GTK == 2)
-#include "gtk2compat.h"
-#endif
-
 using namespace mozilla;
 using namespace mozilla::widget;
 
 #ifdef PR_LOGGING
 PRLogModuleInfo* gGtkIMLog = nullptr;
 
 static const char*
 GetRangeTypeName(uint32_t aRangeType)
--- a/widget/gtk2/nsIdleServiceGTK.cpp
+++ b/widget/gtk2/nsIdleServiceGTK.cpp
@@ -7,19 +7,16 @@
 
 #include <gtk/gtk.h>
 
 #include "nsIdleServiceGTK.h"
 #include "nsIServiceManager.h"
 #include "nsDebug.h"
 #include "prlink.h"
 #include "prlog.h"
-#if (MOZ_WIDGET_GTK == 2)
-#include "gtk2compat.h"
-#endif
 
 #ifdef PR_LOGGING
 static PRLogModuleInfo* sIdleLog = nullptr;
 #endif
 
 typedef bool (*_XScreenSaverQueryExtension_fn)(Display* dpy, int* event_base,
                                                  int* error_base);
 
--- a/widget/gtk2/nsPrintDialogGTK.cpp
+++ b/widget/gtk2/nsPrintDialogGTK.cpp
@@ -1,17 +1,16 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include <gtk/gtk.h>
 #if (MOZ_WIDGET_GTK == 2)
 #include <gtk/gtkprintunixdialog.h>
-#include "gtk2compat.h"
 #else
 #include <gtk/gtkunixprint.h>
 #endif
 #include <stdlib.h>
 
 #include "mozilla/Util.h"
 
 #include "mozcontainer.h"
--- a/widget/gtk2/nsScreenGtk.cpp
+++ b/widget/gtk2/nsScreenGtk.cpp
@@ -6,19 +6,16 @@
 #include "nsScreenGtk.h"
 
 #include <gdk/gdk.h>
 #ifdef MOZ_X11
 #include <gdk/gdkx.h>
 #include <X11/Xatom.h>
 #endif
 #include <gtk/gtk.h>
-#if (MOZ_WIDGET_GTK == 2)
-#include "gtk2compat.h"
-#endif
 
 nsScreenGtk :: nsScreenGtk (  )
   : mScreenNum(0),
     mRect(0, 0, 0, 0),
     mAvailRect(0, 0, 0, 0)
 {
 }
 
--- a/widget/gtk2/nsWindow.cpp
+++ b/widget/gtk2/nsWindow.cpp
@@ -48,20 +48,16 @@
 #include "gtk2xtbin.h"
 #endif
 #endif /* MOZ_X11 */
 #include <gdk/gdkkeysyms.h>
 #if defined(MOZ_WIDGET_GTK2)
 #include <gtk/gtkprivate.h>
 #endif
 
-#if defined(MOZ_WIDGET_GTK2)
-#include "gtk2compat.h"
-#endif
-
 #include "nsGkAtoms.h"
 
 #ifdef MOZ_ENABLE_STARTUP_NOTIFICATION
 #define SN_API_NOT_YET_FROZEN
 #include <startup-notification-1.0/libsn/sn.h>
 #endif
 
 #include "mozilla/Preferences.h"