Bug 388608 Accessible Hierarchy broken on Unix
authorginn.chen@sun.com
Tue, 24 Jul 2007 23:29:28 -0700
changeset 3946 5b614cfe95ff0d8dae6fafc79c4314b4aff0deb2
parent 3945 2faab68da25c8810270a37f65cbb46864691cda5
child 3947 6c6c43c99c133f63fd3952738f17e3a3900b2632
push idunknown
push userunknown
push dateunknown
bugs388608
milestone1.9a7pre
Bug 388608 Accessible Hierarchy broken on Unix r=benjamin
toolkit/xre/nsNativeAppSupportUnix.cpp
--- a/toolkit/xre/nsNativeAppSupportUnix.cpp
+++ b/toolkit/xre/nsNativeAppSupportUnix.cpp
@@ -40,16 +40,17 @@
 #include "nsCOMPtr.h"
 #include "nsXPCOM.h"
 #include "nsISupportsPrimitives.h"
 #include "nsIObserverService.h"
 #include "nsIAppStartup.h"
 #include "nsServiceManagerUtils.h"
 #include "prlink.h"
 
+#include <stdlib.h>
 #include <glib.h>
 #include <glib-object.h>
 
 typedef struct _GnomeProgram GnomeProgram;
 typedef struct _GnomeModuleInfo GnomeModuleInfo;
 typedef struct _GnomeClient GnomeClient;
 
 typedef enum {
@@ -153,19 +154,36 @@ nsNativeAppSupportUnix::Start(PRBool *aR
     (_gnome_program_init_fn)PR_FindFunctionSymbol(gnomeLib, "gnome_program_init");
   _libgnomeui_module_info_get_fn libgnomeui_module_info_get = (_libgnomeui_module_info_get_fn)PR_FindFunctionSymbol(gnomeuiLib, "libgnomeui_module_info_get");
   if (!gnome_program_init || !libgnomeui_module_info_get) {
     PR_UnloadLibrary(gnomeuiLib);
     PR_UnloadLibrary(gnomeLib);
     return NS_OK;
   }
 
+#ifdef ACCESSIBILITY
+  // We will load gail, atk-bridge by ourself later
+  // We can't run atk-bridge init here, because gail get the control
+  // Set GNOME_ACCESSIBILITY to 0 can avoid this
+  static const char *accEnv = "GNOME_ACCESSIBILITY";
+  const char *accOldValue = getenv(accEnv);
+  setenv(accEnv, "0", 1);
+#endif
+
   char *argv[2] = { "gecko", "--disable-crash-dialog" };
   gnome_program_init("Gecko", "1.0", libgnomeui_module_info_get(), 2, argv, NULL);
 
+#ifdef ACCESSIBILITY
+  if (accOldValue) { 
+    setenv(accEnv, accOldValue, 1);
+  } else {
+    unsetenv(accEnv);
+  }
+#endif
+
   // Careful! These libraries cannot be unloaded after this point because
   // gnome_program_init causes atexit handlers to be registered. Strange
   // crashes will occur if these libraries are unloaded.
 
   gnome_client_request_interaction = (_gnome_client_request_interaction_fn)
     PR_FindFunctionSymbol(gnomeuiLib, "gnome_client_request_interaction");
   gnome_interaction_key_return = (_gnome_interaction_key_return_fn)
     PR_FindFunctionSymbol(gnomeuiLib, "gnome_interaction_key_return");