[orca] Fix for bgo#373387 - Users should be able to lock/unlock the "Lock" modifier even if Caps Lock is th



commit ed712f3f838ecf02d40e0799dea24dba6324312e
Author: Joanmarie Diggs <joanmarie diggs gmail com>
Date:   Mon Jul 12 03:52:26 2010 -0400

    Fix for bgo#373387 - Users should be able to lock/unlock the "Lock" modifier even if Caps Lock is the Orca modifier

 src/orca/orca.py |   20 ++++++++++++++++----
 1 files changed, 16 insertions(+), 4 deletions(-)
---
diff --git a/src/orca/orca.py b/src/orca/orca.py
index b535897..dcf8e0a 100644
--- a/src/orca/orca.py
+++ b/src/orca/orca.py
@@ -455,7 +455,9 @@ def isModifierKey(event_string):
 
     modifierKeys = [ 'Alt_L', 'Alt_R', 'Control_L', 'Control_R', \
                      'Shift_L', 'Shift_R', 'Meta_L', 'Meta_R' ]
-    modifierKeys.extend(settings.orcaModifierKeys)
+
+    if not orca_state.bypassNextCommand:
+        modifierKeys.extend(settings.orcaModifierKeys)
 
     reply = event_string in modifierKeys
     debug.println(debug.LEVEL_FINEST,
@@ -473,8 +475,9 @@ def isLockingKey(event_string):
 
     lockingKeys = [ "Caps_Lock", "Num_Lock", "Scroll_Lock" ]
 
-    reply = event_string in lockingKeys \
-            and not event_string in settings.orcaModifierKeys
+    reply = event_string in lockingKeys
+    if not orca_state.bypassNextCommand:
+        reply = reply and not event_string in settings.orcaModifierKeys
     debug.println(debug.LEVEL_FINEST,
                   "orca.isLockingKey: returning: %s" % reply)
     return reply
@@ -530,7 +533,9 @@ def isNavigationKey(event_string):
 
     navigationKeys = [ "Left", "Right", "Up", "Down" ]
 
-    reply = (event_string in navigationKeys) or _orcaModifierPressed
+    reply = event_string in navigationKeys
+    if not reply and not orca_state.bypassNextCommand:
+        reply = _orcaModifierPressed
 
     debug.println(debug.LEVEL_FINEST,
                   "orca.isNavigationKey: returning: %s" % reply)
@@ -938,6 +943,13 @@ def _processKeyboardEvent(event):
                 consumed = True
 
             if not consumed \
+               and keyboardEvent.type == pyatspi.KEY_RELEASED_EVENT:
+                if isOrcaModifier and orca_state.bypassNextCommand:
+                    _restoreXmodmap()
+                elif not orca_state.bypassNextCommand:
+                    _createOrcaXmodmap()
+
+            if not consumed \
                and not isModifierKey(keyboardEvent.event_string) \
                and keyboardEvent.type == pyatspi.KEY_PRESSED_EVENT:
                 orca_state.bypassNextCommand = False



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