Edit: of course, i forgot the attachment script. My bad. On Mon, Nov 21, 2016 at 03:57:16PM +0100, Ksamak wrote: > > I have made a script, relying on python-pyatspi, that can demonstrate an > example case of what i'm trying to describe. > This script is based on magfocustracker.py from the examples in pyatspi > project. It simply outputs the caret position and size, from atspi > events "object:text-caret-moved" > > I'll describe a couple use cases that in my opinion are faulty: > - open firefox, type alt-d to go in address bar, then delete all text > in the field (backspace should suffice) > what happens => an event with 0,0 0x0 (no width/height, no position) > what should happen => an event with the caret size, placed at the > screen position of the caret. > note: behaviour is the same for any textarea, or entry in HTML > forms > > - open a new, empty libreoffice-writer document, the caret is at start > of document. > what happens => an event with 0,0 0x0 > what should happen => an event with the caret size, placed at the > screen position of the caret. > > - open a libreoffice-writer document, press return > what happens => an event with -1,-1,-1,-1 (it's the whole widget's > position, we can ignore it) > an event with 0,0 0x0 > another event with 0,0 0x0 > what should happen => an event with the caret size, placed at the > screen position of the caret. > note: one can write a paragraph, then press enter, the same > will happen > > Tests have been made under debian mate jessie. > I think one can easily understand how a magnifier, tracked with this > would jump at random places of the screen, and be really confusing and > annoying for visually disabled people. > > I'd be glad for any help you can think of to resolve this issue. > -- > Ksamak > Free software hacktivist
-- Ksamak Free software hacktivist
#!/usr/bin/python import pyatspi import sys def magnifyAccessible(event, obj=None, extents=None): if event.source and event.source.getRole() == pyatspi.ROLE_TERMINAL: # protection against parasite events from terminals return if event.type.startswith("object:state-changed") and not event.detail1: # This object just became unselected or unfocused, and we're not # big on nostalgia. return obj = obj or event.source x, y, width, height = -1,-1,-1,-1 if event and event.type.startswith("object:text-caret-moved"): try: text = obj.queryText() if text and (text.caretOffset >= 0): offset = text.caretOffset if offset == text.characterCount: offset -= 1 [x, y, width, height] = text.getCharacterExtents(offset, 0) except: pass print "position: %i,%i size %i:%s" %(x, y, width, height) def startTracking(): pyatspi.Registry.registerEventListener(magnifyAccessible, "object:text-caret-moved") def stopTracking(): pyatspi.Registry.deregisterEventListener(magnifyAccessible, "object:text-caret-moved") def main(): startTracking() pyatspi.Registry.start() return 0 if __name__ == "__main__": sys.exit(main())
pgp3WiRlNxptA.pgp
Description: PGP signature
_______________________________________________ gnome-accessibility-list mailing list gnome-accessibility-list@gnome.org https://mail.gnome.org/mailman/listinfo/gnome-accessibility-list