opt:make sure open animation type not be overwrite

This commit is contained in:
DreamMaoMao 2025-03-21 10:14:55 +08:00
parent a53d4bd4d9
commit 90f4b0ed84
3 changed files with 51 additions and 14 deletions

View file

@ -402,6 +402,9 @@ FuncType parse_func_name(char *func_name, Arg *arg, char *arg_value) {
} else if (strcmp(func_name, "set_proportion") == 0) {
func = set_proportion;
(*arg).f = atof(arg_value);
} else if (strcmp(func_name, "increase_proportion") == 0) {
func = increase_proportion;
(*arg).f = atof(arg_value);
} else if (strcmp(func_name, "switch_proportion_preset") == 0) {
func = switch_proportion_preset;
} else if (strcmp(func_name, "viewtoleft") == 0) {
@ -446,6 +449,15 @@ FuncType parse_func_name(char *func_name, Arg *arg, char *arg_value) {
} else if (strcmp(func_name, "spawn") == 0) {
func = spawn;
(*arg).v = strdup(arg_value);
} else if (strcmp(func_name, "spawn_on_empty") == 0) {
char cmd[256],tag_num[256];
if (sscanf(arg_value, "%255[^,],%255s", cmd, tag_num) == 2) {
func = spawn_on_empty;
(*arg).v = strdup(cmd); // 注意:之后需要释放这个内存
(*arg).ui = 1 << (atoi(tag_num) - 1);
} else {
fprintf(stderr, "Error: Invalid value format: %s\n", arg_value);
}
} else if (strcmp(func_name, "quit") == 0) {
func = quit;
} else if (strcmp(func_name, "moveresize") == 0) {