[orca] Event Manager: Allow scripts to handle child removal if focus is dead
- From: Joanmarie Diggs <joanied src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [orca] Event Manager: Allow scripts to handle child removal if focus is dead
- Date: Sat, 27 Feb 2021 12:10:05 +0000 (UTC)
commit c2137aaa7c3ee280b6b1ff6e07167d3775964036
Author: Joanmarie Diggs <jdiggs igalia com>
Date: Sat Feb 27 13:03:24 2021 +0100
Event Manager: Allow scripts to handle child removal if focus is dead
Sometimes we get a single event for a child removal, but the child
being removed is potentially an ancestor of the locusOfFocus. Or
there may be a case where the equality check between the removed child
and the locusOfFocus fails. Therefore if the locusOfFocus is dead,
allow scripts to handle this event so they can do any possibly clean
up / recovery.
src/orca/event_manager.py | 19 +++++++++++++++----
1 file changed, 15 insertions(+), 4 deletions(-)
---
diff --git a/src/orca/event_manager.py b/src/orca/event_manager.py
index 371f9d854..ff55b7c7f 100644
--- a/src/orca/event_manager.py
+++ b/src/orca/event_manager.py
@@ -245,10 +245,21 @@ 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
+ if event.type.endswith('remove'):
+ if 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:
+ _name = orca_state.locusOfFocus.name
+ except:
+ msg = 'EVENT MANAGER: Locus of focus is dead.'
+ debug.println(debug.LEVEL_INFO, msg, True)
+ return False
+ else:
+ msg = 'EVENT MANAGER: Locus of focus: %s' % orca_state.locusOfFocus
+ debug.println(debug.LEVEL_INFO, msg, True)
try:
childState = event.any_data.getState()
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]