[orca] Event Manager: Add window:deactivate and state-changed:active to spam clearers



commit 3f34a4dbb016efb4472b1f72565f3303195ab5f7
Author: Joanmarie Diggs <jdiggs igalia com>
Date:   Mon Jun 14 15:25:03 2021 +0200

    Event Manager: Add window:deactivate and state-changed:active to spam clearers
    
    We use window:activate as an event to trigger event spam pruning during
    a flood. But window:deactivate should cover the situation where an
    inaccessible app (or no app at all) gains focus. And including state-
    changed:active for frames and windows is another fallback in case the
    expected window: events are completely absent.

 src/orca/event_manager.py | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
---
diff --git a/src/orca/event_manager.py b/src/orca/event_manager.py
index bdc20e346..abd652ffe 100644
--- a/src/orca/event_manager.py
+++ b/src/orca/event_manager.py
@@ -771,7 +771,7 @@ class EventManager:
         return event.source == orca_state.locusOfFocus
 
     def _prioritizeDuringFlood(self, event):
-        """Returns true if this event should be processed immediately during a flood."""
+        """Returns true if this event should be prioritized during a flood."""
 
         if event.type.startswith("object:state-changed:focused"):
             return event.detail1
@@ -779,6 +779,12 @@ class EventManager:
         if event.type.startswith("window:activate"):
             return True
 
+        if event.type.startswith("window:deactivate"):
+            return True
+
+        if event.type.startswith("object:state-changed:active"):
+            return event.source.getRole() in [pyatspi.ROLE_FRAME, pyatspi.ROLE_WINDOW]
+
         return False
 
     def _pruneEventsDuringFlood(self):


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