[orca] Fix for the keyboard refactor regression of echoing keypresses in terminal password prompts
- From: Joanmarie Diggs <joanied src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [orca] Fix for the keyboard refactor regression of echoing keypresses in terminal password prompts
- Date: Mon, 16 Jan 2012 18:49:55 +0000 (UTC)
commit 1daef1254b74c0cc0a3226e13c61d1553212f6c7
Author: Joanmarie Diggs <jdiggs igalia com>
Date: Mon Jan 16 19:48:28 2012 +0100
Fix for the keyboard refactor regression of echoing keypresses in terminal password prompts
src/orca/input_event.py | 33 +++++++++++++++++++++++----------
src/orca/orca.py | 5 +++--
2 files changed, 26 insertions(+), 12 deletions(-)
---
diff --git a/src/orca/input_event.py b/src/orca/input_event.py
index 5857df7..750bfe7 100644
--- a/src/orca/input_event.py
+++ b/src/orca/input_event.py
@@ -182,16 +182,6 @@ class KeyboardEvent(InputEvent):
if not self.isLockingKey():
self.shouldEcho = self.shouldEcho and settings.enableKeyEcho
- # Never echo if the user doesn't want any echo, as defined by
- # preferences and whether or not we are in a password field.
- if self.shouldEcho:
- try:
- role = orca_state.locusOfFocus.getRole()
- except:
- pass
- else:
- self.shouldEcho = role != pyatspi.ROLE_PASSWORD_TEXT
-
def toString(self):
return ("KEYBOARDEVENT: type=%d\n" % self.type) \
+ (" id=%d\n" % self.id) \
@@ -405,6 +395,29 @@ class KeyboardEvent(InputEvent):
if self.isOrcaModified():
return False
+ try:
+ role = orca_state.locusOfFocus.getRole()
+ except:
+ return False
+
+ 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
+
+ if role == pyatspi.ROLE_TERMINAL:
+ try:
+ text = orca_state.locusOfFocus.queryText()
+ string = text.getText(0, -1).strip()
+ except:
+ pass
+ else:
+ if not string.endswith(self.event_string):
+ return False
+
orca_state.lastKeyEchoTime = time.time()
debug.println(debug.LEVEL_FINEST,
"KeyboardEvent.present: %s" % self.event_string)
diff --git a/src/orca/orca.py b/src/orca/orca.py
index 32b7dfd..6053e8e 100644
--- a/src/orca/orca.py
+++ b/src/orca/orca.py
@@ -793,8 +793,9 @@ def _processKeyboardEvent(event):
# Echo it based on what it is and the user's settings.
script = orca_state.activeScript
- if script and isPressedEvent:
- script.presentationInterrupt()
+ if script:
+ if isPressedEvent:
+ script.presentationInterrupt()
keyboardEvent.present()
# Special modes.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]