Re: Adventures in calling Atspi from JavaScript
Mike Gorse <[email protected]>
| Newsgroups | gmane.comp.gnome.accessibility.general |
|---|---|
| Message-ID | <[email protected]> |
Hi Joseph,
> 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.
This is strange; I'm not seeing anything obvious when looking at the code,
and I can't reproduce it. Does valgrind show any invalid reads or writes?
> registered = this._atspiEventListener.register_from_callback(
> _atspiCaretCB, 'object:text-caret-moved'
This won't work in a way that can be deregistered, however. See below.
> 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.
It is a bug that it is returning TRUE when it didn't find anything to
deregister. I'll need to fix that.
> The way it's deregistered:
> deregistered = this._atspiEventListener.deregister_from_callback(
> _atspiFocusCB, 'object:state-changed:focused'
Atspi_event_listener_register_from_callback and deregister_from_callback
are convenience functions intended to avoid needing to
create an AtspiEventListener. The scope annotations on those functions are
incorrect. Changing the scope to "notify" and adding a GDestroyNotify
callback might work, although that would mean an API break. Anyway, gjs is
creating a wrapper around the callback when it is called, so libatspi sees
a different pointer for the deregister call than it saw for the register
call, so it does not make a match.
Doing something like the following works for me, though:
function cb(e)
{
print(e)
}
l = Atspi.EventListener.new(cb)
registered = l.register('object:text-caret-moved')
l.deregister('object:text-caret-moved')
Hth,
-Mike
_______________________________________________
gnome-accessibility-list mailing list
[email protected]
https://mail.gnome.org/mailman/listinfo/gnome-accessibility-list