[orca] Handle missing events from submenus
- From: Joanmarie Diggs <joanied src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [orca] Handle missing events from submenus
- Date: Fri, 24 Mar 2017 10:18:46 +0000 (UTC)
commit c2c209c34d1ee8a0ff48a87b30a7e229f359b93c
Author: Joanmarie Diggs <jdiggs igalia com>
Date: Fri Mar 24 06:18:10 2017 -0400
Handle missing events from submenus
src/orca/scripts/toolkits/GAIL/script.py | 8 +++++++-
src/orca/scripts/toolkits/gtk/script.py | 8 +++++++-
2 files changed, 14 insertions(+), 2 deletions(-)
---
diff --git a/src/orca/scripts/toolkits/GAIL/script.py b/src/orca/scripts/toolkits/GAIL/script.py
index 0fe086d..d55391b 100644
--- a/src/orca/scripts/toolkits/GAIL/script.py
+++ b/src/orca/scripts/toolkits/GAIL/script.py
@@ -75,7 +75,13 @@ class Script(default.Script):
if self.utilities.isLayoutOnly(event.source):
return
- if pyatspi.findAncestor(orca_state.locusOfFocus, lambda x: x == event.source):
+ ancestor = pyatspi.findAncestor(orca_state.locusOfFocus, lambda x: x == event.source)
+ if not ancestor:
+ orca.setLocusOfFocus(event, event.source)
+ return
+
+ isMenu = lambda x: x and x.getRole() == pyatspi.ROLE_MENU
+ if isMenu(ancestor) and not pyatspi.findAncestor(ancestor, isMenu):
return
orca.setLocusOfFocus(event, event.source)
diff --git a/src/orca/scripts/toolkits/gtk/script.py b/src/orca/scripts/toolkits/gtk/script.py
index 80878bf..f734578 100644
--- a/src/orca/scripts/toolkits/gtk/script.py
+++ b/src/orca/scripts/toolkits/gtk/script.py
@@ -120,7 +120,13 @@ class Script(default.Script):
if self.utilities.isLayoutOnly(event.source):
return
- if pyatspi.findAncestor(orca_state.locusOfFocus, lambda x: x == event.source):
+ ancestor = pyatspi.findAncestor(orca_state.locusOfFocus, lambda x: x == event.source)
+ if not ancestor:
+ orca.setLocusOfFocus(event, event.source)
+ return
+
+ isMenu = lambda x: x and x.getRole() == pyatspi.ROLE_MENU
+ if isMenu(ancestor) and not pyatspi.findAncestor(ancestor, isMenu):
return
orca.setLocusOfFocus(event, event.source)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]