fix: undefined behaviour in tagmon and tagcrossmon

This commit is contained in:
quadratic 2026-02-02 22:33:10 +01:00
parent eb0607501d
commit 1cde4975c3
2 changed files with 3 additions and 2 deletions

View file

@ -990,6 +990,7 @@ FuncType parse_func_name(char *func_name, Arg *arg, char *arg_value,
}
} else if (strcmp(func_name, "tagmon") == 0) {
func = tagmon;
(*arg).ui = 0;
(*arg).i = parse_direction(arg_value);
(*arg).i2 = atoi(arg_value2);
if ((*arg).i == UNDIR) {

View file

@ -1068,7 +1068,7 @@ int32_t tagmon(const Arg *arg) {
if (!m || !m->wlr_output->enabled)
return 0;
uint32_t newtags = arg->ui ? arg->ui : arg->i2 ? c->tags : 0;
uint32_t newtags = arg->ui != 0 ? arg->ui : arg->i2 != 0 ? c->tags : 1;
uint32_t target;
if (c->mon == m) {
@ -1730,4 +1730,4 @@ int32_t scroller_stack(const Arg *arg) {
arrange(selmon, false, false);
return 0;
}
}