Commit 5debed5a authored by William Jon McCann's avatar William Jon McCann Committed by Matthias Clasen

Shut down a11y when an app shuts down

https://bugzilla.gnome.org/show_bug.cgi?id=684076
parent 5b8d67a0
......@@ -76,6 +76,7 @@ static GtkWidget* focus_before_menu = NULL;
static guint focus_notify_handler = 0;
static guint focus_tracker_id = 0;
static GQuark quark_focus_object = 0;
static int initialized = FALSE;
static AtkObject*
gail_get_accessible_for_widget (GtkWidget *widget,
......@@ -794,10 +795,25 @@ gail_set_focus_object (AtkObject *focus_obj,
}
}
void
_gtk_accessibility_shutdown (void)
{
if (!initialized)
return;
initialized = FALSE;
g_clear_object (&atk_misc_instance);
#ifdef GDK_WINDOWING_X11
atk_bridge_adaptor_cleanup ();
#endif
_gail_util_uninstall ();
}
void
_gtk_accessibility_init (void)
{
static int initialized = FALSE;
if (initialized)
return;
......
......@@ -206,6 +206,17 @@ do_window_event_initialization (void)
(GCallback) window_removed, NULL);
}
static void
undo_window_event_initialization (void)
{
AtkObject *root;
root = atk_get_root ();
g_signal_handlers_disconnect_by_func (root, (GCallback) window_added, NULL);
g_signal_handlers_disconnect_by_func (root, (GCallback) window_removed, NULL);
}
static AtkKeyEventStruct *
atk_key_event_from_gdk_event_key (GdkEventKey *key)
{
......@@ -341,6 +352,12 @@ gail_util_get_toolkit_version (void)
return GTK_VERSION;
}
void
_gail_util_uninstall (void)
{
undo_window_event_initialization ();
}
void
_gail_util_install (void)
{
......
......@@ -23,6 +23,7 @@
G_BEGIN_DECLS
void _gail_util_install (void);
void _gail_util_uninstall (void);
gboolean _gail_util_key_snooper (GtkWidget *the_widget,
GdkEventKey *event);
......
......@@ -47,6 +47,8 @@
#include <gdk/x11/gdkx.h>
#endif
extern void _gtk_accessibility_shutdown (void);
/**
* SECTION:gtkapplication
* @title: GtkApplication
......@@ -425,12 +427,16 @@ gtk_application_shutdown (GApplication *application)
gtk_application_shutdown_quartz (GTK_APPLICATION (application));
#endif
/* Keep this section in sync with gtk_main() */
/* Try storing all clipboard data we have */
_gtk_clipboard_store_all ();
/* Synchronize the recent manager singleton */
_gtk_recent_manager_sync ();
_gtk_accessibility_shutdown ();
G_APPLICATION_CLASS (gtk_application_parent_class)
->shutdown (application);
}
......
......@@ -671,6 +671,7 @@ gettext_initialization (void)
/* XXX: Remove me after getting rid of gail */
extern void _gtk_accessibility_init (void);
extern void _gtk_accessibility_shutdown (void);
static void
do_post_parse_initialization (int *argc,
......@@ -1172,11 +1173,15 @@ gtk_main (void)
if (gtk_main_loop_level == 0)
{
/* Keep this section in sync with gtk_application_shutdown() */
/* Try storing all clipboard data we have */
_gtk_clipboard_store_all ();
/* Synchronize the recent manager singleton */
_gtk_recent_manager_sync ();
_gtk_accessibility_shutdown ();
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment