Sometimes when switching from steam to a different workspace and back only the outer window takes focus so some actions don't work. Tentative fix for that.

This commit is contained in:
Storm Dragon committed 2026-10-14 19:51:07 -04:00
1 parent 9205e7280a
commit 12c514aab0
19 files changed
+798 -30

No files matched your search

+21 -4
View File
@@ -282,11 +282,18 @@ func TestNativeBrowserEditing(t *testing.T) {
}
}()
defer func() { cancel(); <-relayDone }()
queue := &fakeSpeechQueue{spoken: make(chan string, 128)}
queue := &fakeSpeechQueue{spoken: make(chan string, 128), interrupt: make(chan struct{}, 128)}
logger := slog.New(slog.DiscardHandler)
inputDone := make(chan struct{})
go func() {
defer close(inputDone)
processInputEvents(ctx, logger, queue, listener, input.EchoSettings{}, nil, nil)
}()
defer func() { cancel(); <-inputDone }()
done := make(chan struct{})
go func() {
defer close(done)
processEventsWithInput(ctx, slog.New(slog.DiscardHandler), queue, observed, nil, nil, 20*time.Millisecond, nil, listener, nil, nil)
processEventsWithInput(ctx, logger, queue, observed, nil, nil, 20*time.Millisecond, nil, listener, nil, nil)
}()
defer func() { cancel(); <-done }()
keys := func(chord string) {
@@ -315,11 +322,17 @@ func TestNativeBrowserEditing(t *testing.T) {
keys("ctrl+l")
collect()
for _, letter := range []string{"c", "t", "h"} {
for len(queue.interrupt) > 0 {
<-queue.interrupt
}
keys(letter)
got := collect()
if len(got) != 1 || got[0] != letter {
t.Fatalf("typing %q: %q", letter, got)
}
if len(queue.interrupt) == 0 {
t.Fatalf("typing %q did not interrupt speech", letter)
}
}
keys("Down")
got := collect()
@@ -380,9 +393,13 @@ func TestNativeBrowserEditing(t *testing.T) {
if len(got) != 1 || got[0] != "• Registered: September 2026" {
t.Fatalf("embedded browser line text: %q", got)
}
// Preserve the browser-specific suffix. AT-SPI can report this change
// before the native X11 title cache catches up.
wantTitle := strings.Replace(adapter.ForegroundTitle().Title.Title, "Cthulhu Browser Probe", "Cthulhu Browser Probe updated", 1)
keys("F8")
if got := collect(); len(got) != 0 || !browserNameChanged.Load() {
t.Fatalf("browser title update: speech=%q, native event=%v", got, browserNameChanged.Load())
got = collect()
if len(got) != 1 || got[0] != wantTitle || !strings.Contains(wantTitle, "Cthulhu Browser Probe updated") || !browserNameChanged.Load() {
t.Fatalf("browser title update: speech=%q, expected=%q, native event=%v", got, wantTitle, browserNameChanged.Load())
}
// Seed a typed browser URL locally, then replace it with a prefix. This