After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 678475 - Register to events on initialization only if some client is listening
Register to events on initialization only if some client is listening
Status: RESOLVED FIXED
Product: at-spi
Classification: Platform
Component: at-spi2-atk
unspecified
Other Linux
: Normal normal
: ---
Assigned To: Li Yuan
At-spi maintainer(s)
: 678310 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2012-06-20 12:47 UTC by Alejandro Piñeiro Iglesias (IRC: infapi00)
Modified: 2012-06-25 08:49 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Register at beginning only if any AT is listening (1.37 KB, patch)
2012-06-20 12:51 UTC, Alejandro Piñeiro Iglesias (IRC: infapi00)
committed Details | Review

Description Alejandro Piñeiro Iglesias (IRC: infapi00) 2012-06-20 12:47:26 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.
Comment 1 Alejandro Piñeiro Iglesias (IRC: infapi00) 2012-06-20 12:51:50 UTC
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 2 Mike Gorse 2012-06-22 14:59:32 UTC
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
>
Comment 3 Alejandro Piñeiro Iglesias (IRC: infapi00) 2012-06-22 16:13:08 UTC
(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.
Comment 4 Alejandro Piñeiro Iglesias (IRC: infapi00) 2012-06-22 16:15:14 UTC
*** Bug 678310 has been marked as a duplicate of this bug. ***
Comment 5 Bastien Nocera 2012-06-22 16:30:47 UTC
How will this behave when I start Orca for example? Will it work as expected?
Comment 6 Alejandro Piñeiro Iglesias (IRC: infapi00) 2012-06-25 08:49:27 UTC
(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.