Re: Adventures in calling Atspi from JavaScript





2012/7/24 Joseph Scheuhammer <clown alum mit edu>
Mike wrote:
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?

I discovered that the event string I was passing contained an invisible character.  Deleting that invisible character fixed registering the 'object:text-caret-moved' event.  It now works as expected.


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')

Previously I replied that doing the above fixes the register/deregister issues I was having.  Thank you very much for the pointers, Mike!

There still remains the issue of of the freezing when focussing on GNOME Shell widgets, and a new issue in terms of too many caret tracking events.  I document these a bit more on the focus tracker bugzilla.  More importantly, there is now a patch attached to that bugzilla which shows the focus tracking code, warts and all:
https://bugzilla.gnome.org/show_bug.cgi?id=647074#c5

P.S. Aleiva, I couldn't add 'aleiva emergya es' to the CC list of the bugzilla.  It did accept 'aleiva emergya com'.  I hope that's right.

Perfect, thanks!

--
Alejandro Leiva


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