Bug 1110211 - a11y update for Gtk3. r=glandium
authorMartin Stransky <stransky@redhat.com>
Tue, 16 Dec 2014 07:38:00 +0100
changeset 247829 2db5144ae9f372db86762050ee5500e490aa2151
parent 247828 e7edb75d2debac96e39a71f55490a1d95b6d75bb
child 247830 24dae3ce853db3851f98647b88d24adc8a8379f5
push id4489
push userraliiev@mozilla.com
push dateMon, 23 Feb 2015 15:17:55 +0000
treeherdermozilla-beta@fd7c3dc24146 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersglandium
bugs1110211
milestone37.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 1110211 - a11y update for Gtk3. r=glandium
accessible/atk/Platform.cpp
config/system-headers
configure.in
--- a/accessible/atk/Platform.cpp
+++ b/accessible/atk/Platform.cpp
@@ -13,16 +13,19 @@
 #include "AtkSocketAccessible.h"
 #include "prenv.h"
 #include "prlink.h"
 
 #ifdef MOZ_ENABLE_DBUS
 #include <dbus/dbus.h>
 #endif
 #include <gtk/gtk.h>
+#if (MOZ_WIDGET_GTK == 3)
+#include <atk-bridge.h>
+#endif
 
 using namespace mozilla;
 using namespace mozilla::a11y;
 
 int atkMajorVersion = 1, atkMinorVersion = 12;
 
 extern "C" {
 typedef GType (* AtkGetTypeType) (void);
@@ -38,16 +41,17 @@ static const char sATKHyperlinkImplGetTy
 gboolean toplevel_event_watcher(GSignalInvocationHint*, guint, const GValue*,
                                 gpointer);
 static bool sToplevel_event_hook_added = false;
 static gulong sToplevel_show_hook = 0;
 static gulong sToplevel_hide_hook = 0;
 
 GType g_atk_hyperlink_impl_type = G_TYPE_INVALID;
 
+#if (MOZ_WIDGET_GTK == 2)
 struct GnomeAccessibilityModule
 {
     const char *libName;
     PRLibrary *lib;
     const char *initName;
     GnomeAccessibilityInit init;
     const char *shutdownName;
     GnomeAccessibilityShutdown shutdown;
@@ -114,16 +118,17 @@ LoadGtkModule(GnomeAccessibilityModule& 
 
         //fail, :(
         PR_UnloadLibrary(aModule.lib);
         aModule.lib = nullptr;
         return NS_ERROR_FAILURE;
     }
     return NS_OK;
 }
+#endif // (MOZ_WIDGET_GTK == 2)
 
 void
 a11y::PlatformInit()
 {
   if (!ShouldA11yBeEnabled())
     return;
 
   sATKLib = PR_LoadLibrary(sATKLibName);
@@ -153,30 +158,36 @@ a11y::PlatformInit()
     if (version) {
       char* endPtr = nullptr;
       atkMajorVersion = strtol(version, &endPtr, 10);
       if (*endPtr == '.')
         atkMinorVersion = strtol(endPtr + 1, &endPtr, 10);
     }
   }
 
+#if (MOZ_WIDGET_GTK == 2)
   // Load and initialize gail library.
   nsresult rv = LoadGtkModule(sGail);
   if (NS_SUCCEEDED(rv))
     (*sGail.init)();
+#endif
 
   // Initialize the MAI Utility class, it will overwrite gail_util.
   g_type_class_unref(g_type_class_ref(mai_util_get_type()));
 
   // Init atk-bridge now
   PR_SetEnv("NO_AT_BRIDGE=0");
+#if (MOZ_WIDGET_GTK == 2)
   rv = LoadGtkModule(sAtkBridge);
   if (NS_SUCCEEDED(rv)) {
     (*sAtkBridge.init)();
   }
+#else
+  atk_bridge_adaptor_init(nullptr, nullptr);
+#endif
 
   if (!sToplevel_event_hook_added) {
     sToplevel_event_hook_added = true;
     sToplevel_show_hook =
       g_signal_add_emission_hook(g_signal_lookup("show", GTK_TYPE_WINDOW),
                                  0, toplevel_event_watcher,
                                  reinterpret_cast<gpointer>(nsIAccessibleEvent::EVENT_SHOW),
                                  nullptr);
@@ -194,16 +205,17 @@ a11y::PlatformShutdown()
     if (sToplevel_event_hook_added) {
       sToplevel_event_hook_added = false;
       g_signal_remove_emission_hook(g_signal_lookup("show", GTK_TYPE_WINDOW),
                                     sToplevel_show_hook);
       g_signal_remove_emission_hook(g_signal_lookup("hide", GTK_TYPE_WINDOW),
                                     sToplevel_hide_hook);
     }
 
+#if (MOZ_WIDGET_GTK == 2)
     if (sAtkBridge.lib) {
         // Do not shutdown/unload atk-bridge,
         // an exit function registered will take care of it
         // if (sAtkBridge.shutdown)
         //     (*sAtkBridge.shutdown)();
         // PR_UnloadLibrary(sAtkBridge.lib);
         sAtkBridge.lib = nullptr;
         sAtkBridge.init = nullptr;
@@ -215,16 +227,17 @@ a11y::PlatformShutdown()
         // 2) We need it to avoid assert in spi_atk_tidy_windows
         // if (sGail.shutdown)
         //   (*sGail.shutdown)();
         // PR_UnloadLibrary(sGail.lib);
         sGail.lib = nullptr;
         sGail.init = nullptr;
         sGail.shutdown = nullptr;
     }
+#endif
     // if (sATKLib) {
     //     PR_UnloadLibrary(sATKLib);
     //     sATKLib = nullptr;
     // }
 }
 
   static const char sAccEnv [] = "GNOME_ACCESSIBILITY";
 #ifdef MOZ_ENABLE_DBUS
--- a/config/system-headers
+++ b/config/system-headers
@@ -184,16 +184,17 @@ app/MessageRunner.h
 arpa/inet.h
 arpa/nameser.h
 asm/page.h
 asm/sigcontext.h
 asm/signal.h
 ASRegistry.h
 assert.h
 atk/atk.h
+atk-bridge.h
 atlcom.h
 atlconv.h
 atlctl.cpp
 atlctl.h
 ATLCTL.H
 atlhost.h
 atlimpl.cpp
 atlwin.cpp
--- a/configure.in
+++ b/configure.in
@@ -4421,17 +4421,17 @@ if test "$MOZ_ENABLE_XREMOTE"; then
 fi
 
 if test "$MOZ_INSTRUMENT_EVENT_LOOP"; then
    AC_DEFINE(MOZ_INSTRUMENT_EVENT_LOOP)
 fi
 
 if test "$COMPILE_ENVIRONMENT"; then
   if test "$MOZ_ENABLE_GTK3"; then
-    PKG_CHECK_MODULES(MOZ_GTK3, gtk+-3.0 >= $GTK3_VERSION gtk+-unix-print-3.0 glib-2.0 gobject-2.0 $GDK_PACKAGES)
+    PKG_CHECK_MODULES(MOZ_GTK3, gtk+-3.0 >= $GTK3_VERSION gtk+-unix-print-3.0 glib-2.0 gobject-2.0 atk-bridge-2.0 $GDK_PACKAGES)
     MOZ_GTK3_CFLAGS="-I${_topsrcdir}/widget/gtk/compat-gtk3 $MOZ_GTK3_CFLAGS"
     dnl Contrary to MOZ_GTK2_LIBS, MOZ_GTK3_LIBS needs to be literally added to TK_LIBS instead
     dnl of a make reference because of how TK_LIBS is mangled in toolkit/library/moz.build
     dnl for GTK+3 builds.
     TK_LIBS=$MOZ_GTK3_LIBS
   fi
   if test "$MOZ_ENABLE_GTK"; then
     if test "$MOZ_X11"; then