Cthulhu is no longer a fork. Now it is a screen reader written in Golang.
This commit is contained in:
1 parent
a998fe67de
commit
069fc674dc
708 files changed
+112482
-532
No files matched your search
@@ -0,0 +1,39 @@
|
||||
// Copyright (c) 2026 Storm Dragon
|
||||
// Authors: Storm Dragon, Angus Kola
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
package app
|
||||
|
||||
import (
|
||||
"git.stormux.org/storm/cthulhu/internal/atspi"
|
||||
"git.stormux.org/storm/cthulhu/internal/presentation"
|
||||
)
|
||||
|
||||
// The event loop owns this history. Some toolkits repeat focus on the semantic
|
||||
// combo when its internal selection changes; that is not entry into a control.
|
||||
type comboPresentation struct {
|
||||
focus atspi.ObjectID
|
||||
value string
|
||||
}
|
||||
|
||||
func (history *comboPresentation) observe(event atspi.Event) (text string, update, duplicate bool) {
|
||||
focusGain := isFocusGainEvent(event)
|
||||
if event.Source.Role != "combo box" {
|
||||
if focusGain {
|
||||
history.focus, history.value = event.Source.ID(), ""
|
||||
}
|
||||
return "", false, false
|
||||
}
|
||||
if !focusGain && !isValueChangeEvent(event.Type) &&
|
||||
event.Type != atspi.AccessibleNameEvent && !isManagedDescendantEvent(event.Type) {
|
||||
return "", false, false
|
||||
}
|
||||
text = presentation.ComboBoxSelectionText(event.Source)
|
||||
update = !focusGain || event.Source.ID() == history.focus
|
||||
duplicate = update && event.Source.ID() == history.focus && text == history.value
|
||||
history.value = text
|
||||
if focusGain {
|
||||
history.focus = event.Source.ID()
|
||||
}
|
||||
return text, update, duplicate
|
||||
}
|
||||
Reference in new issue
Block a user