Fix panning sounds after scrolling.

This commit is contained in:
Storm Dragon committed 2026-10-14 12:50:44 -04:00
1 parent b2f558c26c
commit 8e76d2341c
14 files changed
+338 -17

No files matched your search

+40
View File
@@ -488,5 +488,45 @@ func (worker *Worker) placeDocument(ctx context.Context, cursor *DocumentCursor,
deadline, cancel := context.WithTimeout(ctx, worker.captureTimeout)
defer cancel()
result.CaretErr = navigator.SetDocumentPosition(deadline, result.DocumentPosition.Object, focus)
if result.CaretErr == nil && worker.CurrentDocumentResult(result) {
result = worker.refreshDocumentSoundGeometry(deadline, cursor, result)
}
return result
}
func (worker *Worker) refreshDocumentSoundGeometry(ctx context.Context, cursor *DocumentCursor, result Result) Result {
reader, ok := worker.nativeCapturerFor(result.DocumentFocus).(interface {
CaptureDocumentSoundGeometry(context.Context, atspi.ObjectReference, atspi.ObjectReference) ([2]atspi.SoundGeometry, error)
})
if !ok {
return result
}
// Geometry belongs to this presentation, not the document's initial viewport.
// Failed refreshes must not reuse an old position after scrolling or resizing.
result.DocumentPosition.Snapshot.SoundGeometry = atspi.SoundGeometry{}
link := atspi.ObjectReference{}
if previous := result.DocumentPosition.LinkedHeading; previous != nil {
copy := *previous
copy.SoundGeometry = atspi.SoundGeometry{}
result.DocumentPosition.LinkedHeading = &copy
if cursor == nil {
result.DocumentSoundErr = atspi.ErrStaleObject
return result
}
var err error
link, err = cursor.tree.Reference(copy.ID())
if err != nil {
result.DocumentSoundErr = err
return result
}
}
geometry, err := reader.CaptureDocumentSoundGeometry(ctx, result.DocumentPosition.Object, link)
result.DocumentSoundErr = err
if err == nil {
result.DocumentPosition.Snapshot.SoundGeometry = geometry[0]
if result.DocumentPosition.LinkedHeading != nil {
result.DocumentPosition.LinkedHeading.SoundGeometry = geometry[1]
}
}
return result
}