[orca] Fix for bug 634248 - Orca should ignore object:state-changed:focused events triggered by WebKitGtk c



commit 288e430af0c1e9acade00a15846155c9ab28afd0
Author: Joanmarie Diggs <joanmarie diggs gmail com>
Date:   Sun Nov 7 15:37:53 2010 -0500

    Fix for bug 634248 - Orca should ignore object:state-changed:focused events triggered by WebKitGtk caret navigation

 src/orca/scripts/toolkits/WebKitGtk/script.py |   20 ++++++++++++++++++++
 1 files changed, 20 insertions(+), 0 deletions(-)
---
diff --git a/src/orca/scripts/toolkits/WebKitGtk/script.py b/src/orca/scripts/toolkits/WebKitGtk/script.py
index bee94cd..d88f40e 100644
--- a/src/orca/scripts/toolkits/WebKitGtk/script.py
+++ b/src/orca/scripts/toolkits/WebKitGtk/script.py
@@ -45,6 +45,8 @@ from script_utilities import Utilities
 
 class Script(default.Script):
 
+    CARET_NAVIGATION_KEYS = ['Left', 'Right', 'Up', 'Down', 'Home', 'End']
+
     def __init__(self, app):
         """Creates a new script for WebKitGtk applications.
 
@@ -136,6 +138,24 @@ class Script(default.Script):
 
         default.Script.sayCharacter(self, obj)
 
+    def skipObjectEvent(self, event):
+        """Gives us, and scripts, the ability to decide an event isn't
+        worth taking the time to process under the current circumstances.
+
+        Arguments:
+        - event: the Event
+
+        Returns True if we shouldn't bother processing this object event.
+        """
+
+        if event.type.startswith('object:state-changed:focused') \
+           and event.detail1:
+            lastKey, mods = self.utilities.lastKeyAndModifiers()
+            if lastKey in self.CARET_NAVIGATION_KEYS:
+                return True
+
+        return default.Script.skipObjectEvent(self, event)
+
     def useStructuralNavigationModel(self):
         """Returns True if we should do our own structural navigation.
         This should return False if we're in a form field, or not in



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