Share native current-line speech with Remote
This commit is contained in:
1 parent
103fbfd81a
commit
ee3d91af23
11 files changed
+289
-16
No files matched your search
@@ -15,7 +15,7 @@ func (handler *eventReviewHandler) current_line(command input.Command) {
|
||||
return
|
||||
}
|
||||
handler.syncForeground()
|
||||
if handler.objectReview == nil || !handler.state.current.ID().Valid() {
|
||||
if handler.focusGate.Locked() || handler.focusGate.Suspended() || handler.objectReview == nil || !handler.state.current.ID().Valid() {
|
||||
return
|
||||
}
|
||||
handler.state.pending.terminalFocus.clear()
|
||||
@@ -34,7 +34,7 @@ func (handler *eventReviewHandler) current_line(command input.Command) {
|
||||
}
|
||||
|
||||
func (handler *eventReviewHandler) present_current_line(result review.Result) {
|
||||
if !handler.objectReview.CurrentDocumentResult(result) || result.DocumentFocus != handler.objectReview.Focus() || handler.focusGate.Suspended() {
|
||||
if !handler.objectReview.CurrentDocumentResult(result) || result.DocumentFocus != handler.objectReview.Focus() || handler.focusGate.Locked() || handler.focusGate.Suspended() {
|
||||
return
|
||||
}
|
||||
if result.CurrentLineBrowse && (handler.browser == nil || !handler.browser.acceptsDocumentResult(review.Result{
|
||||
@@ -44,9 +44,13 @@ func (handler *eventReviewHandler) present_current_line(result review.Result) {
|
||||
}
|
||||
request := speechRequest{Text: "Could not read current line.", Role: "system", Cause: "current-line"}
|
||||
if result.Err == nil {
|
||||
// Native focused-line reads do not carry complete ancestry. Only
|
||||
// browse reports with captured source metadata opt into observation.
|
||||
if result.CurrentLineBrowse {
|
||||
// Native reports require the matching focused source and an unbroken
|
||||
// capture through the application. Missing privacy data stays local.
|
||||
context := result.DocumentCaretContext
|
||||
nativeSource := len(context) > 0 && result.DocumentFocus.Valid() &&
|
||||
result.DocumentPosition.Snapshot.ID() == result.DocumentFocus && context[0].ID() == result.DocumentFocus &&
|
||||
context[len(context)-1].Role == "application"
|
||||
if result.CurrentLineBrowse || nativeSource {
|
||||
sources := atspi.DocumentLine{Contents: []atspi.DocumentContent{{Snapshot: result.DocumentPosition.Snapshot}},
|
||||
SourceContexts: [][]atspi.Snapshot{result.DocumentCaretContext}}
|
||||
request.origin = document_line_speech_origin(sources)
|
||||
|
||||
Reference in new issue
Block a user