[orca] Attempt to handle event floods from combo boxes
- From: Joanmarie Diggs <joanied src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [orca] Attempt to handle event floods from combo boxes
- Date: Sat, 13 Jun 2015 20:05:55 +0000 (UTC)
commit 1166f573a2f218147eceb24bc756fd89f456ca53
Author: Joanmarie Diggs <jdiggs igalia com>
Date: Sat Jun 13 16:04:50 2015 -0400
Attempt to handle event floods from combo boxes
src/orca/event_manager.py | 11 +++++++++++
src/orca/script_utilities.py | 11 +++++++----
src/orca/scripts/toolkits/gtk/script.py | 9 +++++++++
3 files changed, 27 insertions(+), 4 deletions(-)
---
diff --git a/src/orca/event_manager.py b/src/orca/event_manager.py
index 379a702..647f376 100644
--- a/src/orca/event_manager.py
+++ b/src/orca/event_manager.py
@@ -143,6 +143,17 @@ class EventManager:
debug.println(debug.LEVEL_INFO, msg)
return True
+ if event.type.startswith('object:state-changed:showing'):
+ try:
+ role = event.source.getRole()
+ except:
+ role = None
+ if role == pyatspi.ROLE_MENU_ITEM:
+ msg = 'INFO: %s for %s in app %s. Who cares?' % \
+ (event.type, event.source, event.host_application)
+ debug.println(debug.LEVEL_INFO, msg)
+ return True
+
if event.type.startswith('object:children-changed:add'):
if not event.any_data:
msg = 'ERROR: %s without child from source %s in app %s' % \
diff --git a/src/orca/script_utilities.py b/src/orca/script_utilities.py
index bfdfbb0..ad88296 100644
--- a/src/orca/script_utilities.py
+++ b/src/orca/script_utilities.py
@@ -2724,16 +2724,19 @@ class Utilities:
if not obj:
return -1, -1
- if obj.getRole() == pyatspi.ROLE_COMBO_BOX:
+ isComboBox = obj.getRole() == pyatspi.ROLE_COMBO_BOX
+ if isComboBox:
selected = self.selectedChildren(obj)
if selected:
obj = selected[0]
parent = self.getFunctionalParent(obj)
siblings = self.getFunctionalChildren(parent)
- layoutRoles = [pyatspi.ROLE_SEPARATOR, pyatspi.ROLE_TEAROFF_MENU_ITEM]
- isNotLayoutOnly = lambda x: not (self.isZombie(x) or x.getRole() in layoutRoles)
- siblings = list(filter(isNotLayoutOnly, siblings))
+ if not (isComboBox or pyatspi.utils.findAncestor(obj, isComboBox)) \
+ and len(siblings) < 100:
+ layoutRoles = [pyatspi.ROLE_SEPARATOR, pyatspi.ROLE_TEAROFF_MENU_ITEM]
+ isNotLayoutOnly = lambda x: not (self.isZombie(x) or x.getRole() in layoutRoles)
+ siblings = list(filter(isNotLayoutOnly, siblings))
if not (siblings and obj in siblings):
return -1, -1
diff --git a/src/orca/scripts/toolkits/gtk/script.py b/src/orca/scripts/toolkits/gtk/script.py
index afb77da..2fa5eee 100644
--- a/src/orca/scripts/toolkits/gtk/script.py
+++ b/src/orca/scripts/toolkits/gtk/script.py
@@ -183,6 +183,15 @@ class Script(default.Script):
orca.setLocusOfFocus(event, obj)
return
+ def onSelectionChanged(self, event):
+ """Callback for object:selection-changed accessibility events."""
+
+ if event.source.getRole() == pyatspi.ROLE_COMBO_BOX \
+ and not event.source.getState().contains(pyatspi.STATE_FOCUSED):
+ return
+
+ default.Script.onSelectionChanged(self, event)
+
def onShowingChanged(self, event):
"""Callback for object:state-changed:showing accessibility events."""
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]