diff options
author | Colomban Wendling <cwendling@hypra.fr> | 2019-12-03 17:09:55 +0100 |
---|---|---|
committer | Colomban Wendling <cwendling@hypra.fr> | 2019-12-03 17:30:59 +0100 |
commit | 8cdf4d30c74e475146a47f0bb1c9992f4a3ac372 (patch) | |
tree | acb45a4da4c45679ff8f36f5a218b35e249cf2f9 /atk-adaptor/event.c | |
parent | 057bcaea717b72c47967804ee079007b27b556d8 (diff) | |
download | at-spi2-atk-8cdf4d30c74e475146a47f0bb1c9992f4a3ac372.tar.gz |
adaptor: Fix missing events at startup
We need to register the application before anything else happens,
otherwise we might miss some events sent before registration.
As we want to register only from the main loop to avoid registering
an application that won't respond to calls [1], we used an idle
callback; but it doesn't run early enough in all cases, e.g. in
Firefox. So, switch to a high-priority 0-timeout so that it should be
dispatched among the first ones in the next main loop iteration, then
being run before other callbacks that might generate events.
Fixes https://gitlab.gnome.org/GNOME/gtk/issues/2186
[1] https://gitlab.gnome.org/GNOME/at-spi2-core/issues/16
Diffstat (limited to 'atk-adaptor/event.c')
-rw-r--r-- | atk-adaptor/event.c | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/atk-adaptor/event.c b/atk-adaptor/event.c index e527d45..bd38eef 100644 --- a/atk-adaptor/event.c +++ b/atk-adaptor/event.c @@ -73,11 +73,8 @@ switch_main_context (GMainContext *cnx) for (list = spi_global_app_data->direct_connections; list; list = list->next) atspi_dbus_connection_setup_with_g_main (list->data, cnx); - if (spi_global_app_data->registration_pending) - { - g_source_remove (spi_global_app_data->registration_pending); - spi_global_app_data->registration_pending = spi_idle_add (_atk_bridge_register_application, spi_global_app_data); - } + if (_atk_bridge_remove_pending_application_registration (spi_global_app_data)) + _atk_bridge_schedule_application_registration (spi_global_app_data); } guint @@ -108,6 +105,22 @@ spi_timeout_add_seconds (gint interval, GSourceFunc function, gpointer data) return id; } +guint +spi_timeout_add_full (gint priority, guint interval, GSourceFunc function, + gpointer data, GDestroyNotify notify) +{ + GSource *source; + guint id; + + source = g_timeout_source_new (interval); + g_source_set_priority (source, priority); + g_source_set_callback (source, function, data, notify); + id = g_source_attach (source, spi_context); + g_source_unref (source); + + return id; +} + static void set_reply (DBusPendingCall * pending, void *user_data) { |