[orca] Treat state-changed:active true on frames as reason to change script



commit d261ce21e756ec5dec7546925a649006f7cf8b1e
Author: Joanmarie Diggs <jdiggs igalia com>
Date:   Sun Jun 13 12:19:56 2021 +0200

    Treat state-changed:active true on frames as reason to change script
    
    The event manager was treating window:activate as a reason to switch
    the active script. But it was not doing so for state-changed:active
    on a frame. As a result, if an application emits the latter before
    the former -- or fails to emit the former at all -- script-specific
    logic might not kick in for the activation.
    
    This event ordering was causing us to switch to browse mode incorrectly
    in VSCode. Treating state-changed:active true on frames as a reason to
    change the active script solves this problem.

 src/orca/event_manager.py | 4 ++++
 1 file changed, 4 insertions(+)
---
diff --git a/src/orca/event_manager.py b/src/orca/event_manager.py
index ff55b7c7f..4ede0406b 100644
--- a/src/orca/event_manager.py
+++ b/src/orca/event_manager.py
@@ -693,6 +693,10 @@ class EventManager:
         if eType.startswith('window:activate'):
             return True, "window:activate event"
 
+        if eType.startswith('object:state-changed:active') and event.detail1 \
+           and role == pyatspi.ROLE_FRAME:
+            return True, "Window is becoming active."
+
         if eType.startswith('focus') \
            or (eType.startswith('object:state-changed:focused')
                and event.detail1):


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