[orca] Fix for bgo#589504 - Orca double speaks typed characters when input method is enabled



commit 77c5863c7e436c6dfd31e22f84a50a2b691c619d
Author: Willie Walker <william walker sun com>
Date:   Thu Jul 23 13:13:27 2009 -0400

    Fix for bgo#589504 - Orca double speaks typed characters when input method is enabled

 src/orca/input_event.py |    1 +
 src/orca/orca.py        |   13 +++++++++++++
 2 files changed, 14 insertions(+), 0 deletions(-)
---
diff --git a/src/orca/input_event.py b/src/orca/input_event.py
index e6037c8..962c1d9 100644
--- a/src/orca/input_event.py
+++ b/src/orca/input_event.py
@@ -196,4 +196,5 @@ def keyEventToString(event):
         + ("          modifiers=%d\n" % event.modifiers) \
         + ("          event_string=(%s)\n" % event.event_string) \
         + ("          is_text=%s\n" % event.is_text) \
+        + ("          timestamp=%d\n" % event.timestamp) \
         + ("          time=%f" % time.time())
diff --git a/src/orca/orca.py b/src/orca/orca.py
index c781dea..8106e5f 100644
--- a/src/orca/orca.py
+++ b/src/orca/orca.py
@@ -687,6 +687,19 @@ def _processKeyboardEvent(event):
     """
     global _orcaModifierPressed
 
+    # Input methods appear to play games with repeating events
+    # and also making up events with no timestamps.  We try
+    # to handle that here. See bug #589504.
+    #
+    if (event.timestamp == 0) \
+       or (event.timestamp == orca_state.lastInputEventTimestamp \
+           and orca_state.lastInputEvent \
+           and orca_state.lastInputEvent.hw_code == event.hw_code \
+           and orca_state.lastInputEvent.type == event.type):
+        debug.println(debug.LEVEL_FINE, keyEventToString(event))
+        debug.println(debug.LEVEL_FINE, "IGNORING EVENT DUE TO TIMESTAMP")
+        return
+
     orca_state.lastInputEventTimestamp = event.timestamp
 
     # Log the keyboard event for future playback, if desired.



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