GNOME Bugzilla – Bug 678475
Register to events on initialization only if some client is listening
Last modified: 2012-06-25 08:49:27 UTC
At this moment atk_bridge_adaptor_init always register to atk events. But if no AT client is running, then it calls a deregister method. I think that it could be better to just avoid the first registration if no AT is listening.
Created attachment 216825 [details] [review] Register at beginning only if any AT is listening I use clients list as the way to check if there is any client listening (if clients is NULL, there is no client around). I also needed to change the check to register or not on spi_atk_add_client. Now it just checks clients (not events_initialized) because if not, the events got not properly registered if I do a test like this: * <no at listening> * gnome-control-center * starts orca
Comment on attachment 216825 [details] [review] Register at beginning only if any AT is listening I wonder if the UI will ever be created before atk-bridge sees a response to the message asking if there are any clients, and so we would miss focus or other events, but I haven't seen this when testing briefly, the patch makes sense from the perspective of not creating overhead if no AT is being used, and it fixes bug 678310, so I'd say to commit it, and, if it causes a regression, then hopefully we'll find it when testing the new code. >From cf4cb7b2e7d546579735002e68fe0d5a2beceaac Mon Sep 17 00:00:00 2001 >From: =?UTF-8?q?Alejandro=20Pi=C3=B1eiro?= <apinheiro@igalia.com> >Date: Mon, 18 Jun 2012 15:06:42 +0200 >Subject: [PATCH] Only register events at beginning if AT is listening > >https://bugzilla.gnome.org/show_bug.cgi?id=678475 >--- > atk-adaptor/bridge.c | 5 +++-- > 1 file changed, 3 insertions(+), 2 deletions(-) > >diff --git a/atk-adaptor/bridge.c b/atk-adaptor/bridge.c >index d756795..69527c6 100644 >--- a/atk-adaptor/bridge.c >+++ b/atk-adaptor/bridge.c >@@ -857,7 +857,8 @@ atk_bridge_adaptor_init (gint * argc, gchar ** argv[]) > spi_global_app_data->bus); > > /* Register methods to send D-Bus signals on certain ATK events */ >- spi_atk_register_event_listeners (); >+ if (clients) >+ spi_atk_register_event_listeners (); > > /* Set up filter and match rules to catch signals */ > dbus_bus_add_match (spi_global_app_data->bus, "type='signal', interface='org.a11y.atspi.Registry', sender='org.a11y.atspi.Registry'", NULL); >@@ -947,7 +948,7 @@ spi_atk_add_client (const char *bus_name) > if (!g_strcmp0 (l->data, bus_name)) > return; > } >- if (!clients && spi_global_app_data->events_initialized) >+ if (!clients) > spi_atk_register_event_listeners (); > clients = g_slist_append (clients, g_strdup (bus_name)); > match = g_strdup_printf (name_match_tmpl, bus_name); >-- >1.7.9.5 >
(In reply to comment #2) > (From update of attachment 216825 [details] [review]) > sense from the perspective of not creating overhead if no AT is being used, > and it fixes bug 678310, so I'd say to commit it, and, if it causes a > regression, then hopefully we'll find it when testing the new code. Ok, thanks for the review. Commit pushed. Closing bug.
*** Bug 678310 has been marked as a duplicate of this bug. ***
How will this behave when I start Orca for example? Will it work as expected?
(In reply to comment #5) > How will this behave when I start Orca for example? Will it work as expected? As a new client is there, at-spi2-atk will call spi_atk_add_client. If the event listeners are not there spi_atk_add_client will call spi_atk_register_event_listeners, that is the method that calls atk_util_add_global_event_listener. And finally, I already tested this, with some apps like gnome-shell, gedit and gnome-control-center (btw, offtopic: on the universal settings page, some checkboxes doesn't have a proper label). Anyway, now that this is committed other people can test it and create new bugs if required.