Agent review pass.
This commit is contained in:
1 parent
e9b2e9508b
commit
64ee749a8e
105 files changed
+2098
-320
No files matched your search
@@ -17,6 +17,10 @@ enum {
|
||||
PREFS_TENTACLE_INSTALL = 19,
|
||||
PREFS_TENTACLE_SETTINGS = 20,
|
||||
PREFS_TENTACLE_UPDATE = 21,
|
||||
PREFS_PROFILE_ADD = 30,
|
||||
PREFS_PROFILE_EDIT = 31,
|
||||
PREFS_PROFILE_REMOVE = 32,
|
||||
PREFS_PROFILE_USE = 33,
|
||||
};
|
||||
int prefs_init(const char *xml);
|
||||
void prefs_set_application(const char *name);
|
||||
|
||||
@@ -23,12 +23,14 @@ void prefs_profiles_init(void) {
|
||||
// Focus the internal combo button so Tab and Shift+Tab leave it normally.
|
||||
gtk_widget_set_can_focus(profileCombo, FALSE);
|
||||
atk_object_set_name(gtk_widget_get_accessible(profileCombo), "Voice Profiles");
|
||||
g_object_set_data_full(G_OBJECT(profileCombo), "profile-label", g_strdup("Voice Profiles"), g_free);
|
||||
g_signal_connect(profileCombo, "changed", G_CALLBACK(profile_combo_changed), NULL);
|
||||
gtk_box_pack_start(GTK_BOX(profilePage), profileCombo, FALSE, FALSE, 0);
|
||||
GtkWidget **buttons[] = {&profileAdd, &profileEdit, &profileRemove, &profileUse};
|
||||
const char *labels[] = {"Add Voice Profile", "Edit Voice Profile", "Remove Voice Profile", "Use Voice Profile"};
|
||||
for (unsigned i = 0; i < G_N_ELEMENTS(buttons); i++) {
|
||||
*buttons[i] = gtk_button_new_with_label(labels[i]);
|
||||
g_signal_connect(*buttons[i], "clicked", G_CALLBACK(profile_action), GINT_TO_POINTER(30 + i));
|
||||
g_signal_connect(*buttons[i], "clicked", G_CALLBACK(profile_action), GINT_TO_POINTER(PREFS_PROFILE_ADD + (int)i));
|
||||
gtk_box_pack_start(GTK_BOX(profilePage), *buttons[i], FALSE, FALSE, 0);
|
||||
}
|
||||
gtk_notebook_append_page(GTK_NOTEBOOK(prefs_widget("notebook")), profilePage, gtk_label_new("Voice Profiles"));
|
||||
|
||||
@@ -67,7 +67,6 @@ func remotePermissions(grants []string) string {
|
||||
{"keyboard-capture", "capture local keyboard input for the controlled computer"},
|
||||
{"keyboard-inject", "accept keyboard input from the remote controller"},
|
||||
{"braille-stream", "exchange remote braille cells and supported display gestures"},
|
||||
{"clipboard-exchange", "send clipboard text explicitly and receive text with session permission"},
|
||||
}
|
||||
var requested []string
|
||||
for _, item := range descriptions {
|
||||
|
||||
@@ -54,9 +54,9 @@ func TestTentacleInstallConfirmationDescribesInteractionAndSettings(t *testing.T
|
||||
|
||||
func TestRemoteGrantConfirmationExplainsDirectionAndConsent(t *testing.T) {
|
||||
entry := tentacle.Entry{RemoteGrants: []string{"output-observe"}}
|
||||
manifest := tentacle.Manifest{Capabilities: []string{"output-observe", "keyboard-inject", "remote-present", "keyboard-capture", "braille-stream", "clipboard-exchange"}}
|
||||
manifest := tentacle.Manifest{Capabilities: []string{"output-observe", "keyboard-inject", "remote-present", "keyboard-capture", "braille-stream"}}
|
||||
for _, message := range []string{tentacleInstallConfirmation(entry, manifest, "Install"), tentacleUpdateConfirmation(entry, tentacle.AvailableUpdate{}, manifest)} {
|
||||
for _, want := range []string{"share local reader output", "accept keyboard input from the remote controller", "capture local keyboard input", "present output received", "Each session requires local approval", "receive text with session permission", "Installation does not start a connection"} {
|
||||
for _, want := range []string{"share local reader output", "accept keyboard input from the remote controller", "capture local keyboard input", "present output received", "Each session requires local approval", "Installation does not start a connection"} {
|
||||
if !strings.Contains(message, want) {
|
||||
t.Fatalf("missing %q in %s", want, message)
|
||||
}
|
||||
|
||||
@@ -177,7 +177,7 @@ func Run(ctx context.Context, input io.Reader, output io.Writer) error {
|
||||
session.refreshSpeechVoices()
|
||||
session.refreshKeyBindingLayout()
|
||||
action := C.prefs_action()
|
||||
if action >= 30 && action <= 33 && !busy && session.wineEditable {
|
||||
if action >= C.PREFS_PROFILE_ADD && action <= C.PREFS_PROFILE_USE && !busy && session.wineEditable {
|
||||
session.profileAction(int(action))
|
||||
continue
|
||||
}
|
||||
|
||||
@@ -31,12 +31,12 @@ func (session *uiSession) populateProfiles(index int) {
|
||||
|
||||
func (session *uiSession) profileAction(action int) {
|
||||
index := int(C.prefs_profiles_selected())
|
||||
if action == 32 {
|
||||
if action == int(C.PREFS_PROFILE_REMOVE) {
|
||||
session.profiles = session.profiles.Remove(index)
|
||||
session.populateProfiles(index)
|
||||
return
|
||||
}
|
||||
if action == 33 {
|
||||
if action == int(C.PREFS_PROFILE_USE) {
|
||||
if index < 0 || index >= len(session.profiles.Profiles) {
|
||||
return
|
||||
}
|
||||
@@ -71,7 +71,7 @@ func (session *uiSession) profileAction(action int) {
|
||||
if p.BaudRate == 0 {
|
||||
p.BaudRate = 9600
|
||||
}
|
||||
if action == 31 {
|
||||
if action == int(C.PREFS_PROFILE_EDIT) {
|
||||
if index < 0 || index >= len(session.profiles.Profiles) {
|
||||
return
|
||||
}
|
||||
|
||||
@@ -36,12 +36,15 @@ func validateWinePrograms(programs []string) error {
|
||||
return fmt.Errorf("Wine program entry %d is blank. Type an executable name such as Game.exe, or delete the entry.", index+1)
|
||||
case strings.ContainsAny(name, `/\`):
|
||||
return fmt.Errorf("Wine program \"%s\" is a path. Type only the executable name, such as Game.exe, or delete the entry.", name)
|
||||
case len(name) > 255:
|
||||
case config.WineExclusionUnits(name)-1 > 255:
|
||||
return fmt.Errorf("Wine program \"%s\" is too long. Executable names may be at most 255 characters; fix or delete the entry.", name)
|
||||
case !config.ValidWineProgramName(name):
|
||||
return fmt.Errorf("Wine program \"%s\" is not a valid executable name. Remove the surrounding spaces or control characters, or delete the entry.", name)
|
||||
}
|
||||
}
|
||||
if offending, tooLong := config.WineExclusionsTooLong(programs); tooLong {
|
||||
return fmt.Errorf("Wine program \"%s\" makes the exclusion list too long. Shorten or delete an entry.", offending)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
@@ -115,3 +115,23 @@ func TestWineValuesRejectEmbeddedControlCharacters(t *testing.T) {
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestWineProgramsAggregateLimitAndMultibyteNames(t *testing.T) {
|
||||
multibyte := strings.Repeat("€", 100) + ".exe"
|
||||
if err := validateWinePrograms([]string{multibyte}); err != nil {
|
||||
t.Fatalf("multibyte name within UTF-16 cap rejected: %v", err)
|
||||
}
|
||||
entry := strings.Repeat("a", 251) + ".exe"
|
||||
programs := make([]string, 129)
|
||||
for index := range programs {
|
||||
programs[index] = fmt.Sprintf("%03d%s", index, entry[3:])
|
||||
}
|
||||
err := validateWinePrograms(programs)
|
||||
if err == nil || !strings.Contains(err.Error(), "too long") {
|
||||
t.Fatalf("aggregate UTF-16 limit not enforced: %v", err)
|
||||
}
|
||||
// Entry 128 (0-based 127) is the first to reach 32766 units.
|
||||
if !strings.Contains(err.Error(), programs[127]) {
|
||||
t.Fatalf("aggregate error %q does not name offending entry %q", err, programs[127])
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user