[orca] gnome-shell: cache isLayoutOnly() results
- From: Joanmarie Diggs <joanied src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [orca] gnome-shell: cache isLayoutOnly() results
- Date: Tue, 4 Jan 2022 16:24:26 +0000 (UTC)
commit 13cb2c193596245b51a062cbee8dc3c25c9f8a53
Author: Joanmarie Diggs <jdiggs igalia com>
Date: Tue Jan 4 17:23:24 2022 +0100
gnome-shell: cache isLayoutOnly() results
Should shave some time off of presentation, given all the panels.
src/orca/scripts/apps/gnome-shell/script.py | 6 ++++++
src/orca/scripts/apps/gnome-shell/script_utilities.py | 18 +++++++++++++-----
2 files changed, 19 insertions(+), 5 deletions(-)
---
diff --git a/src/orca/scripts/apps/gnome-shell/script.py b/src/orca/scripts/apps/gnome-shell/script.py
index 697779612..694dcbaa4 100644
--- a/src/orca/scripts/apps/gnome-shell/script.py
+++ b/src/orca/scripts/apps/gnome-shell/script.py
@@ -49,6 +49,12 @@ class Script(clutter.Script):
def getUtilities(self):
return Utilities(self)
+ def deactivate(self):
+ """Called when this script is deactivated."""
+
+ self.utilities.clearCachedObjects()
+ super().deactivate()
+
def skipObjectEvent(self, event):
"""Determines whether or not this event should be skipped due to
being redundant, part of an event flood, etc."""
diff --git a/src/orca/scripts/apps/gnome-shell/script_utilities.py
b/src/orca/scripts/apps/gnome-shell/script_utilities.py
index 78836093b..784c107f3 100644
--- a/src/orca/scripts/apps/gnome-shell/script_utilities.py
+++ b/src/orca/scripts/apps/gnome-shell/script_utilities.py
@@ -35,6 +35,10 @@ class Utilities(script_utilities.Utilities):
def __init__(self, script):
script_utilities.Utilities.__init__(self, script)
+ self._isLayoutOnly = {}
+
+ def clearCachedObjects(self):
+ self._isLayoutOnly = {}
def selectedChildren(self, obj):
try:
@@ -106,17 +110,21 @@ class Utilities(script_utilities.Utilities):
return super().unrelatedLabels(root, onlyShowing, minimumWords)
def isLayoutOnly(self, obj):
- if super().isLayoutOnly(obj):
- return True
+ rv = self._isLayoutOnly.get(hash(obj))
+ if rv is not None:
+ return rv
- if obj.getRole() == pyatspi.ROLE_PANEL and obj.childCount == 1:
+ rv = super().isLayoutOnly(obj)
+ if not rv and obj.getRole() == pyatspi.ROLE_PANEL and obj.childCount == 1:
displayedLabel = self.displayedLabel(obj)
if displayedLabel == obj[0].name and obj[0].getRole() != pyatspi.ROLE_LABEL:
+ rv = True
msg = "GNOME SHELL: %s is deemed to be layout only" % obj
debug.println(debug.LEVEL_INFO, msg, True)
- return True
- return False
+ self._isLayoutOnly[hash(obj)] = rv
+ return rv
+
def isBogusWindowFocusClaim(self, event):
if event.type.startswith('object:state-changed:focused') and event.detail1 \
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]