Assistive technologies such as Orca need the ability to both sniff keyboard events and to intercept/consume them. The current implementation of AT-SPI/D-Bus doesn't support this. As my first stab at understanding the code, I tried doing this but got lost in the atk-adaptor. :-( Do you have suggestions for where I might start poking around?
Created attachment 24835 [details] [review]
Patch to get it working with Orca
This patch seems to do the trick. There were several small bugs that needed squashing.
This change in pyatspi/deviceevent.py reflects a couple of the issues, which were just an accidental use of an "event." module prefix for the DeviceEvent constructor, needing to expand the ev object into parameters for the constructor, and the need to save away the registry in self (the saving is done in the constructor). I also put the call to handleDeviceEvent in a try/except block to make it easier to track issues in the code:
- ev = event.DeviceEvent(ev)
- return self.registry.handleDeviceEvent(ev, self)
+ ev = DeviceEvent(*ev)
+ return self._registry.handleDeviceEvent(ev, self)
+ except Exception:
+ import traceback
This change in pyatspi/registry.py reflects the need to make sure it looks at the correct dictionary:
- client = self.clients[ob]
+ client = self.deviceClients[ob]
Finally, this change in registryd/deviceeventcontroller.c is just an anal-retentive \n addition:
- g_print ("null key set!");
+ g_print ("null key set!\n");
Thanks for the bug hunting. Patches have been applied, albeit in multiple parts.
The following commits partially apply the patch (Along with other changes):
Author: Mark Doffman <mdoff@silver-wind.(none)>
Date: Tue Apr 21 17:16:03 2009 +0100
2009-04-21 Mark Doffman <firstname.lastname@example.org>
Mega-commit. Bug fixes coming out of API review
and Orca testing.
Author: Willie Walker <email@example.com>
Date: Wed Apr 22 10:00:40 2009 -0400
Use parameter unpacking in call to DeviceEvent constructor.
Author: Mike Gorse <firstname.lastname@example.org>
Date: Wed Apr 15 14:49:36 2009 -0500
2009-04-15 Mike Gorse <email@example.com>
* registry/deviceeventcontroller.c: Add \n to a g_print.