[orca] More on adjust when we clear the active window and focus in event manager



commit 014b369fc5aab67cb764bdc246ee7550cb1bc8a5
Author: Joanmarie Diggs <jdiggs igalia com>
Date:   Mon Feb 24 21:03:22 2020 +0100

    More on adjust when we clear the active window and focus in event manager
    
    Also apply the previous change when we cannot even check if the event
    source is defunct because the window is already truly dead and checking
    triggers an exception.

 src/orca/event_manager.py | 15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)
---
diff --git a/src/orca/event_manager.py b/src/orca/event_manager.py
index 61402f297..563d3b5e1 100644
--- a/src/orca/event_manager.py
+++ b/src/orca/event_manager.py
@@ -704,17 +704,14 @@ class EventManager:
 
         try:
             state = event.source.getState()
-        except (LookupError, RuntimeError):
-            msg = 'ERROR: Could not process event: %s' % eType
-            debug.println(debug.LEVEL_WARNING, msg, True)
-            if eType.startswith("window:deactivate"):
-                orca_state.locusOfFocus = None
-                orca_state.activeWindow = None
-            return
         except:
-            return
+            isDefunct = True
+            msg = 'ERROR: Exception getting state for event source'
+            debug.println(debug.LEVEL_WARNING, msg, True)
+        else:
+            isDefunct = state.contains(pyatspi.STATE_DEFUNCT)
 
-        if state and state.contains(pyatspi.STATE_DEFUNCT):
+        if isDefunct:
             msg = 'EVENT MANAGER: Ignoring defunct object: %s' % event.source
             debug.println(debug.LEVEL_INFO, msg, True)
             if eType.startswith("window:deactivate") or eType.startswith("window:destroy") \


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