Follow Steam Big Picture overlays and stop false Steam notifications
Big Picture draws Quick Access, the Steam menu and the power menu as separate Chromium frames in its one X11 window and never marks them active, so their focus was discarded and Cthulhu kept reading the library. Accept a focus gain in a showing Steam frame owned by the X11 foreground process. Steam closes these popups when focus leaves them, which browse-mode caret movement caused, so Steam popup documents (<Name>_uid<n>) start in focus mode. Steam's events calendar sits in a live region and was spoken as dozens of "Steam:" notifications. Live regions now count as Steam notifications only inside toast popups; notification and alert roles are unchanged. Verified live: F2, Notifications, Right reached and completed the hardware survey. The toast restriction is not yet checked against a real toast. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
5c919016bb
commit
87b6aa49da
13 files changed
+236
-3
No files matched your search
@@ -6,7 +6,7 @@ Cthulhu is a Linux screen reader written in Go.
|
||||
- [Contributing](CONTRIBUTING.md): development, accessibility verification, licensing, and the AI-assisted contribution policy.
|
||||
- [LibreOffice support](LIBREOFFICE_SUPPORT.md): integration boundaries, initial Calc behavior, remaining work, and verification.
|
||||
- [Progress reporting](PROGRESS_BARS.md): web progress bars, Steam shader processing, and verification.
|
||||
- [Steam keyboard focus](STEAM_FOCUS.md): Xorg workspace focus recovery and verification.
|
||||
- [Steam keyboard focus](STEAM_FOCUS.md): Xorg workspace focus recovery, Big Picture overlays, notifications and verification.
|
||||
- [XTerm handoff](docs/testing/xterm-handoff.md): terminal reader keys, lock state, speech interruption, and verification.
|
||||
- [Graphical terminals](docs/testing/graphical-terminals.md): repaint coalescing, editing feedback, title animation, and verification.
|
||||
- [Messaging support](docs/testing/messaging.md): Pidgin and Mumble message review/copy shortcuts, application boundaries, and verification.
|
||||
|
||||
@@ -65,3 +65,41 @@ Human review and live Steam acceptance remain required before submission:
|
||||
|
||||
Do not count a native fixture pass as audible speech, physical Braille, or
|
||||
successful operation of Steam's actual Chromium/controller navigation.
|
||||
|
||||
## Big Picture overlays and notifications
|
||||
|
||||
Big Picture draws Quick Access (F2), the Steam menu (F1) and the power menu
|
||||
as separate Chromium frames inside its one X11 window. Each popup document is
|
||||
named `<Name>_uid<n>`, for example `QuickAccess_uid2`; the main view is
|
||||
`Steam Big Picture Mode`. Steam moves focus into these frames but never marks
|
||||
them active, so the normal active-frame check discarded their focus and
|
||||
Cthulhu kept reading the library.
|
||||
|
||||
The atspi adapter now accepts a focus gain in a showing Steam frame owned by
|
||||
the X11 foreground process, without changing the correlated foreground
|
||||
window. Steam closes a popup when focus leaves it, and browse-mode caret
|
||||
movement did exactly that, so popup documents start in focus mode and Steam
|
||||
keeps its own arrow navigation. A manual mode toggle still works.
|
||||
|
||||
Steam notification live regions are announced only inside toast popups
|
||||
(`notificationtoasts_uid<n>-<id>` or `notificationtoasts_<id>_desktop`).
|
||||
Live regions in page content, such as the store's events calendar, are no
|
||||
longer spoken as dozens of "Steam:" notifications. Notification and alert
|
||||
roles still work anywhere.
|
||||
|
||||
Big Picture maps keys to controller buttons: F1 Steam menu, F2 Quick Access,
|
||||
F3 or Backspace secondary, F4 options, F6 and F7 bumpers, F8 select, F9
|
||||
start, Enter OK, Escape back. In Quick Access, Up and Down move between tabs
|
||||
and Right enters the tab's contents.
|
||||
|
||||
Verified live on 2026-12-01: F2, then Notifications, then Right reached the
|
||||
hardware survey notification and the survey was completed; the Steam menu
|
||||
items spoke in focus mode. Automated: `TestSteamOverlayFocusMatchesForegroundProcessOnly`,
|
||||
`TestBrowserModeSteamPopupStartsInFocusMode`, `TestGamepadPopupDocument`,
|
||||
`TestToastDocument`, and the native `TestNativeWebScriptNotificationCapture`.
|
||||
The toast restriction has not yet been checked against a real toast.
|
||||
|
||||
Known remaining issue: when Steam replaces page content (for example the
|
||||
RECOMMENDED tab), browse-mode navigation can fail with "Could not find
|
||||
current location" because the remembered native focus no longer exists and
|
||||
`DocumentCursor.syncFocus` does not fall back to the reading place.
|
||||
@@ -15,6 +15,7 @@ import (
|
||||
"git.stormux.org/storm/cthulhu/internal/input"
|
||||
"git.stormux.org/storm/cthulhu/internal/review"
|
||||
"git.stormux.org/storm/cthulhu/internal/sound"
|
||||
"git.stormux.org/storm/cthulhu/internal/webscripts"
|
||||
)
|
||||
|
||||
type documentContextCapturer interface {
|
||||
@@ -52,6 +53,7 @@ type browserModeController struct {
|
||||
cancel context.CancelFunc
|
||||
done chan struct{}
|
||||
document atspi.ObjectID
|
||||
focusProcess string // provider process of the latest native focus
|
||||
navigation atspi.ObjectID
|
||||
navigationDocument atspi.ObjectID
|
||||
navigationFocus atspi.ObjectID
|
||||
@@ -240,6 +242,11 @@ func (browser *browserModeController) accept(result browserModeResult, speech sp
|
||||
browser.mutex.Unlock()
|
||||
browser.state = review.DocumentModeState{}
|
||||
browser.state.SetSticky(browser.stickyModes[browser.document.BusName])
|
||||
// Steam popups own their arrow keys and close when focus leaves.
|
||||
// Start them in focus mode; a manual toggle still clears this.
|
||||
if browser.state.Sticky() == review.InactiveMode && gamepadPopupDocument(browser.focusProcess, result.owner) {
|
||||
browser.state.SetSticky(review.FocusMode)
|
||||
}
|
||||
}
|
||||
browser.ready = true
|
||||
modeInput := runtimeModeInput(result.owner)
|
||||
@@ -247,6 +254,16 @@ func (browser *browserModeController) accept(result browserModeResult, speech sp
|
||||
mode := browser.state.Update(modeInput, browser.modeSettings())
|
||||
browser.set(mode, speech, false)
|
||||
}
|
||||
func gamepadPopupDocument(process string, owner atspi.DocumentContext) bool {
|
||||
document := owner.TopLevel.ID()
|
||||
for _, ancestor := range owner.Ancestors {
|
||||
if ancestor.ID() == document {
|
||||
return webscripts.GamepadPopupDocument(process, ancestor.Name)
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func (browser *browserModeController) modeSettings() review.ModeSettings {
|
||||
if browser.settings != nil {
|
||||
return browser.settings()
|
||||
|
||||
@@ -806,3 +806,56 @@ func TestStructuralNavigationAutomaticFocus(t *testing.T) {
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func steamDocumentContext(t *testing.T, documentPath, documentName string) atspi.DocumentContext {
|
||||
t.Helper()
|
||||
button := atspi.Snapshot{BusName: ":1.42", Path: documentPath + "/button", Role: "button", StatesKnown: true, Focusable: true}
|
||||
doc := atspi.Snapshot{BusName: ":1.42", Path: documentPath, Name: documentName, Role: "document web", StatesKnown: true}
|
||||
tree, err := atspi.NewAccessibleTree(doc.ID(), []atspi.TreeNode{{Snapshot: doc, Children: []atspi.ObjectID{button.ID()}}, {Snapshot: button}})
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
ref, _ := tree.Reference(button.ID())
|
||||
owner, err := tree.DocumentContext(ref)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
return owner
|
||||
}
|
||||
|
||||
func TestBrowserModeSteamPopupStartsInFocusMode(t *testing.T) {
|
||||
keys := &modeKeys{}
|
||||
browser := newBrowserModeController(nil, keys, nil)
|
||||
queue := &fakeSpeechQueue{spoken: make(chan string, 16)}
|
||||
main := steamDocumentContext(t, "/main", "Steam Big Picture Mode")
|
||||
popup := steamDocumentContext(t, "/popup", "QuickAccess_uid2")
|
||||
browser.focusProcess = "steamwebhelper"
|
||||
|
||||
browser.follow(main.Ancestors[0].ID())
|
||||
browser.accept(browserModeResult{focus: main.Ancestors[0].ID(), generation: 1, owner: main}, queue)
|
||||
if browser.mode != review.BrowseMode || !keys.enabled {
|
||||
t.Fatalf("main Big Picture view mode = %v, want browse", browser.mode)
|
||||
}
|
||||
browser.follow(popup.Ancestors[0].ID())
|
||||
browser.accept(browserModeResult{focus: popup.Ancestors[0].ID(), generation: 2, owner: popup}, queue)
|
||||
if browser.mode != review.FocusMode || keys.enabled {
|
||||
t.Fatalf("Quick Access mode = %v, want focus so Steam keeps its arrow keys", browser.mode)
|
||||
}
|
||||
browser.toggle(queue)
|
||||
if browser.mode != review.BrowseMode {
|
||||
t.Fatal("manual toggle could not leave focus mode in a Steam popup")
|
||||
}
|
||||
browser.follow(main.Ancestors[0].ID())
|
||||
browser.accept(browserModeResult{focus: main.Ancestors[0].ID(), generation: 3, owner: main}, queue)
|
||||
if browser.mode != review.BrowseMode {
|
||||
t.Fatalf("returning to the main view kept mode %v", browser.mode)
|
||||
}
|
||||
|
||||
other := newBrowserModeController(nil, &modeKeys{}, nil)
|
||||
other.focusProcess = "chrome"
|
||||
other.follow(popup.Ancestors[0].ID())
|
||||
other.accept(browserModeResult{focus: popup.Ancestors[0].ID(), generation: 1, owner: popup}, queue)
|
||||
if other.mode != review.BrowseMode {
|
||||
t.Fatalf("non-Steam document named like a popup got mode %v", other.mode)
|
||||
}
|
||||
}
|
||||
@@ -82,6 +82,7 @@ func (handler *accessibilityEventHandler) filterNavigationAndNames(event atspi.E
|
||||
}
|
||||
if browser != nil && isFocusEvent(event.Type) && !ownedAutocompletePopup(event) {
|
||||
browser.nativeButtonFocus(isFocusGainEvent(event) && (event.Source.Role == "button" || event.Source.Role == "push button" || event.Source.Role == "toggle button"))
|
||||
browser.focusProcess = event.Source.ApplicationProcess
|
||||
browser.follow(event.Source.ID())
|
||||
} else if browser != nil && event.Type == atspi.CaretEvent && !event.Source.Editable {
|
||||
browser.followCaret(event.Source.ID())
|
||||
|
||||
@@ -312,6 +312,10 @@ func (adapter *Adapter) enrichNativeWindowEvent(event *C.AtspiEvent, target *C.A
|
||||
focusEvent.ForegroundMismatch = !adapter.matchForeground(target, window, focusEvent.Window, &focusEvent.ForegroundCheck, false)
|
||||
} else {
|
||||
focusEvent.ForegroundMismatch = !adapter.matchForeground(target, window, focusEvent.Window, nil, focusedMenuItem)
|
||||
if focusEvent.ForegroundMismatch && (eventType == FocusEvent || eventType == FocusedStateEvent) && snapshot.Focused &&
|
||||
adapter.matchSteamOverlayFocus(window) {
|
||||
focusEvent.ForegroundMismatch = false
|
||||
}
|
||||
}
|
||||
if !focusEvent.ForegroundMismatch && window != nil &&
|
||||
(eventType == WindowActivatedEvent || snapshot.Role == "table" || snapshot.Role == "table cell") {
|
||||
|
||||
@@ -9,6 +9,8 @@ package atspi
|
||||
*/
|
||||
import "C"
|
||||
|
||||
import "git.stormux.org/storm/cthulhu/internal/webscripts"
|
||||
|
||||
// Reject routine background updates before resolving a selected descendant or
|
||||
// capturing text, attributes, values and geometry. Global lifecycle events and
|
||||
// supported notifications retain their existing handling. No new ownership is
|
||||
@@ -61,6 +63,10 @@ func (adapter *Adapter) filterNativeBackgroundEvent(event *C.AtspiEvent, eventTy
|
||||
if adapter.matchForeground(event.source, window, windowID, nil, focusedMenuItem) {
|
||||
return false
|
||||
}
|
||||
if (eventType == FocusEvent || eventType == FocusedStateEvent && event.detail1 != 0) &&
|
||||
adapter.matchSteamOverlayFocus(window) {
|
||||
return false
|
||||
}
|
||||
if origin.BusName == adapter.foregroundWindow.BusName {
|
||||
// Browser suggestions and tooltips can occupy a different top-level
|
||||
// without taking X11 focus. Preserve their existing event-loop checks;
|
||||
@@ -83,3 +89,26 @@ func (adapter *Adapter) filterNativeBackgroundEvent(event *C.AtspiEvent, eventTy
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
// matchSteamOverlayFocus checks fresh frame state for a Steam overlay focus
|
||||
// gain. It never changes the correlated foreground window: the main Big
|
||||
// Picture frame keeps that role and reclaims focus when the overlay closes.
|
||||
func (adapter *Adapter) matchSteamOverlayFocus(window *C.AtspiAccessible) bool {
|
||||
if window == nil {
|
||||
return false
|
||||
}
|
||||
process := adapter.applicationProcess(window)
|
||||
if webscripts.MatchProcess(process) != webscripts.Steam {
|
||||
return false
|
||||
}
|
||||
pid := adapter.foregroundProcessID(int(C.atspi_accessible_get_process_id(window, nil)))
|
||||
C.atspi_accessible_clear_cache_single(window)
|
||||
states := C.atspi_accessible_get_state_set(window)
|
||||
if states == nil {
|
||||
return false
|
||||
}
|
||||
showing := C.atspi_state_set_contains(states, C.ATSPI_STATE_SHOWING) != 0
|
||||
iconified := C.atspi_state_set_contains(states, C.ATSPI_STATE_ICONIFIED) != 0
|
||||
C.g_object_unref(C.gpointer(states))
|
||||
return steamOverlayFocusMatches(adapter.Foreground().Client, process, pid, true, showing, iconified)
|
||||
}
|
||||
@@ -9,6 +9,7 @@ import (
|
||||
"slices"
|
||||
|
||||
"git.stormux.org/storm/cthulhu/internal/platform/xorg"
|
||||
"git.stormux.org/storm/cthulhu/internal/webscripts"
|
||||
)
|
||||
|
||||
// The native caller supplies a complete, fresh, bounded application window
|
||||
@@ -37,6 +38,16 @@ func preferencesForegroundMatches(client xorg.Foreground, pid int, preferencesPI
|
||||
int64(pid) == preferencesPID && client.PID == pid
|
||||
}
|
||||
|
||||
// Steam Big Picture draws overlays such as Quick Access and the main menu as
|
||||
// separate Chromium frames inside its one X11 window. Steam moves focus into
|
||||
// them but never marks their frame active, so the normal active-frame check
|
||||
// discards that focus. Accept only a confirmed focus gain in a showing frame
|
||||
// owned by the X11 foreground process itself.
|
||||
func steamOverlayFocusMatches(client xorg.Foreground, process string, pid int, focusGain, showing, iconified bool) bool {
|
||||
return focusGain && showing && !iconified && webscripts.MatchProcess(process) == webscripts.Steam &&
|
||||
client.Known && client.Window != 0 && client.PID > 0 && pid == client.PID
|
||||
}
|
||||
|
||||
func foregroundWindowMatches(client xorg.Foreground, pid int, bounds Rectangle) bool {
|
||||
if client.PID > 0 && pid > 0 && client.PID != pid {
|
||||
return false
|
||||
|
||||
@@ -216,3 +216,30 @@ func TestForegroundWindowReplacement(t *testing.T) {
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestSteamOverlayFocusMatchesForegroundProcessOnly(t *testing.T) {
|
||||
client := xorg.Foreground{Known: true, Window: 83886130, PID: 111, Width: 1920, Height: 1080}
|
||||
if !steamOverlayFocusMatches(client, "steamwebhelper", 111, true, true, false) {
|
||||
t.Fatal("Quick Access focus in the foreground Steam process was rejected")
|
||||
}
|
||||
cases := map[string]struct {
|
||||
client xorg.Foreground
|
||||
process string
|
||||
pid int
|
||||
focusGain, showing, iconified bool
|
||||
}{
|
||||
"other application": {client, "chrome", 111, true, true, false},
|
||||
"other process": {client, "steamwebhelper", 222, true, true, false},
|
||||
"not a focus gain": {client, "steamwebhelper", 111, false, true, false},
|
||||
"hidden overlay": {client, "steamwebhelper", 111, true, false, false},
|
||||
"iconified overlay": {client, "steamwebhelper", 111, true, true, true},
|
||||
"no foreground window": {xorg.Foreground{Known: true, PID: 111}, "steamwebhelper", 111, true, true, false},
|
||||
"unknown foreground": {xorg.Foreground{Window: 83886130, PID: 111}, "steamwebhelper", 111, true, true, false},
|
||||
"unknown foreground pid": {xorg.Foreground{Known: true, Window: 83886130}, "steamwebhelper", 0, true, true, false},
|
||||
}
|
||||
for name, test := range cases {
|
||||
if steamOverlayFocusMatches(test.client, test.process, test.pid, test.focusGain, test.showing, test.iconified) {
|
||||
t.Errorf("%s: accepted Steam overlay focus", name)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -93,9 +93,15 @@ func (adapter *Adapter) webNotification(event *C.AtspiEvent) *webscripts.Notific
|
||||
C.g_object_unref(C.gpointer(ancestor))
|
||||
}
|
||||
}()
|
||||
documentName, documentFound := "", false
|
||||
for current := C.web_ref(source); current != nil; {
|
||||
ancestors = append(ancestors, current)
|
||||
role := C.atspi_accessible_get_role(current, nil)
|
||||
if role == C.ATSPI_ROLE_DOCUMENT_WEB && !documentFound {
|
||||
name := C.atspi_accessible_get_name(current, nil)
|
||||
documentName, documentFound = C.GoString(name), true
|
||||
C.g_free(C.gpointer(name))
|
||||
}
|
||||
candidate := webscripts.NotificationCandidate{}
|
||||
switch role {
|
||||
case C.ATSPI_ROLE_NOTIFICATION:
|
||||
@@ -116,7 +122,7 @@ func (adapter *Adapter) webNotification(event *C.AtspiEvent) *webscripts.Notific
|
||||
current = C.atspi_accessible_get_parent(current, nil)
|
||||
}
|
||||
index := webscripts.NotificationRoot(candidates)
|
||||
if index < 0 {
|
||||
if index < 0 || candidates[index].Role == "" && !webscripts.ToastDocument(documentName) {
|
||||
return nil
|
||||
}
|
||||
root := ancestors[index]
|
||||
|
||||
@@ -21,7 +21,7 @@ import "strings"
|
||||
|
||||
const Name = "Cthulhu"
|
||||
|
||||
const Version = "2026.11.24"
|
||||
const Version = "2026.12.01"
|
||||
const Channel = "testing"
|
||||
|
||||
var Build = Version
|
||||
|
||||
@@ -16,6 +16,10 @@ const steamNotificationDelay = 500 * time.Millisecond
|
||||
|
||||
var steamRelativeTime = regexp.MustCompile(`(?i)^(?:just now|now|\d+\s+(?:second|minute|hour|day|week|month|year)s?\s+ago)$`)
|
||||
|
||||
// Steam names each Big Picture popup browser "<Name>_uid<browser>", for
|
||||
// example QuickAccess_uid2. The main view is "Steam Big Picture Mode".
|
||||
var steamPopupDocument = regexp.MustCompile(`^[A-Za-z][A-Za-z0-9]*_uid\d+$`)
|
||||
|
||||
var steamShaderProgress = regexp.MustCompile(`^Processing Vulkan shaders \((\d{1,3})%\)$`)
|
||||
|
||||
// ShaderProgress recognizes Steam's English shader status, which Chromium
|
||||
@@ -33,6 +37,20 @@ func ShaderProgress(processName, eventType, role, name string) (float64, bool) {
|
||||
return float64(percentage), err == nil && percentage <= 100
|
||||
}
|
||||
|
||||
// GamepadPopupDocument reports a Steam Big Picture popup, such as Quick Access
|
||||
// or the main menu. Steam drives these with its own arrow-key navigation and
|
||||
// closes them when focus leaves, so browse-mode caret movement dismisses them.
|
||||
func GamepadPopupDocument(processName, documentName string) bool {
|
||||
return MatchProcess(processName) == Steam && steamPopupDocument.MatchString(strings.TrimSpace(documentName))
|
||||
}
|
||||
|
||||
// ToastDocument reports Steam's toast popup, named notificationtoasts_uid<n>-<id>
|
||||
// in Big Picture and notificationtoasts_<id>_desktop otherwise. Live regions
|
||||
// elsewhere, such as the store's event calendar, are page content, not toasts.
|
||||
func ToastDocument(documentName string) bool {
|
||||
return strings.HasPrefix(strings.TrimSpace(documentName), "notificationtoasts_")
|
||||
}
|
||||
|
||||
// NotificationRoot mirrors Python's Steam root selection: notification/alert
|
||||
// ancestors take precedence over inherited live-region attributes on a leaf.
|
||||
// Candidates are ordered from the event source towards its application root.
|
||||
|
||||
@@ -145,3 +145,32 @@ func TestSteamNotificationDeduplicationAndOwnership(t *testing.T) {
|
||||
t.Fatalf("reset presented pending content: %q", got)
|
||||
}
|
||||
}
|
||||
|
||||
func TestGamepadPopupDocument(t *testing.T) {
|
||||
for _, name := range []string{"QuickAccess_uid2", "MainMenu_uid12", " QuickAccess_uid2 "} {
|
||||
if !GamepadPopupDocument("steamwebhelper", name) {
|
||||
t.Errorf("%q was not a Steam popup", name)
|
||||
}
|
||||
}
|
||||
for _, name := range []string{"Steam Big Picture Mode", "Steam", "", "QuickAccess_uid", "Quick Access_uid2"} {
|
||||
if GamepadPopupDocument("steamwebhelper", name) {
|
||||
t.Errorf("%q was treated as a Steam popup", name)
|
||||
}
|
||||
}
|
||||
if GamepadPopupDocument("chrome", "QuickAccess_uid2") {
|
||||
t.Error("another browser's document was treated as a Steam popup")
|
||||
}
|
||||
}
|
||||
|
||||
func TestToastDocument(t *testing.T) {
|
||||
for _, name := range []string{"notificationtoasts_uid2-41", "notificationtoasts_41_desktop"} {
|
||||
if !ToastDocument(name) {
|
||||
t.Errorf("%q was not a toast document", name)
|
||||
}
|
||||
}
|
||||
for _, name := range []string{"Steam Big Picture Mode", "QuickAccess_uid2", ""} {
|
||||
if ToastDocument(name) {
|
||||
t.Errorf("%q was treated as a toast document", name)
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user