orca r4215 - branches/phase2/src/orca
- From: wwalker svn gnome org
- To: svn-commits-list gnome org
- Subject: orca r4215 - branches/phase2/src/orca
- Date: Sun, 14 Sep 2008 21:22:52 +0000 (UTC)
Author: wwalker
Date: Sun Sep 14 21:22:51 2008
New Revision: 4215
URL: http://svn.gnome.org/viewvc/orca?rev=4215&view=rev
Log:
Add in Orca modifier key support
Modified:
branches/phase2/src/orca/orca.py
branches/phase2/src/orca/script_manager.py
Modified: branches/phase2/src/orca/orca.py
==============================================================================
--- branches/phase2/src/orca/orca.py (original)
+++ branches/phase2/src/orca/orca.py Sun Sep 14 21:22:51 2008
@@ -19,8 +19,7 @@
# TODO: speech stopping on mouse buttons (perhaps in script itself?)
# TODO: learn mode (maybe in script manager?)
# TODO: click count (maybe in script manager?)
-# TODO: capturing of keystrokes (maybe in script?)
-# TODO: setting Orca modifier (maybe in script manager?)
+# TODO: recording of keystrokes for setting key bindings (maybe in script?)
# TODO: toggling of speech on/off (maybe per script?)
# TODO: loading of user settings
# TODO: main window GUI
Modified: branches/phase2/src/orca/script_manager.py
==============================================================================
--- branches/phase2/src/orca/script_manager.py (original)
+++ branches/phase2/src/orca/script_manager.py Sun Sep 14 21:22:51 2008
@@ -24,6 +24,20 @@
__copyright__ = "Copyright (c) 2005-2008 Sun Microsystems Inc."
__license__ = "LGPL"
+# A list of keys that can serve as the Orca modifier key. The list is
+# so we can provide better cross platform support (e.g., Sun keyboard
+# vs. PC-104 keyboard layouts). When any of these keys is pressed,
+# the input_event.MODIFIER_ORCA bit will be set in the 'modifiers'
+# field of a KeyboardEvent input event. The keys are currently
+# compared to the event_string of a keyboard input event from AT-SPI.
+#
+# The initial set of modifier keys is dependent upon whether the user
+# has specified a desktop or a laptop keyboard layout.
+#
+DESKTOP_MODIFIER_KEYS = ["Insert", "KP_Insert"]
+LAPTOP_MODIFIER_KEYS = ["Caps_Lock"]
+orcaModifierKeys = DESKTOP_MODIFIER_KEYS
+
# A list of toolkits whose events we need to process synchronously.
# The only one right now is the Java toolkit (see bug #531869), but
# we put this here to allow more toolkits to be more easily added
@@ -103,6 +117,7 @@
# Cover all masks in 8 bits.
#
+ self._orcaModifierPressed = False
masks = []
mask = 0
while mask <= 255:
@@ -368,11 +383,26 @@
Returns True if the event should be consumed.
"""
keyboardEvent = input_event.KeyboardEvent(event)
+
+ isOrcaModifier = orcaModifierKeys.count(keyboardEvent.event_string) > 0
+ if keyboardEvent.type == pyatspi.KEY_PRESSED_EVENT:
+ if isOrcaModifier:
+ self._orcaModifierPressed = True
+ else:
+ if isOrcaModifier:
+ self._orcaModifierPressed = False
+
+ if self._orcaModifierPressed:
+ keyboardEvent.modifiers = \
+ keyboardEvent.modifiers | input_event.ORCA_MODIFIER_MASK
+
consume = self._activeScript \
and self._activeScript.consumesKeyboardEvent(keyboardEvent)
+
if consume:
self._enqueueEvent(keyboardEvent)
- return consume
+
+ return consume or isOrcaModifier
def _processBrailleEvent(self, event):
"""Called whenever a cursor key is pressed on the Braille display.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]