[orca] Event manager: Allow scripts to handle locusOfFocus destruction



commit 02802f9a49ff26bc0258bccaff14fd265c4ff27c
Author: Joanmarie Diggs <jdiggs igalia com>
Date:   Fri Feb 26 13:44:24 2021 +0100

    Event manager: Allow scripts to handle locusOfFocus destruction
    
    When the locusOfFocus is being destroyed, the event.any_data from the
    children-removed event sometimes contains an already-dead accessible
    object. We were ignoring these events on the grounds that there wasn't
    much to do other than wait for an event (e.g. focused) for the new
    location. But scripts which cache objects (e.g. web) might be able
    to do some cleanup, so allow that to happen by not ignoring these
    events.

 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 4243e54e2..6c3f465b4 100644
--- a/src/orca/event_manager.py
+++ b/src/orca/event_manager.py
@@ -243,6 +243,10 @@ class EventManager:
                 msg = 'ERROR: Event any_data lacks child/descendant'
                 debug.println(debug.LEVEL_INFO, msg, True)
                 return True
+            if event.type.endswith('remove') and event.any_data == orca_state.locusOfFocus:
+                msg = 'EVENT MANAGER: Locus of focus is being destroyed'
+                debug.println(debug.LEVEL_INFO, msg, True)
+                return False
             try:
                 childState = event.any_data.getState()
                 childRole = event.any_data.getRole()


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