[orca] Adjust when we clear the active window and focus in event manager



commit 586090253673542217a98755cd802c466e1179ff
Author: Joanmarie Diggs <jdiggs igalia com>
Date:   Mon Feb 24 20:33:13 2020 +0100

    Adjust when we clear the active window and focus in event manager
    
    If we got a window:deactivate event and the event source was defunct,
    we would automatically clear the active window and locus of focus in
    the event manager without checking to see if the event source was the
    active window. There's a very small chance it won't be, so check first.
    
    In addition, we weren't handling the case where an app fails to emit
    window:deactivate, but goes straight to window:destroy. So also check
    and handle that condition.

 src/orca/event_manager.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
---
diff --git a/src/orca/event_manager.py b/src/orca/event_manager.py
index 21a7fbe46..61402f297 100644
--- a/src/orca/event_manager.py
+++ b/src/orca/event_manager.py
@@ -717,7 +717,10 @@ class EventManager:
         if state and state.contains(pyatspi.STATE_DEFUNCT):
             msg = 'EVENT MANAGER: Ignoring defunct object: %s' % event.source
             debug.println(debug.LEVEL_INFO, msg, True)
-            if eType.startswith("window:deactivate"):
+            if eType.startswith("window:deactivate") or eType.startswith("window:destroy") \
+               and orca_state.activeWindow == event.source:
+                msg = 'EVENT MANAGER: Clearing active window and locus of focus'
+                debug.println(debug.LEVEL_INFO, msg, True)
                 orca_state.locusOfFocus = None
                 orca_state.activeWindow = None
             return


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