Re: Adventures in calling Atspi from JavaScript
Joseph Scheuhammer <[email protected]>
| Newsgroups | gmane.comp.gnome.accessibility.general |
|---|---|
| Message-ID | <[email protected]> |
Hi Mike,
Thanks for your suggestions -- it improved things a bit. See below.
>> 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?
I'm not familiar with valgrind. How do I use it? Perhaps after
tomorrow's a11y meeting we can discuss in #a11y, if you have the time?
>> _atspiCaretCB, 'object:text-caret-moved'
> registered = this._atspiEventListener.register_from_callback(
>
> 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.
Hey, I found a bug :-).
>
>> 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
I modified my code to match you suggestion above. It solves the
registering/deregistering problem. But, I get the same error when
registering 'object:text-caret-moved'. And, I still get the same delay
when moving focus to an St widget.
I'll be in touch tomorrow.
--
;;;;joseph.
'A: After all, it isn't rocket science.'
'K: Right. It's merely computer science.'
- J. D. Klaun -
_______________________________________________
gnome-accessibility-list mailing list
[email protected]
https://mail.gnome.org/mailman/listinfo/gnome-accessibility-list