Hell of a speed boost for Steam.
This commit is contained in:
@@ -118,8 +118,19 @@ class Script(Chromium.Script):
|
||||
self._presentSteamNotification(event.any_data)
|
||||
return
|
||||
|
||||
if self._handleSteamVirtualizedListMutation(event):
|
||||
return True
|
||||
|
||||
super().onChildrenAdded(event)
|
||||
|
||||
def onChildrenRemoved(self, event):
|
||||
"""Callback for object:children-changed:removed accessibility events."""
|
||||
|
||||
if self._handleSteamVirtualizedListMutation(event):
|
||||
return True
|
||||
|
||||
return super().onChildrenRemoved(event)
|
||||
|
||||
def getStructuralNavigation(self):
|
||||
types = self.getEnabledStructuralNavigationTypes()
|
||||
enable = settingsManager.getSetting('structuralNavigationEnabled')
|
||||
@@ -165,6 +176,23 @@ class Script(Chromium.Script):
|
||||
self._logSteamNavigationEvent("active-descendant-changed", event)
|
||||
return super().onActiveDescendantChanged(event)
|
||||
|
||||
def _handleSteamVirtualizedListMutation(self, event):
|
||||
if not event or not self.utilities.isSteamVirtualizedList(event.source):
|
||||
return False
|
||||
|
||||
focus = cthulhu_state.locusOfFocus
|
||||
if not focus or AXObject.is_dead(focus):
|
||||
return False
|
||||
|
||||
if not AXObject.find_ancestor(focus, lambda x: x == event.source):
|
||||
return False
|
||||
|
||||
AXObject.clear_cache_now("children-changed event.")
|
||||
self.utilities.clearSteamVirtualizedListCaches()
|
||||
msg = "STEAM: Skipping generic web cache dump for virtualized list churn near focus"
|
||||
debug.printMessage(debug.LEVEL_INFO, msg, True)
|
||||
return True
|
||||
|
||||
def _trySteamButtonActivation(self, keyboardEvent) -> bool:
|
||||
if keyboardEvent.event_string not in ["Return", "KP_Enter"]:
|
||||
return False
|
||||
|
||||
@@ -41,6 +41,20 @@ class Utilities(ChromiumUtilities):
|
||||
super().clearCachedObjects()
|
||||
self._steamInferredButtonLabels = {}
|
||||
|
||||
def clearSteamVirtualizedListCaches(self) -> None:
|
||||
self.clearContentCache()
|
||||
self._steamInferredButtonLabels = {}
|
||||
|
||||
def isSteamVirtualizedList(self, obj) -> bool:
|
||||
if not (obj and self.inDocumentContent(obj)):
|
||||
return False
|
||||
|
||||
if not AXUtilities.is_list(obj):
|
||||
return False
|
||||
|
||||
className = AXObject.get_attribute(obj, "class") or ""
|
||||
return "ReactVirtualized__Grid__innerScrollContainer" in className
|
||||
|
||||
def displayedLabel(self, obj):
|
||||
label = super().displayedLabel(obj)
|
||||
if label or not self._shouldInferSteamButtonLabel(obj):
|
||||
|
||||
Reference in New Issue
Block a user