[orca] Ignore text-changed system events for a single embedded object character



commit 844e207713b68024616280e483d891ab15e51537
Author: Joanmarie Diggs <jdiggs igalia com>
Date:   Wed Jun 3 20:10:01 2015 -0400

    Ignore text-changed system events for a single embedded object character
    
    We should also get children-changed events telling us the same thing.
    And getting a lot of both from Gecko can grind us to a halt. :(

 src/orca/event_manager.py                          |   10 ++++++++++
 src/orca/scripts/toolkits/Gecko/script.py          |    2 ++
 .../scripts/toolkits/Gecko/script_utilities.py     |    2 ++
 3 files changed, 14 insertions(+), 0 deletions(-)
---
diff --git a/src/orca/event_manager.py b/src/orca/event_manager.py
index b4996cb..4bff6ef 100644
--- a/src/orca/event_manager.py
+++ b/src/orca/event_manager.py
@@ -40,6 +40,8 @@ _scriptManager = script_manager.getManager()
 
 class EventManager:
 
+    EMBEDDED_OBJECT_CHARACTER = '\ufffc'
+
     def __init__(self, asyncMode=True):
         debug.println(debug.LEVEL_FINEST, 'INFO: Initializing event manager')
         debug.println(debug.LEVEL_FINEST, 'INFO: Async Mode is %s' % asyncMode)
@@ -132,6 +134,14 @@ class EventManager:
                 debug.println(debug.LEVEL_INFO, msg)
                 return True
 
+        if event.type.startswith('object:text-changed') and event.type.endswith('system'):
+            # We should also get children-changed events telling us the same thing.
+            # Getting a bunch of both can result in a flood that grinds us to a halt.
+            if event.any_data == self.EMBEDDED_OBJECT_CHARACTER:
+                msg = 'INFO: Text changed event for embedded object. Who cares?'
+                debug.println(debug.LEVEL_INFO, msg)
+                return True
+
         return False
 
     def _addToQueue(self, event, asyncMode):
diff --git a/src/orca/scripts/toolkits/Gecko/script.py b/src/orca/scripts/toolkits/Gecko/script.py
index c3879ee..034c720 100644
--- a/src/orca/scripts/toolkits/Gecko/script.py
+++ b/src/orca/scripts/toolkits/Gecko/script.py
@@ -1365,6 +1365,8 @@ class Script(default.Script):
             debug.println(debug.LEVEL_INFO, msg)
             return True
 
+        # TODO - JD: As an experiment, we're stopping these at the event manager.
+        # If that works, this can be removed.
         if self.utilities.eventIsEOCAdded(event):
             msg = "INFO: Ignoring: Event was for embedded object char"
             debug.println(debug.LEVEL_INFO, msg)
diff --git a/src/orca/scripts/toolkits/Gecko/script_utilities.py 
b/src/orca/scripts/toolkits/Gecko/script_utilities.py
index 9a1af40..662fdab 100644
--- a/src/orca/scripts/toolkits/Gecko/script_utilities.py
+++ b/src/orca/scripts/toolkits/Gecko/script_utilities.py
@@ -1639,6 +1639,8 @@ class Utilities(script_utilities.Utilities):
 
         return self._treatTextObjectAsWhole(event.source)
 
+    # TODO - JD: As an experiment, we're stopping these at the event manager.
+    # If that works, this can be removed.
     def eventIsEOCAdded(self, event):
         if not self.inDocumentContent(event.source):
             return False


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