[orca] More tweaks to the terminal keyboard-related hackery.



commit 03c5295fada4de0fbfed278fd05429f6861109aa
Author: Joanmarie Diggs <jdiggs igalia com>
Date:   Thu Feb 2 21:44:42 2012 -0500

    More tweaks to the terminal keyboard-related hackery.

 src/orca/input_event.py |   33 +++++++++++++++++++--------------
 1 files changed, 19 insertions(+), 14 deletions(-)
---
diff --git a/src/orca/input_event.py b/src/orca/input_event.py
index ed3f3c1..446a374 100644
--- a/src/orca/input_event.py
+++ b/src/orca/input_event.py
@@ -404,21 +404,26 @@ class KeyboardEvent(InputEvent):
         if role == pyatspi.ROLE_PASSWORD_TEXT:
             return False
 
-        # Normally we present key presses; this is problematic when the user is
-        # being prompted for a password in a terminal. See bgo 668025.
-        if self.isPressedKey() == (role == pyatspi.ROLE_TERMINAL):
-            return False
-
+        # Worst. Hack. EVER. We have no reliable way of knowing a password is
+        # being entered into a terminal -- other than the fact that the text
+        # typed ain't there. As a result, we have to do special things when
+        # not in special modes. :( See bgo 668025.
         if role == pyatspi.ROLE_TERMINAL:
-            try:
-                text = orca_state.locusOfFocus.queryText()
-                o = text.caretOffset
-                string = text.getText(o-1, o)
-            except:
-                pass
-            else:
-                if not self.event_string in [string, 'space']:
-                    return False
+            if not self.isPressedKey():
+                try:
+                    text = orca_state.locusOfFocus.queryText()
+                    o = text.caretOffset
+                    string = text.getText(o-1, o)
+                except:
+                    pass
+                else:
+                    if not self.event_string in [string, 'space']:
+                        return False
+            elif not (settings.learnModeEnabled or self.isLockingKey()):
+                return False
+
+        elif not self.isPressedKey():
+            return False
 
         orca_state.lastKeyEchoTime = time.time()
         debug.println(debug.LEVEL_FINEST,



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