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 675183 - Duplicate accessible key events
Duplicate accessible key events
Status: RESOLVED FIXED
Product: clutter
Classification: Platform
Component: cally
git master
Other Linux
: Normal normal
: ---
Assigned To: clutter-maint
clutter-maint
: 678187 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2012-04-30 20:04 UTC by Joanmarie Diggs (IRC: joanie)
Modified: 2012-06-19 13:12 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
event listener (545 bytes, text/plain)
2012-04-30 20:04 UTC, Joanmarie Diggs (IRC: joanie)
  Details
Fixes the bug (1009 bytes, patch)
2012-05-09 15:31 UTC, Alejandro Piñeiro Iglesias (IRC: infapi00)
committed Details | Review
Remove key event listener hash table if no longer required (846 bytes, patch)
2012-06-18 09:40 UTC, Alejandro Piñeiro Iglesias (IRC: infapi00)
committed Details | Review

Description Joanmarie Diggs (IRC: joanie) 2012-04-30 20:04:15 UTC
Created attachment 213134 [details]
event listener

Steps to reproduce:

0. Launch the attached listener

For comparison:
1. Move focus to gedit and type 'hello'
2. Press Alt+f to get into the File menu
3. Press Escape to get out of the File menu

The bug itself:
4. Press Alt+F1 to get into the overview
5. Type 'hello'
6. Press Escape to cancel the search
7. Press Escape to get out of the overview

Results: In gnome-shell, we get double the accessible key events.

$ ./keypresses.py                                                                                             
>>> KEY PRESSED : h
<<< KEY RELEASED: h
>>> KEY PRESSED : e
<<< KEY RELEASED: e
>>> KEY PRESSED : l
<<< KEY RELEASED: l
>>> KEY PRESSED : l
<<< KEY RELEASED: l
>>> KEY PRESSED : o
<<< KEY RELEASED: o
>>> KEY PRESSED : Alt_L
>>> KEY PRESSED : f
<<< KEY RELEASED: f
<<< KEY RELEASED: Alt_L
>>> KEY PRESSED : Escape
<<< KEY RELEASED: Escape
>>> KEY PRESSED : Alt_L
<<< KEY RELEASED: F1   
<<< KEY RELEASED: F1   
<<< KEY RELEASED: Alt_L
<<< KEY RELEASED: Alt_L
>>> KEY PRESSED : h
>>> KEY PRESSED : h
<<< KEY RELEASED: h
<<< KEY RELEASED: h
>>> KEY PRESSED : e
>>> KEY PRESSED : e
<<< KEY RELEASED: e
<<< KEY RELEASED: e
>>> KEY PRESSED : l
>>> KEY PRESSED : l
<<< KEY RELEASED: l
<<< KEY RELEASED: l
>>> KEY PRESSED : l
>>> KEY PRESSED : l
<<< KEY RELEASED: l
<<< KEY RELEASED: l
>>> KEY PRESSED : o
>>> KEY PRESSED : o
<<< KEY RELEASED: o
<<< KEY RELEASED: o
>>> KEY PRESSED : Escape
>>> KEY PRESSED : Escape
<<< KEY RELEASED: Escape
<<< KEY RELEASED: Escape
>>> KEY PRESSED : Escape
>>> KEY PRESSED : Escape
<<< KEY RELEASED: Escape
<<< KEY RELEASED: Escape
Comment 1 Joanmarie Diggs (IRC: joanie) 2012-05-04 15:13:10 UTC
I just discovered that this bug goes away when you restart gnome-shell within the current session.
Comment 2 Alejandro Piñeiro Iglesias (IRC: infapi00) 2012-05-08 16:30:58 UTC
(In reply to comment #1)
> I just discovered that this bug goes away when you restart gnome-shell within
> the current session.

I confirmed this bug with the GNOME Shell installed on my system. As I didn't upgrade yet, this is GNOME Shell 3.2.X so old. And I confirm that as soon as you restart GNOME Shell, the bug disappear.

That makes harder to debug it, as it seems that the bug appear if you make login with GNOME Shell. I will make some extra tests, but I guess that in the end I will require to install on my system a compiled GNOME Shell, using a Virtual Machine or something
Comment 3 Alejandro Piñeiro Iglesias (IRC: infapi00) 2012-05-08 17:14:48 UTC
After a little of gdb I found that the difference between case one and the other is the number of ATK key event listeners registered (on cally-util.c). When two are emitted there are two key event listener registered, in the other case just one.

So it seems that when login, there are an extra call to atk_add_key_event_listener. The good new is that this doesn't happens with atk_add_global_event_listener, as in both cases we got 32 listeners (one per each ATK signal to listen).

If this is a real big problem, there is a quick solution. As the atk-bridge only requires one key listener, we could just add a just-one-listener limit on CallyUtil implementation.

Anyway it would be good to check first why this is happening, and where it is happening, as I'm not sure if this is an issue on the atk-bridge. But probably this is affected by how the bridge is loaded (see appendix here [1]).

PS: as the ideal solution would be totally get rid of global key event registering, probably it would not be a good idea to waste too much time here. Anyway, a little research should be done.

[1] https://mail.gnome.org/archives/gnome-accessibility-devel/2012-April/msg00008.html
Comment 4 Joanmarie Diggs (IRC: joanie) 2012-05-08 17:31:12 UTC
(In reply to comment #3)

> If this is a real big problem,

It's not, as far as I have seen so far. Orca simply filters out the duplicates. (Related aside: Not just for Clutter/Cally. We've been doing it for a while now. If memory serves me, Gecko is the biggest spewer of multiple key events when only one is called for.)
Comment 5 Alejandro Piñeiro Iglesias (IRC: infapi00) 2012-05-09 15:31:21 UTC
Created attachment 213739 [details] [review]
Fixes the bug

Funnily enough I also solved this problem some years ago on gail:

https://bugzilla.gnome.org/show_bug.cgi?id=599907#c3

It seems that I forgot to update cally.
Comment 6 Joanmarie Diggs (IRC: joanie) 2012-06-01 15:28:43 UTC
When I try that patch, after having first logged in I get 0 events (whereas before I got 2 of everything). Things go back to normal after gnome-shell gets restarted within the session. Sorry and thanks!
Comment 7 Alejandro Piñeiro Iglesias (IRC: infapi00) 2012-06-18 09:40:21 UTC
Created attachment 216653 [details] [review]
Remove key event listener hash table if no longer required

Problem noticed by joanmarie on comment 6 was caused because when the listener hash table got empty, the snooper is uninstalled. But the snooper is only installed on add_key_event if that hash_table is NULL.

Two options:
  a) Install the snooper if the hash table is NULL or empty
  b) Destroy hash_table and set to NULL when became empty

This patch implements b)
Comment 8 Matthias Clasen 2012-06-19 10:45:22 UTC
*** Bug 678187 has been marked as a duplicate of this bug. ***
Comment 9 Emmanuele Bassi (:ebassi) 2012-06-19 13:12:29 UTC
it seems the patch in attachment 216653 [details] [review] broke something - see bug 678404