Bug 21205 - Device event controller needs implementing
Summary: Device event controller needs implementing
Alias: None
Product: at-spi2
Classification: Unclassified
Component: core (show other bugs)
Version: unspecified
Hardware: Other All
: medium normal
Assignee: Rob Taylor
QA Contact:
Depends on:
Reported: 2009-04-15 11:09 UTC by Willie Walker
Modified: 2009-04-29 00:36 UTC (History)
2 users (show)

See Also:
i915 platform:
i915 features:

Patch to get it working with Orca (2.85 KB, patch)
2009-04-15 16:49 UTC, Willie Walker
Details | Splinter Review

Description Willie Walker 2009-04-15 11:09:08 UTC
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?
Comment 1 Willie Walker 2009-04-15 16:49:41 UTC
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)
+                try:
+                        ev = DeviceEvent(*ev)
+                        return self._registry.handleDeviceEvent(ev, self)
+                except Exception:
+                        import traceback
+                        traceback.print_exc()

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");
Comment 2 Mark Doffman 2009-04-29 00:36:28 UTC
Thanks for the bug hunting. Patches have been applied, albeit in multiple parts.

The following commits partially apply the patch (Along with other changes):

commit 44b8c011166f4a17012400fa32bfbe04d8ccde2c
Author: Mark Doffman <mdoff@silver-wind.(none)>
Date:   Tue Apr 21 17:16:03 2009 +0100

    2009-04-21 Mark Doffman <mark.doffman@codethink.co.uk>
            Mega-commit. Bug fixes coming out of API review
            and Orca testing.

commit f90b676008bbe631fd7f4b461badb1365d8b7deb
commit 50040de9e7afc348e6a4a3fe123e69088c2c411d
Author: Willie Walker <william.walker@sun.com>
Date:   Wed Apr 22 10:00:40 2009 -0400

    Use parameter unpacking in call to DeviceEvent constructor.

commit f90b676008bbe631fd7f4b461badb1365d8b7deb
commit fc0856c018df133b8ba531f53e1edfe814b78ea3
Author: Mike Gorse <mgorse@boston.site>
Date:   Wed Apr 15 14:49:36 2009 -0500

    2009-04-15  Mike Gorse  <mgorse@novell.com>
        * registry/deviceeventcontroller.c: Add \n to a g_print.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.