Merge pull request #742 from kanvolu/main

Added cycling both ways for switch_proportion_preset
This commit is contained in:
DreamMaoMao 2026-03-07 12:44:51 +08:00 committed by GitHub
commit 95481623cb
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 24 additions and 8 deletions

View file

@ -947,6 +947,7 @@ FuncType parse_func_name(char *func_name, Arg *arg, char *arg_value,
(*arg).f = atof(arg_value); (*arg).f = atof(arg_value);
} else if (strcmp(func_name, "switch_proportion_preset") == 0) { } else if (strcmp(func_name, "switch_proportion_preset") == 0) {
func = switch_proportion_preset; func = switch_proportion_preset;
(*arg).i = parse_circle_direction(arg_value);
} else if (strcmp(func_name, "viewtoleft") == 0) { } else if (strcmp(func_name, "viewtoleft") == 0) {
func = viewtoleft; func = viewtoleft;
(*arg).i = atoi(arg_value); (*arg).i = atoi(arg_value);

View file

@ -1056,13 +1056,28 @@ int32_t switch_proportion_preset(const Arg *arg) {
for (int32_t i = 0; i < config.scroller_proportion_preset_count; i++) { for (int32_t i = 0; i < config.scroller_proportion_preset_count; i++) {
if (config.scroller_proportion_preset[i] == if (config.scroller_proportion_preset[i] ==
tc->scroller_proportion) { tc->scroller_proportion) {
if (i == config.scroller_proportion_preset_count - 1) {
target_proportion = config.scroller_proportion_preset[0]; if (arg->i == NEXT) {
break; if (i == config.scroller_proportion_preset_count - 1) {
target_proportion =
config.scroller_proportion_preset[0];
break;
} else {
target_proportion =
config.scroller_proportion_preset[i + 1];
break;
}
} else { } else {
target_proportion = if (i == 0) {
config.scroller_proportion_preset[i + 1]; target_proportion =
break; config.scroller_proportion_preset
[config.scroller_proportion_preset_count - 1];
break;
} else {
target_proportion =
config.scroller_proportion_preset[i - 1];
break;
}
} }
} }
} }