Re: Adventures in calling Atspi from JavaScript
- From: Mike Gorse <mgorse alum wpi edu>
- To: Joseph Scheuhammer <clown alum mit edu>
- Cc: Gnome Accessibility List <gnome-accessibility-list gnome org>
- Subject: Re: Adventures in calling Atspi from JavaScript
- Date: Wed, 18 Jul 2012 15:25:57 -0400 (EDT)
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
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]