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:
1 parent
9205e7280a
commit
12c514aab0
19 files changed
+798
-30
No files matched your search
@@ -20,13 +20,14 @@ type windowTitleSource interface {
|
||||
}
|
||||
|
||||
type pendingWindowTitle struct {
|
||||
text string
|
||||
window atspi.ObjectID
|
||||
epoch uint64
|
||||
native xorg.WindowTitle
|
||||
changed bool
|
||||
application string
|
||||
observedAt time.Time
|
||||
text string
|
||||
window atspi.ObjectID
|
||||
epoch uint64
|
||||
native xorg.WindowTitle
|
||||
changed bool
|
||||
application string
|
||||
observedAt time.Time
|
||||
inputSequence uint64
|
||||
}
|
||||
|
||||
// windowTitleController is owned by the accessibility event loop. Discovery
|
||||
@@ -40,6 +41,7 @@ type windowTitleController struct {
|
||||
logger *slog.Logger
|
||||
source windowTitleSource
|
||||
foreground foregroundMonitor
|
||||
inputSource any
|
||||
lastNative atspi.ForegroundTitle
|
||||
lastTitle string
|
||||
application string
|
||||
@@ -96,6 +98,11 @@ func (titles *windowTitleController) applicationForEvent(event atspi.Event) stri
|
||||
func (titles *windowTitleController) queue(pending pendingWindowTitle) {
|
||||
if pending.observedAt.IsZero() {
|
||||
pending.observedAt = time.Now()
|
||||
pending.inputSequence = recentInput(titles.inputSource).TitleInterruptionSequence
|
||||
}
|
||||
if titles.pending != nil {
|
||||
// Coalescing must not revive a burst interrupted since its first sample.
|
||||
pending.inputSequence = titles.pending.inputSequence
|
||||
}
|
||||
if previous := titles.pending; previous != nil && !previous.changed && previous.epoch == pending.epoch &&
|
||||
previous.window == pending.window && previous.native.Window == pending.native.Window &&
|
||||
@@ -246,6 +253,9 @@ func (titles *windowTitleController) flush() {
|
||||
return
|
||||
}
|
||||
titles.lastTitle = pending.text
|
||||
if pending.inputSequence != recentInput(titles.inputSource).TitleInterruptionSequence {
|
||||
return
|
||||
}
|
||||
if titles.logger != nil {
|
||||
titles.logger.Debug("queued automatic window title", "title_changed", pending.changed,
|
||||
"observed_to_queue_ms", time.Since(pending.observedAt).Milliseconds())
|
||||
|
||||
Reference in new issue
Block a user