Use shared quick settings and migrate speech values to the SSIP scale

This commit is contained in:
Storm Dragon committed 2026-11-15 12:30:20 -05:00
1 parent 679d81a804
commit 09e9570c66
46 files changed
+1053 -554

No files matched your search

+7 -2
View File
@@ -10,6 +10,8 @@ const (
SelectNextSpeechSetting Command = "select-next-speech-setting"
DecreaseSpeechSetting Command = "decrease-speech-setting"
IncreaseSpeechSetting Command = "increase-speech-setting"
SelectPreviousSpeechCategory Command = "select-previous-speech-category"
SelectNextSpeechCategory Command = "select-next-speech-category"
SaveSpeechSettings Command = "save-speech-settings"
PresentTime Command = "present-time"
PresentDate Command = "present-date"
@@ -168,6 +170,7 @@ const (
leftShiftKeySymbol uint32 = 0xffe1
rightShiftKeySymbol uint32 = 0xffe2
controlModifier uint16 = 1 << 2
altModifier uint16 = 1 << 3
)
type CommandChord struct {
@@ -236,8 +239,10 @@ func DefaultCommandBindings(layout KeyboardLayout) CommandBindings {
{Symbol: 'f', CthulhuModifier: true}: PresentCharacterAttributes,
{Symbol: upKeySymbol, Modifiers: controlModifier, CthulhuModifier: true}: ObjectParent,
{Symbol: downKeySymbol, Modifiers: controlModifier, CthulhuModifier: true}: ObjectFirstChild,
{Symbol: leftKeySymbol, Modifiers: controlModifier, CthulhuModifier: true}: ObjectPreviousSibling,
{Symbol: rightKeySymbol, Modifiers: controlModifier, CthulhuModifier: true}: ObjectNextSibling,
{Symbol: leftKeySymbol, Modifiers: controlModifier, CthulhuModifier: true}: SelectPreviousSpeechCategory,
{Symbol: rightKeySymbol, Modifiers: controlModifier, CthulhuModifier: true}: SelectNextSpeechCategory,
{Symbol: leftKeySymbol, Modifiers: altModifier, CthulhuModifier: true}: ObjectPreviousSibling,
{Symbol: rightKeySymbol, Modifiers: altModifier, CthulhuModifier: true}: ObjectNextSibling,
}
for index := 0; index < 12; index++ {
bindings[CommandChord{Symbol: 0xffbe + uint32(index), CthulhuModifier: true}] = MessageCommand(index, false)
+14 -9
View File
@@ -221,25 +221,30 @@ func TestWhereAmIBindingsAreLayoutSpecific(t *testing.T) {
}
func TestObjectNavigationBindingsMatchPython(t *testing.T) {
// Python used Control for all four; siblings moved to Alt so Control+Left/Right
// can switch quick settings categories as in Fenrir.
tests := []struct {
symbol uint32
command Command
symbol uint32
modifiers uint16
command Command
}{
{upKeySymbol, ObjectParent},
{downKeySymbol, ObjectFirstChild},
{leftKeySymbol, ObjectPreviousSibling},
{rightKeySymbol, ObjectNextSibling},
{upKeySymbol, controlModifier, ObjectParent},
{downKeySymbol, controlModifier, ObjectFirstChild},
{leftKeySymbol, altModifier, ObjectPreviousSibling},
{rightKeySymbol, altModifier, ObjectNextSibling},
{leftKeySymbol, controlModifier, SelectPreviousSpeechCategory},
{rightKeySymbol, controlModifier, SelectNextSpeechCategory},
}
for _, test := range tests {
router := NewCommandRouter([]uint32{0xff63}, DefaultCommandBindings(DesktopKeyboardLayout))
router.Handle(0xff63, 118, 0, true)
if consumed, command := router.Handle(test.symbol, 111, controlModifier, true); !consumed || command != test.command {
if consumed, command := router.Handle(test.symbol, 111, test.modifiers, true); !consumed || command != test.command {
t.Fatalf("symbol %#x press = %v %q", test.symbol, consumed, command)
}
if consumed, command := router.Handle(test.symbol, 111, controlModifier, false); !consumed || command != "" {
if consumed, command := router.Handle(test.symbol, 111, test.modifiers, false); !consumed || command != "" {
t.Fatalf("symbol %#x release = %v %q", test.symbol, consumed, command)
}
if consumed, command := router.Handle(0xff63, 118, controlModifier, false); !consumed || command != "" {
if consumed, command := router.Handle(0xff63, 118, test.modifiers, false); !consumed || command != "" {
t.Fatalf("symbol %#x modifier release = %v %q, want %q", test.symbol, consumed, command, Command(""))
}
}