Re: [g-a-devel] How to choose the suitable event in AT-SPI



Hi Michael,

Some events in itself may be sufficient to reflect a particular user action
(e.g. text-caret-move notifies that the user is moving the cursor). But
it is the case only if there are no other events. If text-caret-move
comes in conjunction with text-change event it is a completely different
situation implying that the user is typing a new text.

Ah ok, I get what you mean now. Yes, it does seem pretty pointless listening for a caret-moved event and a text changed event. There's a similar vibe with focused and selected, now you mention it. Like obviously if something is focused then it is going to be selected too. In the g-s magnifier (_javascript_) that gets dealt with like so:

https://git.gnome.org/browse/gnome-shell/tree/js/ui/magnifier.js#n715
https://git.gnome.org/browse/gnome-shell/tree/js/ui/focusCaretTracker.js#n42

Where both selected and focused events get registered but actually the only event getting emitted out is called focus-changed, to keep things simple. In that case though, selected is actually the more specific event i.e. you can't select an object without focusing on it but you can focus on an object without selecting it. So I guess your concern is a little less trivial to work with.

Ultimately, the thing to consider is that you can listen to what you want to listen otherwise there's a lot of entropy and it is going to be hard to pick out only the events you want to know about for your particular application. Depending on what you want to do, It could be an idea to have a conditional in your code which says something like: If event is caret-moved and text-changed then emit text-changed (or something) so you are not having to deal too much useless information before you can find out only what you want to know and nothing else.

this situation without a delay which obviously not a perfect solution.

> Take a look at Alejandro's examples  github repository in if that seems
> like it might be useful:  https://github.com/infapi00/at-spi2-examples

Yes, thank you a lot for this link, I didn't know about it and will take
a look!

Glad to help. Feel free to file a bug on the github tracker if there is any example you would like to see.

Magdalen




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