Hell of a speed boost for Steam.

This commit is contained in:
Storm Dragon
2026-04-07 16:07:32 -04:00
parent d51ef2ad69
commit 9c94191583
3 changed files with 152 additions and 0 deletions
@@ -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):