Adventures in calling Atspi from JavaScript



All,

I've been implementing a JavaScript object for use within GNOME Shell that tracks the keyboard focus and the caret. I am using GObjectIntrospection to communicate between JavaScript and AT-SPI. Some things are working, but others aren't. Descriptions of the problems are given below. If you see anything that sheds light on things, let me know.

1. Registering 'object:text-caret-moved' always results in an error.

The actual error is garbled, containing non-printable characters. Here is what I get:

> Window manager warning: Log level 16: Atspi: Adding match: Interface name
> 'org.a11y.atspi.Event.object' is invalid.

How it's registered. Note that 'this._atspiEventListener' is an Atspi.EventListener, or, in C, an AtspiEventListener:

registered = this._atspiEventListener.register_from_callback(
_atspiCaretCB, 'object:text-caret-moved'
);

- the returned value, 'registered', is 'true'.
- the callback, '_atspiCaretCB', is never called.
- I do the same thing for 'object:state-changed:focused' and 'object:state-changed:selected', and that works fine.

2. Focus tracking doesn't work with St widgets.

Registering for 'object:state-changed:focused' and 'object:state-changed:selected' works great with GTK widgets, and even within web pages with ARIA widgets. But, whenever a GNOME Shell widget is invoked, the system freezes for about 5 - 10 seconds. When the UI is responsive again, the event passed back, has no accessible component within it.

Examples of GNOME Shell widgets are the task switcher, adn the accessibility menu on the top right.

- the callback is passed an AT-SPI event (which is correct).
- the event.type is 'object:state-changed:focused' (which is correct).
- the event.source is non-null, but has no accessible name.
- calling get_component() on the event.source returns null. Thus, there is no way to get an extents rectangle for the focussed item.
- sometimes the following error message is output:

> Window manager warning: Log level 16: AT-SPI: Error in GetItems,
> sender=(null), error=Did not receive a reply. Possible causes include: the
> remote application did not send a reply, the message bus security policy
> blocked the reply, the reply timeout expired, or the network connection was
> broken.

3. Deregistering callbacks doesn't actually deregister.

Or, I don't understand what "deregister" means :-).

When deregister_from_callback() is called, the return value is 'true', suggesting that the event has been deregistered. However, the callback that was supplied during the prior register_from_callback() is still invoked. It's as if the system is saying, "Okay, you've been disconnected as requested", but nonetheless keeps calling back when the event occurs.

The way it's deregistered:
deregistered = this._atspiEventListener.deregister_from_callback(
_atspiFocusCB, 'object:state-changed:focused'
);

- the returned value, deregistered, is 'true'
- the callback, _atspiFocusCB, continues to be called.

Thanks for any suggestions.

--
;;;;joseph.


'A: After all, it isn't rocket science.'
'K: Right. It's merely computer science.'
             - J. D. Klaun -



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]