bug 817133 - hack to make atk initialization work after bug 779520 irc-r=davidb

This commit is contained in:
Trevor Saunders 2012-11-30 16:18:38 -05:00
parent 494d4e4bc0
commit be266e5b9d
2 changed files with 35 additions and 29 deletions

View File

@ -529,38 +529,48 @@ ApplicationAccessibleWrap::ApplicationAccessibleWrap():
} else {
MAI_LOG_DEBUG(("Fail to load lib: %s\n", sGail.libName));
}
}
}
MAI_LOG_DEBUG(("Mozilla Atk Implementation initializing\n"));
// XXX we can't do this in ApplicationAccessibleWrap's constructor because
// a11y::ApplicationAcc() will return null then which breaks atk's attempt to
// get the application's root accessible during initialization. this needs to
// be defined here because LoadGtkModule() and the library info is static. See
// bug 817133.
void
nsAccessNodeWrap::InitAccessibility()
{
if (!ShouldA11yBeEnabled())
return;
// Initialize the MAI Utility class, it will overwrite gail_util.
g_type_class_unref(g_type_class_ref(MAI_TYPE_UTIL));
// Initialize the MAI Utility class, it will overwrite gail_util.
g_type_class_unref(g_type_class_ref(MAI_TYPE_UTIL));
// Init atk-bridge now
PR_SetEnv("NO_AT_BRIDGE=0");
// load and initialize atk-bridge library
rv = LoadGtkModule(sAtkBridge);
if (NS_SUCCEEDED(rv)) {
(*sAtkBridge.init)();
} else {
MAI_LOG_DEBUG(("Fail to load lib: %s\n", sAtkBridge.libName));
}
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), NULL);
sToplevel_hide_hook =
g_signal_add_emission_hook(g_signal_lookup("hide", GTK_TYPE_WINDOW),
0, toplevel_event_watcher,
reinterpret_cast<gpointer>(nsIAccessibleEvent::EVENT_HIDE), NULL);
}
// Init atk-bridge now
PR_SetEnv("NO_AT_BRIDGE=0");
nsresult rv = LoadGtkModule(sAtkBridge);
if (NS_SUCCEEDED(rv)) {
(*sAtkBridge.init)();
} else {
MAI_LOG_DEBUG(("Fail to load lib: %s\n", sAtkBridge.libName));
}
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),
NULL);
sToplevel_hide_hook =
g_signal_add_emission_hook(g_signal_lookup("hide", GTK_TYPE_WINDOW), 0,
toplevel_event_watcher,
reinterpret_cast<gpointer>(nsIAccessibleEvent::EVENT_HIDE),
NULL);
}
}
ApplicationAccessibleWrap::~ApplicationAccessibleWrap()
{
MAI_LOG_DEBUG(("======Destory AppRootAcc=%p\n", (void*)this));

View File

@ -33,10 +33,6 @@ nsAccessNodeWrap::~nsAccessNodeWrap()
{
}
void nsAccessNodeWrap::InitAccessibility()
{
}
void nsAccessNodeWrap::ShutdownAccessibility()
{
}