GNOME Bugzilla – Bug 729922
Invalid object type AtkText in atk_add_global_event_listener
Last modified: 2014-05-12 14:54:13 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.
(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.
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
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.
(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.