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 729922 - Invalid object type AtkText in atk_add_global_event_listener
Invalid object type AtkText in atk_add_global_event_listener
Status: RESOLVED FIXED
Product: atk
Classification: Platform
Component: atk
unspecified
Other Linux
: Normal normal
: ---
Assigned To: ATK maintainer(s)
ATK maintainer(s)
Depends on:
Blocks:
 
 
Reported: 2014-05-10 15:38 UTC by Jarek Czekalski
Modified: 2014-05-12 14:54 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
sample app (511 bytes, text/x-csrc)
2014-05-10 15:38 UTC, Jarek Czekalski
  Details
Adding clarifying not on atk_add_global_event_listener (1.21 KB, patch)
2014-05-12 13:02 UTC, Alejandro Piñeiro Iglesias (IRC: infapi00)
committed Details | Review

Description Jarek Czekalski 2014-05-10 15:38:48 UTC
Created attachment 276287 [details]
sample app

When debugging a complex accessibility application I noticed in some cases it's impossible to add a global handler for ATK:AtkText:text-caret-moved event. It fails with message "Invalid object type AtkText".

I attach an app that exhibits this problem. In original application I workarounded by forcing an access to an AtkText object before trying to connect the signal.

Using fresh git head of atk.

The problem is that it took quite some time to figure out what's going on. Maybe fixing this in atk would free others from solving this accessibility puzzle.
Comment 1 Alejandro Piñeiro Iglesias (IRC: infapi00) 2014-05-12 12:56:12 UTC
(In reply to comment #0)
> Created an attachment (id=276287) [details]
> sample app
> 
> When debugging a complex accessibility application I noticed in some cases it's
> impossible to add a global handler for ATK:AtkText:text-caret-moved event. It
> fails with message "Invalid object type AtkText".
> 
> I attach an app that exhibits this problem. In original application I
> workarounded by forcing an access to an AtkText object before trying to connect
> the signal.

That is not a valid workaround as the listener will not be properly installed.

> Using fresh git head of atk.
> 
> The problem is that it took quite some time to figure out what's going on.
> Maybe fixing this in atk would free others from solving this accessibility
> puzzle.

atk_add_global_event_listener registers a listener for a given atk_type:atk_event (as the documentation mentions). But in order to be possible, the atk_types should be already registered on the gtype system.

What some consumers of this method do (like at-spi2-atk) is creating an instance of the utility class atknoopobject:
https://developer.gnome.org/atk/stable/AtkNoOpObject.html

This class implements all the ATK interfaces, so creating an instance of this class registers all the ATK interfaces on the gtype system.
https://git.gnome.org/browse/at-spi2-atk/tree/atk-adaptor/event.c#n1170

In summary, I don't consider this an ATK bug. In any case, I agree that all this is not trivial for someone not used to the gtype system. So what I'm going to do id improve atk_add_global_event_listener documentation to clarify this.
Comment 2 Alejandro Piñeiro Iglesias (IRC: infapi00) 2014-05-12 13:02:32 UTC
Created attachment 276380 [details] [review]
Adding clarifying not on atk_add_global_event_listener

This patch clarifies the issue on the documentation. 

Could bug reporter confirm if the note clarifies his doubt? thanks
Comment 3 Jarek Czekalski 2014-05-12 13:47:44 UTC
That's perfect! I was thinking about the simplest way to create an object implementing AtkText. You showed me the way and put it into the docs. Thank you, Alejandro.
Comment 4 Alejandro Piñeiro Iglesias (IRC: infapi00) 2014-05-12 14:54:13 UTC
(In reply to comment #3)
> That's perfect! I was thinking about the simplest way to create an object
> implementing AtkText. You showed me the way and put it into the docs. Thank
> you, Alejandro.

Thanks for the feedback. Patch pushed to master. Closing bug.