Bug 914607 - Remove MOZ_WIDGET_GTK2. r=karlt
☠☠ backed out by 6530dac0cf24 ☠ ☠
authorMartin Stransky <stransky@redhat.com>
Thu, 19 Sep 2013 09:10:04 -0400
changeset 147927 98271bb483eb9180dd8c70d06af21fac36db76b5
parent 147926 17abba1ddb3f746b073161c5da32d60594290d03
child 147928 58e8f3ac398688ec085942190e08b2883a096810
push id25321
push useremorley@mozilla.com
push dateFri, 20 Sep 2013 09:19:10 +0000
treeherdermozilla-central@d923570ed720 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskarlt
bugs914607
milestone27.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 914607 - Remove MOZ_WIDGET_GTK2. r=karlt
configure.in
dom/plugins/base/nsNPAPIPlugin.cpp
dom/plugins/base/nsNPAPIPluginInstance.cpp
dom/plugins/base/nsPluginInstanceOwner.cpp
dom/plugins/base/nsPluginStreamListenerPeer.cpp
dom/plugins/base/nsPluginsDirUnix.cpp
dom/plugins/ipc/PluginInstanceChild.cpp
gfx/thebes/gfxFT2FontList.cpp
image/decoders/icon/nsIconModule.cpp
layout/xul/base/src/nsMenuBarFrame.cpp
testing/tools/screenshot/gdk-screenshot.cpp
toolkit/components/jsdownloads/src/DownloadPlatform.cpp
toolkit/xre/nsX11ErrorHandler.cpp
widget/gtk2/gtkdrawing.h
widget/gtk2/mozcontainer.c
widget/gtk2/nsNativeThemeGTK.cpp
widget/gtk2/nsWindow.cpp
widget/gtk2/nsWindow.h
--- a/configure.in
+++ b/configure.in
@@ -4389,17 +4389,16 @@ cairo-gtk2|cairo-gtk2-x11)
     MOZ_GL_DEFAULT_PROVIDER=GLX
 
     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)
     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
--- a/dom/plugins/base/nsNPAPIPlugin.cpp
+++ b/dom/plugins/base/nsNPAPIPlugin.cpp
@@ -1917,17 +1917,17 @@ NPError NP_CALLBACK
           needsXEmbed = 0;
         }
       }
       if (windowless || needsXEmbed) {
         (*(Display **)result) = mozilla::DefaultXDisplay();
         return NPERR_NO_ERROR;
       }
     }
-#ifdef MOZ_WIDGET_GTK2
+#if (MOZ_WIDGET_GTK == 2)
     // adobe nppdf calls XtGetApplicationNameAndClass(display,
     // &instance, &class) we have to init Xt toolkit before get
     // XtDisplay just call gtk_xtbin_new(w,0) once
     static GtkWidget *gtkXtBinHolder = 0;
     if (!gtkXtBinHolder) {
       gtkXtBinHolder = gtk_xtbin_new(gdk_get_default_root_window(),0);
       // it crashes on destroy, let it leak
       // gtk_widget_destroy(gtkXtBinHolder);
@@ -1938,17 +1938,17 @@ NPError NP_CALLBACK
 #endif
     return NPERR_GENERIC_ERROR;
   }
 
   case NPNVxtAppContext:
     return NPERR_GENERIC_ERROR;
 #endif
 
-#if defined(XP_WIN) || defined(XP_OS2) || defined(MOZ_WIDGET_GTK2) \
+#if defined(XP_WIN) || defined(XP_OS2) || (MOZ_WIDGET_GTK == 2) \
  || defined(MOZ_WIDGET_QT)
   case NPNVnetscapeWindow: {
     if (!npp || !npp->ndata)
       return NPERR_INVALID_INSTANCE_ERROR;
 
     nsNPAPIPluginInstance *inst = (nsNPAPIPluginInstance *) npp->ndata;
 
     nsRefPtr<nsPluginInstanceOwner> owner = inst->GetOwner();
--- a/dom/plugins/base/nsNPAPIPluginInstance.cpp
+++ b/dom/plugins/base/nsNPAPIPluginInstance.cpp
@@ -551,17 +551,17 @@ nsNPAPIPluginInstance::Start()
 }
 
 nsresult nsNPAPIPluginInstance::SetWindow(NPWindow* window)
 {
   // NPAPI plugins don't want a SetWindow(NULL).
   if (!window || RUNNING != mRunning)
     return NS_OK;
 
-#if defined(MOZ_WIDGET_GTK2)
+#if (MOZ_WIDGET_GTK == 2)
   // bug 108347, flash plugin on linux doesn't like window->width <=
   // 0, but Java needs wants this call.
   if (!nsPluginHost::IsJavaMIMEType(mMIMEType) && window->type == NPWindowTypeWindow &&
       (window->width <= 0 || window->height <= 0)) {
     return NS_OK;
   }
 #endif
 
--- a/dom/plugins/base/nsPluginInstanceOwner.cpp
+++ b/dom/plugins/base/nsPluginInstanceOwner.cpp
@@ -70,17 +70,17 @@ static NS_DEFINE_CID(kAppShellCID, NS_AP
 #include <winuser.h>
 #endif
 
 #ifdef XP_MACOSX
 #include <Carbon/Carbon.h>
 #include "nsPluginUtilsOSX.h"
 #endif
 
-#ifdef MOZ_WIDGET_GTK2
+#if (MOZ_WIDGET_GTK == 2)
 #include <gdk/gdk.h>
 #include <gdk/gdkx.h>
 #include <gtk/gtk.h>
 #endif
 
 #ifdef MOZ_WIDGET_ANDROID
 #include "ANPBase.h"
 #include "AndroidBridge.h"
--- a/dom/plugins/base/nsPluginStreamListenerPeer.cpp
+++ b/dom/plugins/base/nsPluginStreamListenerPeer.cpp
@@ -732,17 +732,17 @@ nsresult nsPluginStreamListenerPeer::Ser
   
   // mPluginInstance->Stop calls mPStreamListener->CleanUpStream(), so stream will be properly clean up
   mPluginInstance->Stop();
   mPluginInstance->Start();
   nsRefPtr<nsPluginInstanceOwner> owner = mPluginInstance->GetOwner();
   if (owner) {
     NPWindow* window = nullptr;
     owner->GetWindow(window);
-#if defined(MOZ_WIDGET_GTK2) || defined(MOZ_WIDGET_QT)
+#if (MOZ_WIDGET_GTK == 2) || defined(MOZ_WIDGET_QT)
     // Should call GetPluginPort() here.
     // This part is copied from nsPluginInstanceOwner::GetPluginPort(). 
     nsCOMPtr<nsIWidget> widget;
     ((nsPluginNativeWindow*)window)->GetPluginWidget(getter_AddRefs(widget));
     if (widget) {
       window->window = widget->GetNativeData(NS_NATIVE_PLUGIN_PORT);
     }
 #endif
--- a/dom/plugins/base/nsPluginsDirUnix.cpp
+++ b/dom/plugins/base/nsPluginsDirUnix.cpp
@@ -34,17 +34,17 @@
 #define DEFAULT_X11_PATH "/usr/X11R6/lib"
 #undef LOCAL_PLUGIN_DLL_SUFFIX
 #define LOCAL_PLUGIN_DLL_SUFFIX ".dylib"
 #define LOCAL_PLUGIN_DLL_ALT_SUFFIX ".so"
 #else
 #define DEFAULT_X11_PATH ""
 #endif
 
-#if defined(MOZ_WIDGET_GTK2)
+#if (MOZ_WIDGET_GTK == 2)
 
 #define PLUGIN_MAX_LEN_OF_TMP_ARR 512
 
 static void DisplayPR_LoadLibraryErrorMessage(const char *libName)
 {
     char errorMsg[PLUGIN_MAX_LEN_OF_TMP_ARR] = "Cannot get error from NSPR.";
     if (PR_GetErrorTextLength() < (int) sizeof(errorMsg))
         PR_GetErrorText(errorMsg);
@@ -260,17 +260,17 @@ nsresult nsPluginFile::LoadPlugin(PRLibr
     nsresult rv;
     nsAutoCString path;
     rv = mPlugin->GetNativePath(path);
     if (NS_FAILED(rv))
         return rv;
 
     libSpec.value.pathname = path.get();
 
-#if defined(MOZ_WIDGET_GTK2)
+#if (MOZ_WIDGET_GTK == 2)
 
     // Normally, Mozilla isn't linked against libXt and libXext
     // since it's a Gtk/Gdk application.  On the other hand,
     // legacy plug-ins expect the libXt and libXext symbols
     // to already exist in the global name space.  This plug-in
     // wrapper is linked against libXt and libXext, but since
     // we never call on any of these libraries, plug-ins still
     // fail to resolve Xt symbols when trying to do a dlopen
--- a/dom/plugins/ipc/PluginInstanceChild.cpp
+++ b/dom/plugins/ipc/PluginInstanceChild.cpp
@@ -1096,17 +1096,17 @@ PluginInstanceChild::AnswerNPP_SetWindow
     FindVisualAndDepth(mWsInfo.display, aWindow.visualID,
                        &mWsInfo.visual, &depth);
     mWsInfo.depth = depth;
 
     if (!mWindow.window && mWindow.type == NPWindowTypeWindow) {
         CreateWindow(aWindow);
     }
 
-#ifdef MOZ_WIDGET_GTK2
+#if (MOZ_WIDGET_GTK == 2)
     if (mXEmbed && gtk_check_version(2,18,7) != NULL) { // older
         if (aWindow.type == NPWindowTypeWindow) {
             GdkWindow* socket_window = gdk_window_lookup(static_cast<GdkNativeWindow>(aWindow.window));
             if (socket_window) {
                 // A GdkWindow for the socket already exists.  Need to
                 // workaround https://bugzilla.gnome.org/show_bug.cgi?id=607061
                 // See wrap_gtk_plug_embedded in PluginModuleChild.cpp.
                 g_object_set_data(G_OBJECT(socket_window),
--- a/gfx/thebes/gfxFT2FontList.cpp
+++ b/gfx/thebes/gfxFT2FontList.cpp
@@ -1,17 +1,17 @@
 /* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 4 -*-
  * 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 "mozilla/MemoryReporting.h"
 #include "mozilla/Util.h"
 
-#if defined(MOZ_WIDGET_GTK2)
+#if (MOZ_WIDGET_GTK == 2)
 #include "gfxPlatformGtk.h"
 #define gfxToolkitPlatform gfxPlatformGtk
 #elif defined(MOZ_WIDGET_QT)
 #include <qfontinfo.h>
 #include "gfxQtPlatform.h"
 #define gfxToolkitPlatform gfxQtPlatform
 #elif defined(XP_WIN)
 #include "gfxWindowsPlatform.h"
--- a/image/decoders/icon/nsIconModule.cpp
+++ b/image/decoders/icon/nsIconModule.cpp
@@ -33,17 +33,17 @@ static const mozilla::Module::ContractID
 
 static const mozilla::Module::CategoryEntry kIconCategories[] = {
   { nullptr }
 };
 
 static void
 IconDecoderModuleDtor()
 {
-#ifdef MOZ_WIDGET_GTK2
+#if (MOZ_WIDGET_GTK == 2)
   nsIconChannel::Shutdown();
 #endif
 }
 
 static const mozilla::Module kIconModule = {
   mozilla::Module::kVersion,
   kIconCIDs,
   kIconContracts,
--- a/layout/xul/base/src/nsMenuBarFrame.cpp
+++ b/layout/xul/base/src/nsMenuBarFrame.cpp
@@ -144,17 +144,17 @@ nsMenuBarFrame::ToggleMenuActiveState()
     // Set the active menu to be the top left item (e.g., the File menu).
     // We use an attribute called "menuactive" to track the current 
     // active menu.
     nsMenuFrame* firstFrame = nsXULPopupManager::GetNextMenuItem(this, nullptr, false);
     if (firstFrame) {
       // Activate the menu bar
       SetActive(true);
 
-#ifdef MOZ_WIDGET_GTK2
+#if (MOZ_WIDGET_GTK == 2)
       firstFrame->OpenMenu(true);
 #else
       firstFrame->SelectMenu(true);
 #endif
       
       // Track this item for keyboard navigation.
       mCurrentMenu = firstFrame;
     }
--- a/testing/tools/screenshot/gdk-screenshot.cpp
+++ b/testing/tools/screenshot/gdk-screenshot.cpp
@@ -56,17 +56,17 @@ gboolean save_to_stdout(const gchar *buf
   return TRUE;
 }
 
 int main(int argc, char** argv)
 {
   gdk_init(&argc, &argv);
 
 // TODO GTK3
-#if defined(HAVE_LIBXSS) && defined(MOZ_WIDGET_GTK2)
+#if defined(HAVE_LIBXSS) && (MOZ_WIDGET_GTK == 2)
   int event_base, error_base;
   Bool have_xscreensaver =
     XScreenSaverQueryExtension(GDK_DISPLAY(), &event_base, &error_base);
 
   if (!have_xscreensaver) {
     fprintf(stderr, "No XScreenSaver extension on display\n");
   } else {
     XScreenSaverInfo* info = XScreenSaverAllocInfo();
@@ -124,17 +124,17 @@ int main(int argc, char** argv)
 
     XFree(info);
   }
 #endif
 
   GdkWindow* window = gdk_get_default_root_window();
   GdkPixbuf* screenshot = NULL;
 // TODO GTK3
-#if defined(MOZ_WIDGET_GTK2)
+#if (MOZ_WIDGET_GTK == 2)
   screenshot = gdk_pixbuf_get_from_drawable(NULL, window, NULL,
                                             0, 0, 0, 0,
                                             gdk_screen_width(),
                                             gdk_screen_height());
 #endif
   if (!screenshot) {
     fprintf(stderr, "%s: failed to create screenshot GdkPixbuf\n", argv[0]);
     return 1;
--- a/toolkit/components/jsdownloads/src/DownloadPlatform.cpp
+++ b/toolkit/components/jsdownloads/src/DownloadPlatform.cpp
@@ -20,17 +20,17 @@
 #ifdef XP_MACOSX
 #include <CoreFoundation/CoreFoundation.h>
 #endif
 
 #ifdef MOZ_WIDGET_ANDROID
 #include "AndroidBridge.h"
 #endif
 
-#ifdef MOZ_WIDGET_GTK2
+#if (MOZ_WIDGET_GTK == 2)
 #include <gtk/gtk.h>
 #endif
 
 using namespace mozilla;
 
 DownloadPlatform *DownloadPlatform::gDownloadPlatformService = nullptr;
 
 NS_IMPL_ISUPPORTS1(DownloadPlatform, mozIDownloadPlatform);
@@ -38,17 +38,17 @@ NS_IMPL_ISUPPORTS1(DownloadPlatform, moz
 DownloadPlatform* DownloadPlatform::GetDownloadPlatform()
 {
   if (!gDownloadPlatformService) {
     gDownloadPlatformService = new DownloadPlatform();
   }
 
   NS_ADDREF(gDownloadPlatformService);
 
-#if defined(MOZ_WIDGET_GTK2)
+#if (MOZ_WIDGET_GTK == 2)
   g_type_init();
 #endif
 
   return gDownloadPlatformService;
 }
 
 #ifdef MOZ_ENABLE_GIO
 static void gio_set_metadata_done(GObject *source_obj, GAsyncResult *res, gpointer user_data)
@@ -62,28 +62,28 @@ static void gio_set_metadata_done(GObjec
     g_error_free(err);
   }
 }
 #endif
 
 nsresult DownloadPlatform::DownloadDone(nsIURI* aSource, nsIFile* aTarget,
                                         const nsACString& aContentType, bool aIsPrivate)
 {
-#if defined(XP_WIN) || defined(XP_MACOSX) || defined(MOZ_WIDGET_ANDROID) || defined(MOZ_WIDGET_GTK2)
+#if defined(XP_WIN) || defined(XP_MACOSX) || defined(MOZ_WIDGET_ANDROID) || (MOZ_WIDGET_GTK == 2)
   nsAutoString path;
   if (aTarget && NS_SUCCEEDED(aTarget->GetPath(path))) {
-#if defined(XP_WIN) || defined(MOZ_WIDGET_GTK2)
+#if defined(XP_WIN) || (MOZ_WIDGET_GTK == 2)
     // On Windows and Gtk, add the download to the system's "recent documents"
     // list, with a pref to disable.
     {
       bool addToRecentDocs = Preferences::GetBool(PREF_BDM_ADDTORECENTDOCS);
       if (addToRecentDocs && !aIsPrivate) {
 #ifdef XP_WIN
         ::SHAddToRecentDocs(SHARD_PATHW, path.get());
-#elif defined(MOZ_WIDGET_GTK2)
+#elif (MOZ_WIDGET_GTK == 2)
         GtkRecentManager* manager = gtk_recent_manager_get_default();
 
         gchar* uri = g_filename_to_uri(NS_ConvertUTF16toUTF8(path).get(),
                                        NULL, NULL);
         if (uri) {
           gtk_recent_manager_add_item(manager, uri);
           g_free(uri);
         }
--- a/toolkit/xre/nsX11ErrorHandler.cpp
+++ b/toolkit/xre/nsX11ErrorHandler.cpp
@@ -53,17 +53,17 @@ X11Error(Display *display, XErrorEvent *
             break;
           }
         }
 
         XFreeExtensionList(extNames);
       }
       XCloseDisplay(tmpDisplay);
 
-#ifdef MOZ_WIDGET_GTK2
+#if (MOZ_WIDGET_GTK == 2)
       // GDK2 calls XCloseDevice the devices that it opened on startup, but
       // the XI protocol no longer ensures that the devices will still exist.
       // If they have been removed, then a BadDevice error results.  Ignore
       // this error.
       if (message.EqualsLiteral("XInputExtension.4") &&
           event->error_code == first_error + 0) {
         return 0;
       }
--- a/widget/gtk2/gtkdrawing.h
+++ b/widget/gtk2/gtkdrawing.h
@@ -204,25 +204,25 @@ gint moz_gtk_enable_style_props(style_pr
 /**
  * Perform cleanup of the drawing library. You should call this function
  * when your program exits, or you no longer need the library.
  *
  * returns: MOZ_GTK_SUCCESS if there was no error, an error code otherwise
  */
 gint moz_gtk_shutdown();
 
-#if defined(MOZ_WIDGET_GTK2)
+#if (MOZ_WIDGET_GTK == 2)
 /**
  * Retrieves the colormap to use for drawables passed to moz_gtk_widget_paint.
  */
 GdkColormap* moz_gtk_widget_get_colormap();
 #endif
 
 /*** Widget drawing ***/
-#if defined(MOZ_WIDGET_GTK2)
+#if (MOZ_WIDGET_GTK == 2)
 /**
  * Paint a widget in the current theme.
  * widget:    a constant giving the widget to paint
  * drawable:  the drawable to paint to;
  *            it's colormap must be moz_gtk_widget_get_colormap().
  * rect:      the bounding rectangle for the widget
  * cliprect:  a clipprect rectangle for this painting operation
  * state:     the state of the widget.  ignored for some widgets.
--- a/widget/gtk2/mozcontainer.c
+++ b/widget/gtk2/mozcontainer.c
@@ -231,37 +231,37 @@ moz_container_realize (GtkWidget *widget
         attributes.x = allocation.x;
         attributes.y = allocation.y;
         attributes.width = allocation.width;
         attributes.height = allocation.height;
         attributes.wclass = GDK_INPUT_OUTPUT;
         attributes.visual = gtk_widget_get_visual (widget);
         attributes.window_type = GDK_WINDOW_CHILD;
 
-#if defined(MOZ_WIDGET_GTK2)    
+#if (MOZ_WIDGET_GTK == 2)
         attributes.colormap = gtk_widget_get_colormap (widget);
         attributes_mask |= GDK_WA_COLORMAP;
 #endif
 
         window = gdk_window_new (parent, &attributes, attributes_mask);
         gdk_window_set_user_data (window, widget);
-#if defined(MOZ_WIDGET_GTK2)
+#if (MOZ_WIDGET_GTK == 2)
         /* TODO GTK3? */
         /* set the back pixmap to None so that you don't end up with the gtk
            default which is BlackPixel */
         gdk_window_set_back_pixmap (window, NULL, FALSE);
 #endif
     } else {
         window = parent;
         g_object_ref (window);
     }
 
     gtk_widget_set_window (widget, window);
 
-#if defined(MOZ_WIDGET_GTK2)    
+#if (MOZ_WIDGET_GTK == 2)
     widget->style = gtk_style_attach (widget->style, widget->window);
 #endif
 }
 
 void
 moz_container_size_allocate (GtkWidget     *widget,
                              GtkAllocation *allocation)
 {
--- a/widget/gtk2/nsNativeThemeGTK.cpp
+++ b/widget/gtk2/nsNativeThemeGTK.cpp
@@ -625,17 +625,17 @@ nsNativeThemeGTK::GetGtkWidgetAndState(u
     break;
   default:
     return false;
   }
 
   return true;
 }
 
-#if defined(MOZ_WIDGET_GTK2)
+#if (MOZ_WIDGET_GTK == 2)
 class ThemeRenderer : public gfxGdkNativeRenderer {
 public:
   ThemeRenderer(GtkWidgetState aState, GtkThemeWidgetType aGTKWidgetType,
                 gint aFlags, GtkTextDirection aDirection,
                 const GdkRectangle& aGDKRect, const GdkRectangle& aGDKClip)
     : mState(aState), mGTKWidgetType(aGTKWidgetType), mFlags(aFlags),
       mDirection(aDirection), mGDKRect(aGDKRect), mGDKClip(aGDKClip) {}
   nsresult DrawWithGDK(GdkDrawable * drawable, gint offsetX, gint offsetY,
@@ -817,17 +817,17 @@ nsNativeThemeGTK::DrawWidgetBackground(n
                "Trying to render an unsafe widget!");
 
   bool safeState = IsWidgetStateSafe(mSafeWidgetStates, aWidgetType, &state);
   if (!safeState) {
     gLastGdkError = 0;
     gdk_error_trap_push ();
   }
 
-#if defined(MOZ_WIDGET_GTK2)
+#if (MOZ_WIDGET_GTK == 2)
   // The gdk_clip is just advisory here, meaning "you don't
   // need to draw outside this rect if you don't feel like it!"
   GdkRectangle gdk_clip = {0, 0, drawingRect.width, drawingRect.height};
 
   ThemeRenderer renderer(state, gtkWidgetType, flags, direction,
                          gdk_rect, gdk_clip);
 
   // Some themes (e.g. Clearlooks) just don't clip properly to any
--- a/widget/gtk2/nsWindow.cpp
+++ b/widget/gtk2/nsWindow.cpp
@@ -39,17 +39,17 @@
 #include <X11/XF86keysym.h>
 #endif
 
 #if (MOZ_WIDGET_GTK == 2)
 #include "gtk2xtbin.h"
 #endif
 #endif /* MOZ_X11 */
 #include <gdk/gdkkeysyms.h>
-#if defined(MOZ_WIDGET_GTK2)
+#if (MOZ_WIDGET_GTK == 2)
 #include <gtk/gtkprivate.h>
 #endif
 
 #include "nsGkAtoms.h"
 
 #ifdef MOZ_ENABLE_STARTUP_NOTIFICATION
 #define SN_API_NOT_YET_FROZEN
 #include <startup-notification-1.0/libsn/sn.h>
@@ -151,17 +151,17 @@ static GdkWindow *get_inner_gdk_window (
 static inline bool is_context_menu_key(const nsKeyEvent& inKeyEvent);
 
 static int    is_parent_ungrab_enter(GdkEventCrossing *aEvent);
 static int    is_parent_grab_leave(GdkEventCrossing *aEvent);
 
 static void GetBrandName(nsXPIDLString& brandName);
 
 /* callbacks from widgets */
-#if defined(MOZ_WIDGET_GTK2)
+#if (MOZ_WIDGET_GTK == 2)
 static gboolean expose_event_cb           (GtkWidget *widget,
                                            GdkEventExpose *event);
 #else
 static gboolean expose_event_cb           (GtkWidget *widget,
                                            cairo_t *rect);
 #endif
 static gboolean configure_event_cb        (GtkWidget *widget,
                                            GdkEventConfigure *event);
@@ -297,17 +297,17 @@ protected:
     bool HaveResource() const { return data != nullptr; }
 
     pixman_region32& get() { return *this; }
 };
 
 static inline int32_t
 GetBitmapStride(int32_t width)
 {
-#if defined(MOZ_X11) || defined(MOZ_WIDGET_GTK2)
+#if defined(MOZ_X11) || (MOZ_WIDGET_GTK == 2)
   return (width+7)/8;
 #else
   return cairo_format_stride_for_width(CAIRO_FORMAT_A1, width);
 #endif
 }
 
 static inline bool TimestampIsNewerThan(guint32 a, guint32 b)
 {
@@ -646,17 +646,17 @@ nsWindow::Destroy(void)
     }
 
     // make sure that we remove ourself as the focus window
     if (gFocusWindow == this) {
         LOGFOCUS(("automatically losing focus...\n"));
         gFocusWindow = nullptr;
     }
 
-#if defined(MOZ_WIDGET_GTK2) && defined(MOZ_X11)
+#if (MOZ_WIDGET_GTK == 2) && defined(MOZ_X11)
     // make sure that we remove ourself as the plugin focus window
     if (gPluginFocusWindow == this) {
         gPluginFocusWindow->LoseNonXEmbedPluginFocus();
     }
 #endif /* MOZ_X11 && MOZ_WIDGET_GTK2 */
   
     // Destroy thebes surface now. Badness can happen if we destroy
     // the surface after its X Window.
@@ -1902,17 +1902,17 @@ gdk_window_flash(GdkWindow *    aGdkWind
   gint         x;
   gint         y;
   gint         width;
   gint         height;
   guint        i;
   GdkGC *      gc = 0;
   GdkColor     white;
 
-#if defined(MOZ_WIDGET_GTK2)
+#if (MOZ_WIDGET_GTK == 2)
   gdk_window_get_geometry(aGdkWindow,NULL,NULL,&width,&height,NULL);
 #else
   gdk_window_get_geometry(aGdkWindow,NULL,NULL,&width,&height);
 #endif
 
   gdk_window_get_origin (aGdkWindow,
                          &x,
                          &y);
@@ -1950,17 +1950,17 @@ gdk_window_flash(GdkWindow *    aGdkWind
   gdk_gc_destroy(gc);
 
   gdk_region_offset(aRegion, -x, -y);
 }
 #endif /* MOZ_X11 */
 #endif // DEBUG
 #endif
 
-#if defined(MOZ_WIDGET_GTK2)
+#if (MOZ_WIDGET_GTK == 2)
 gboolean
 nsWindow::OnExposeEvent(GdkEventExpose *aEvent)
 #else
 gboolean
 nsWindow::OnExposeEvent(cairo_t *cr)
 #endif
 {
     if (mIsDestroyed) {
@@ -1995,17 +1995,17 @@ nsWindow::OnExposeEvent(cairo_t *cr)
         // Re-get the listener since the will paint notification might have
         // killed it.
         listener =
             mAttachedWidgetListener ? mAttachedWidgetListener : mWidgetListener;
         if (!listener)
             return FALSE;
     }
 
-#if defined(MOZ_WIDGET_GTK2)
+#if (MOZ_WIDGET_GTK == 2)
     GdkRectangle *rects;
     gint nrects;
     gdk_region_get_rectangles(aEvent->region, &rects, &nrects);
     if (MOZ_UNLIKELY(!rects)) // OOM
         return FALSE;
 #else
 #ifdef cairo_copy_clip_rectangle_list
 #error "Looks like we're including Mozilla's cairo instead of system cairo"
@@ -2015,31 +2015,31 @@ nsWindow::OnExposeEvent(cairo_t *cr)
     if (MOZ_UNLIKELY(rects->status != CAIRO_STATUS_SUCCESS)) {
        NS_WARNING("Failed to obtain cairo rectangle list.");
        return FALSE;
     }
 #endif
 #endif
 
 // GTK3 TODO?
-#if defined(MOZ_WIDGET_GTK2)
+#if (MOZ_WIDGET_GTK == 2)
     if (nrects > MAX_RECTS_IN_REGION) {
         // Just use the bounding box
         rects[0] = aEvent->area;
         nrects = 1;
     }
 #endif
 
     LOGDRAW(("sending expose event [%p] %p 0x%lx (rects follow):\n",
              (void *)this, (void *)mGdkWindow,
              gdk_x11_window_get_xid(mGdkWindow)));
 
     nsIntRegion region;
   
-#if defined(MOZ_WIDGET_GTK2)
+#if (MOZ_WIDGET_GTK == 2)
     GdkRectangle *r = rects;
     GdkRectangle *r_end = rects + nrects;
 #else
     cairo_rectangle_t *r = rects->rectangles;
     cairo_rectangle_t *r_end = r + rects->num_rectangles;
 #endif
     for (; r < r_end; ++r) {
         region.Or(region, nsIntRect(r->x, r->y, r->width, r->height));
@@ -2082,17 +2082,17 @@ nsWindow::OnExposeEvent(cairo_t *cr)
                     region.Sub(region, r);
                 }
             }
             children = children->next;
         }
     }
 
     if (region.IsEmpty()) {
-#if defined(MOZ_WIDGET_GTK2)
+#if (MOZ_WIDGET_GTK == 2)
         g_free(rects);
 #else
         cairo_rectangle_list_destroy(rects);
 #endif
         return TRUE;
     }
     // If this widget uses OMTC...
     if (GetLayerManager()->GetBackendType() == LAYERS_CLIENT) {
@@ -2107,17 +2107,17 @@ nsWindow::OnExposeEvent(cairo_t *cr)
 
         listener->PaintWindow(this, region);
         listener->DidPaintWindow();
 
         g_free(rects);
         return TRUE;
     }
 
-#if defined(MOZ_WIDGET_GTK2)
+#if (MOZ_WIDGET_GTK == 2)
     nsRefPtr<gfxContext> ctx = new gfxContext(GetThebesSurface());
 #else
     nsRefPtr<gfxContext> ctx = new gfxContext(GetThebesSurface(cr));
 #endif
 
 #ifdef MOZ_X11
     nsIntRect boundsRect; // for shaped only
 
@@ -2202,43 +2202,43 @@ nsWindow::OnExposeEvent(cairo_t *cr)
                 ctx->SetOperator(gfxContext::OPERATOR_SOURCE);
                 ctx->SetPattern(pattern);
                 ctx->Paint();
             }
         }
     }
 #  ifdef MOZ_HAVE_SHMIMAGE
     if (nsShmImage::UseShm() && MOZ_LIKELY(!mIsDestroyed)) {
-#if defined(MOZ_WIDGET_GTK2)
+#if (MOZ_WIDGET_GTK == 2)
         mShmImage->Put(mGdkWindow, rects, r_end);
 #else
         mShmImage->Put(mGdkWindow, rects);
 #endif
     }
 #  endif  // MOZ_HAVE_SHMIMAGE
 #endif // MOZ_X11
 
-#if defined(MOZ_WIDGET_GTK2)
+#if (MOZ_WIDGET_GTK == 2)
     g_free(rects);
 #else
     cairo_rectangle_list_destroy(rects);
 #endif
 
     listener->DidPaintWindow();
 
     // Synchronously flush any new dirty areas
-#if defined(MOZ_WIDGET_GTK2)
+#if (MOZ_WIDGET_GTK == 2)
     GdkRegion* dirtyArea = gdk_window_get_update_area(mGdkWindow);
 #else
     cairo_region_t* dirtyArea = gdk_window_get_update_area(mGdkWindow);
 #endif
 
     if (dirtyArea) {
         gdk_window_invalidate_region(mGdkWindow, dirtyArea, false);
-#if defined(MOZ_WIDGET_GTK2)
+#if (MOZ_WIDGET_GTK == 2)
         gdk_region_destroy(dirtyArea);
 #else
         cairo_region_destroy(dirtyArea);
 #endif
         gdk_window_process_updates(mGdkWindow, false);
     }
 
     // check the return value!
@@ -2461,17 +2461,17 @@ nsWindow::OnMotionNotifyEvent(GdkEventMo
         XPeekEvent (GDK_WINDOW_XDISPLAY(aEvent->window), &peeked);
         if (peeked.xany.window != gdk_x11_window_get_xid(aEvent->window)
             || peeked.type != MotionNotify)
             break;
 
         synthEvent = true;
         XNextEvent (GDK_WINDOW_XDISPLAY(aEvent->window), &xevent);
     }
-#if defined(MOZ_WIDGET_GTK2)
+#if (MOZ_WIDGET_GTK == 2)
     // if plugins still keeps the focus, get it back
     if (gPluginFocusWindow && gPluginFocusWindow != this) {
         nsRefPtr<nsWindow> kungFuDeathGrip = gPluginFocusWindow;
         gPluginFocusWindow->LoseNonXEmbedPluginFocus();
     }
 #endif /* MOZ_WIDGET_GTK2 */
 #endif /* MOZ_X11 */
 
@@ -2809,17 +2809,17 @@ nsWindow::OnContainerFocusOutEvent(GdkEv
             shouldRollup = (sourceNode == nullptr);
         }
 
         if (shouldRollup) {
             CheckForRollup(0, 0, false, true);
         }
     }
 
-#if defined(MOZ_WIDGET_GTK2) && defined(MOZ_X11)
+#if (MOZ_WIDGET_GTK == 2) && defined(MOZ_X11)
     // plugin lose focus
     if (gPluginFocusWindow) {
         nsRefPtr<nsWindow> kungFuDeathGrip = gPluginFocusWindow;
         gPluginFocusWindow->LoseNonXEmbedPluginFocus();
     }
 #endif /* MOZ_X11 && MOZ_WIDGET_GTK2 */
 
     if (gFocusWindow) {
@@ -3274,26 +3274,26 @@ CreateGdkWindow(GdkWindow *parent, GtkWi
     attributes.event_mask = kEvents;
 
     attributes.width = 1;
     attributes.height = 1;
     attributes.wclass = GDK_INPUT_OUTPUT;
     attributes.visual = gtk_widget_get_visual(widget);
     attributes.window_type = GDK_WINDOW_CHILD;
 
-#if defined(MOZ_WIDGET_GTK2)
+#if (MOZ_WIDGET_GTK == 2)
     attributes_mask |= GDK_WA_COLORMAP;
     attributes.colormap = gtk_widget_get_colormap(widget);
 #endif
 
     GdkWindow *window = gdk_window_new(parent, &attributes, attributes_mask);
     gdk_window_set_user_data(window, widget);
 
 // GTK3 TODO?
-#if defined(MOZ_WIDGET_GTK2)
+#if (MOZ_WIDGET_GTK == 2)
     /* set the default pixmap to None so that you don't end up with the
        gtk default which is BlackPixel. */
     gdk_window_set_back_pixmap(window, NULL, FALSE);
 #endif
 
     return window;
 }
 
@@ -3415,17 +3415,17 @@ nsWindow::Create(nsIWidget        *aPare
 
             if (aInitData->mSupportTranslucency) {
                 // We need to select an ARGB visual here instead of in
                 // SetTransparencyMode() because it has to be done before the
                 // widget is realized.  An ARGB visual is only useful if we
                 // are on a compositing window manager.
                 GdkScreen *screen = gtk_widget_get_screen(mShell);
                 if (gdk_screen_is_composited(screen)) {
-#if defined(MOZ_WIDGET_GTK2)
+#if (MOZ_WIDGET_GTK == 2)
                     GdkColormap *colormap =
                         gdk_screen_get_rgba_colormap(screen);
                     gtk_widget_set_colormap(mShell, colormap);
 #else
                     GdkVisual *visual = gdk_screen_get_rgba_visual(screen);
                     gtk_widget_set_visual(mShell, visual);
 #endif
                 }
@@ -3594,17 +3594,17 @@ nsWindow::Create(nsIWidget        *aPare
         g_signal_connect_after(mContainer, "size_allocate",
                                G_CALLBACK(size_allocate_cb), NULL);
         g_signal_connect(mContainer, "hierarchy-changed",
                          G_CALLBACK(hierarchy_changed_cb), NULL);
         // Initialize mHasMappedToplevel.
         hierarchy_changed_cb(GTK_WIDGET(mContainer), NULL);
         // Expose, focus, key, and drag events are sent even to GTK_NO_WINDOW
         // widgets.
-#if defined(MOZ_WIDGET_GTK2)
+#if (MOZ_WIDGET_GTK == 2)
         g_signal_connect(mContainer, "expose_event",
                          G_CALLBACK(expose_event_cb), NULL);
 #else
         g_signal_connect(G_OBJECT(mContainer), "draw",
                          G_CALLBACK(expose_event_cb), NULL);
 #endif
         g_signal_connect(mContainer, "focus_in_event",
                          G_CALLBACK(focus_in_event_cb), NULL);
@@ -3651,17 +3651,17 @@ nsWindow::Create(nsIWidget        *aPare
     } else if (!mIMModule) {
         nsWindow *container = GetContainerWindow();
         if (container) {
             mIMModule = container->mIMModule;
         }
     }
 
     if (eventWidget) {
-#if defined(MOZ_WIDGET_GTK2)
+#if (MOZ_WIDGET_GTK == 2)
         // Don't let GTK mess with the shapes of our GdkWindows
         GTK_PRIVATE_SET_FLAG(eventWidget, GTK_HAS_SHAPE_MASK);
 #endif
 
         // These events are sent to the owning widget of the relevant window
         // and propagate up to the first widget that handles the events, so we
         // need only connect on mShell, if it exists, to catch events on its
         // window and windows of mContainer.
@@ -4092,17 +4092,17 @@ nsWindow::SetWindowClipRegion(const nsTA
     }
 
     if (!StoreWindowClipRegion(*newRects))
         return;
 
     if (!mGdkWindow)
         return;
 
-#if defined(MOZ_WIDGET_GTK2)
+#if (MOZ_WIDGET_GTK == 2)
     GdkRegion *region = gdk_region_new(); // aborts on OOM
     for (uint32_t i = 0; i < newRects->Length(); ++i) {
         const nsIntRect& r = newRects->ElementAt(i);
         GdkRectangle rect = { r.x, r.y, r.width, r.height };
         gdk_region_union_with_rect(region, &rect);
     }
 
     gdk_window_shape_combine_region(mGdkWindow, region, 0, 0);
@@ -4222,17 +4222,17 @@ nsWindow::ApplyTransparencyBitmap()
                                               mTransparencyBitmap,
                                               mTransparencyBitmapWidth,
                                               mTransparencyBitmapHeight);
     XShapeCombineMask(xDisplay, xDrawable,
                       ShapeBounding, 0, 0,
                       maskPixmap, ShapeSet);
     XFreePixmap(xDisplay, maskPixmap);
 #else
-#if defined(MOZ_WIDGET_GTK2)
+#if (MOZ_WIDGET_GTK == 2)
     gtk_widget_reset_shapes(mShell);
     GdkBitmap* maskBitmap = gdk_bitmap_create_from_data(gtk_widget_get_window(mShell),
             mTransparencyBitmap,
             mTransparencyBitmapWidth, mTransparencyBitmapHeight);
     if (!maskBitmap)
         return;
 
     gtk_widget_shape_combine_mask(mShell, maskBitmap, 0, 0);
@@ -4491,17 +4491,17 @@ nsWindow::SetNonXEmbedPluginFocus()
     GdkDisplay *gdkDisplay = gdk_window_get_display(mGdkWindow);
     XGetInputFocus(gdk_x11_display_get_xdisplay(gdkDisplay),
                    &curFocusWindow,
                    &focusState);
 
     LOGFOCUS(("\t curFocusWindow=%p\n", curFocusWindow));
 
     GdkWindow* toplevel = gdk_window_get_toplevel(mGdkWindow);
-#if defined(MOZ_WIDGET_GTK2)
+#if (MOZ_WIDGET_GTK == 2)
     GdkWindow *gdkfocuswin = gdk_window_lookup(curFocusWindow);
 #else
     GdkWindow *gdkfocuswin = gdk_x11_window_lookup_for_display(gdkDisplay,
                                                                curFocusWindow);
 #endif
 
     // lookup with the focus proxy window is supposed to get the
     // same GdkWindow as toplevel. If the current focused window
@@ -4774,17 +4774,17 @@ is_mouse_in_window (GdkWindow* aWindow, 
             break;
         }
 
         offsetX += tmpX;
         offsetY += tmpY;
         window = gdk_window_get_parent(window);
     }
 
-#if defined(MOZ_WIDGET_GTK2)
+#if (MOZ_WIDGET_GTK == 2)
     gdk_drawable_get_size(aWindow, &w, &h);
 #else
     w = gdk_window_get_width(aWindow);
     h = gdk_window_get_height(aWindow);
 #endif
 
     if (aMouseX > x && aMouseX < x + w &&
         aMouseY > y && aMouseY < y + h)
@@ -4978,17 +4978,17 @@ get_gtk_cursor(nsCursor aCursor)
 
     gCursorCache[aCursor] = gdkcursor;
 
     return gdkcursor;
 }
 
 // gtk callbacks
 
-#if defined(MOZ_WIDGET_GTK2)
+#if (MOZ_WIDGET_GTK == 2)
 static gboolean
 expose_event_cb(GtkWidget *widget, GdkEventExpose *event)
 {
     nsRefPtr<nsWindow> window = get_window_for_gdk_window(event->window);
     if (!window)
         return FALSE;
 
     window->OnExposeEvent(event);
@@ -5285,28 +5285,28 @@ plugin_window_filter_func(GdkXEvent *gdk
             if (xevent->type==CreateNotify) {
                 xeventWindow = xevent->xcreatewindow.window;
             }
             else {
                 if (xevent->xreparent.event != xevent->xreparent.parent)
                     break;
                 xeventWindow = xevent->xreparent.window;
             }
-#if defined(MOZ_WIDGET_GTK2)
+#if (MOZ_WIDGET_GTK == 2)
             plugin_window = gdk_window_lookup(xeventWindow);
 #else
             plugin_window = gdk_x11_window_lookup_for_display(
                                   gdk_x11_lookup_xdisplay(xevent->xcreatewindow.display), xeventWindow);
 #endif        
             if (plugin_window) {
                 GtkWidget *widget =
                     get_gtk_widget_for_gdk_window(plugin_window);
 
 // TODO GTK3
-#if defined(MOZ_WIDGET_GTK2)
+#if (MOZ_WIDGET_GTK == 2)
                 if (GTK_IS_XTBIN(widget)) {
                     nswindow->SetPluginType(nsWindow::PluginType_NONXEMBED);
                     break;
                 }
                 else 
 #endif
                 if(GTK_IS_SOCKET(widget)) {
                     if (!g_object_get_data(G_OBJECT(widget), "enable-xt-focus")) {
@@ -5663,17 +5663,17 @@ get_inner_gdk_window (GdkWindow *aWindow
 {
     gint cx, cy, cw, ch;
     GList *children = gdk_window_peek_children(aWindow);
     for (GList *child = g_list_last(children);
          child;
          child = g_list_previous(child)) {
         GdkWindow *childWindow = (GdkWindow *) child->data;
         if (get_window_for_gdk_window(childWindow)) {
-#if defined(MOZ_WIDGET_GTK2)
+#if (MOZ_WIDGET_GTK == 2)
             gdk_window_get_geometry(childWindow, &cx, &cy, &cw, &ch, NULL);
 #else
             gdk_window_get_geometry(childWindow, &cx, &cy, &cw, &ch);
 #endif
             if ((cx < x) && (x < (cx + cw)) &&
                 (cy < y) && (y < (cy + ch)) &&
                 gdk_window_is_visible(childWindow)) {
                 return get_inner_gdk_window(childWindow,
@@ -5863,17 +5863,17 @@ nsWindow::GetToggledKeyState(uint32_t aK
         default: return NS_ERROR_INVALID_ARG;
     }
 
     *aLEDState =
         KeymapWrapper::AreModifiersCurrentlyActive(modifier);
     return NS_OK;
 }
 
-#if defined(MOZ_X11) && defined(MOZ_WIDGET_GTK2)
+#if defined(MOZ_X11) && (MOZ_WIDGET_GTK == 2)
 /* static */ already_AddRefed<gfxASurface>
 nsWindow::GetSurfaceForGdkDrawable(GdkDrawable* aDrawable,
                                    const nsIntSize& aSize)
 {
     GdkVisual* visual = gdk_drawable_get_visual(aDrawable);
     Screen* xScreen =
         gdk_x11_screen_get_xscreen(gdk_drawable_get_screen(aDrawable));
     Display* xDisplay = DisplayOfScreen(xScreen);
@@ -5905,17 +5905,17 @@ nsWindow::GetSurfaceForGdkDrawable(GdkDr
         result = new gfxXlibSurface(xScreen, xDrawable, pf,
                                     gfxIntSize(aSize.width, aSize.height));
     }
 
     return result.forget();
 }
 #endif
 
-#if defined(MOZ_WIDGET_GTK2)
+#if (MOZ_WIDGET_GTK == 2)
 TemporaryRef<DrawTarget>
 nsWindow::StartRemoteDrawing()
 {
   gfxASurface *surf = GetThebesSurface();
   if (!surf) {
     return nullptr;
   }
 
@@ -5925,37 +5925,37 @@ nsWindow::StartRemoteDrawing()
   }
 
   return gfxPlatform::GetPlatform()->CreateDrawTargetForSurface(surf, size);
 }
 #endif
 
 // return the gfxASurface for rendering to this widget
 gfxASurface*
-#if defined(MOZ_WIDGET_GTK2)
+#if (MOZ_WIDGET_GTK == 2)
 nsWindow::GetThebesSurface()
 #else
 nsWindow::GetThebesSurface(cairo_t *cr)
 #endif
 {
     if (!mGdkWindow)
         return nullptr;
 
-#if !defined(MOZ_WIDGET_GTK2)
+#if (MOZ_WIDGET_GTK != 2)
     cairo_surface_t *surf = cairo_get_target(cr);
     if (cairo_surface_status(surf) != CAIRO_STATUS_SUCCESS) {
       NS_NOTREACHED("Missing cairo target?");
       return NULL;
     }
 #endif // MOZ_WIDGET_GTK2
 
 #ifdef MOZ_X11
     gint width, height;
 
-#if defined(MOZ_WIDGET_GTK2)
+#if (MOZ_WIDGET_GTK == 2)
     gdk_drawable_get_size(GDK_DRAWABLE(mGdkWindow), &width, &height);
 #else
     width = gdk_window_get_width(mGdkWindow);
     height = gdk_window_get_height(mGdkWindow);
 #endif
 
     // Owen Taylor says this is the right thing to do!
     width = std::min(32767, width);
@@ -5975,17 +5975,17 @@ nsWindow::GetThebesSurface(cairo_t *cr)
             nsShmImage::EnsureShmImage(size,
                                        visual, gdk_visual_get_depth(gdkVisual),
                                        mShmImage);
         usingShm = mThebesSurface != nullptr;
     }
     if (!usingShm)
 #  endif  // MOZ_HAVE_SHMIMAGE
 
-#if defined(MOZ_WIDGET_GTK2)
+#if (MOZ_WIDGET_GTK == 2)
     mThebesSurface = new gfxXlibSurface
         (GDK_WINDOW_XDISPLAY(mGdkWindow),
          gdk_x11_window_get_xid(mGdkWindow),
          visual,
          size);
 #else
 #if MOZ_TREE_CAIRO
 #error "cairo-gtk3 target must be built with --enable-system-cairo"
--- a/widget/gtk2/nsWindow.h
+++ b/widget/gtk2/nsWindow.h
@@ -159,17 +159,17 @@ public:
      */
     static guint32     GetLastUserInputTime();
 
     // utility method, -1 if no change should be made, otherwise returns a
     // value that can be passed to gdk_window_set_decorations
     gint               ConvertBorderStyles(nsBorderStyle aStyle);
 
     // event callbacks
-#if defined(MOZ_WIDGET_GTK2)
+#if (MOZ_WIDGET_GTK == 2)
     gboolean           OnExposeEvent(GdkEventExpose *aEvent);
 #else
     gboolean           OnExposeEvent(cairo_t *cr);
 #endif
     gboolean           OnConfigureEvent(GtkWidget *aWidget,
                                         GdkEventConfigure *aEvent);
     void               OnContainerUnrealize();
     void               OnSizeAllocate(GtkAllocation *aAllocation);
@@ -191,17 +191,17 @@ public:
                                                GdkDragContext  *aDragContext,
                                                gint             aX,
                                                gint             aY,
                                                GtkSelectionData*aSelectionData,
                                                guint            aInfo,
                                                guint            aTime,
                                                gpointer         aData);
 
-#if defined(MOZ_WIDGET_GTK2)
+#if (MOZ_WIDGET_GTK == 2)
   mozilla::TemporaryRef<mozilla::gfx::DrawTarget> StartRemoteDrawing() MOZ_OVERRIDE;
 #endif
 
 private:
     void               NativeResize(int32_t aWidth,
                                     int32_t aHeight,
                                     bool    aRepaint);
 
@@ -272,17 +272,17 @@ public:
     void               ClearTransparencyBitmap();
 
    virtual void        SetTransparencyMode(nsTransparencyMode aMode);
    virtual nsTransparencyMode GetTransparencyMode();
    virtual nsresult    ConfigureChildren(const nsTArray<Configuration>& aConfigurations);
    nsresult            UpdateTranslucentWindowAlphaInternal(const nsIntRect& aRect,
                                                             uint8_t* aAlphas, int32_t aStride);
 
-#if defined(MOZ_WIDGET_GTK2)
+#if (MOZ_WIDGET_GTK == 2)
     gfxASurface       *GetThebesSurface();
 
     static already_AddRefed<gfxASurface> GetSurfaceForGdkDrawable(GdkDrawable* aDrawable,
                                                                   const nsIntSize& aSize);
 #else
     gfxASurface       *GetThebesSurface(cairo_t *cr);
 #endif
     NS_IMETHOD         ReparentNativeWidget(nsIWidget* aNewParent);