Added cycling both ways for switch_proportion_preset

Now switch_proportion_preset requires an argument "prev" or "next" to
determine cycle direction
This commit is contained in:
kanvolu
2026-03-06 22:23:59 -05:00
committed by DreamMaoMao
parent 9a17a0279c
commit 10d7e5c6e3
3 changed files with 24 additions and 8 deletions
+1
View File
@@ -947,6 +947,7 @@ FuncType parse_func_name(char *func_name, Arg *arg, char *arg_value,
(*arg).f = atof(arg_value);
} else if (strcmp(func_name, "switch_proportion_preset") == 0) {
func = switch_proportion_preset;
(*arg).i = parse_circle_direction(arg_value);
} else if (strcmp(func_name, "viewtoleft") == 0) {
func = viewtoleft;
(*arg).i = atoi(arg_value);
+16 -1
View File
@@ -1056,14 +1056,29 @@ int32_t switch_proportion_preset(const Arg *arg) {
for (int32_t i = 0; i < config.scroller_proportion_preset_count; i++) {
if (config.scroller_proportion_preset[i] ==
tc->scroller_proportion) {
if (arg->i == NEXT) {
if (i == config.scroller_proportion_preset_count - 1) {
target_proportion = config.scroller_proportion_preset[0];
target_proportion =
config.scroller_proportion_preset[0];
break;
} else {
target_proportion =
config.scroller_proportion_preset[i + 1];
break;
}
} else {
if (i == 0) {
target_proportion =
config.scroller_proportion_preset
[config.scroller_proportion_preset_count - 1];
break;
} else {
target_proportion =
config.scroller_proportion_preset[i - 1];
break;
}
}
}
}