Fix code of nmaxmaster patch

This commit is contained in:
Alex Kotov 2021-11-14 02:10:25 +05:00
parent 4d040f377b
commit 37af14efcb
Signed by: kotovalexarian
GPG key ID: 553C0EBBEB5D5F08
2 changed files with 8 additions and 5 deletions

11
dwm.c
View file

@ -1180,10 +1180,13 @@ grabkeys(void)
void
incnmaster(const Arg *arg)
{
selmon->nmaster = selmon->pertag->nmasters[selmon->pertag->curtag] = MIN(
MAX(selmon->nmaster + arg->i, 0),
MAX(settings_get_max_clients_in_master(), 1)
);
const int max_clients_in_master = settings_get_max_clients_in_master();
const int new_clients_in_master = MAX(0, selmon->nmaster + arg->i);
selmon->nmaster = selmon->pertag->nmasters[selmon->pertag->curtag] =
max_clients_in_master == 0
? new_clients_in_master
: MIN(new_clients_in_master, max_clients_in_master);
arrange(selmon);
}

View file

@ -17,7 +17,7 @@ void settings_set_focus_on_wheel(const bool new_focus_on_wheel)
int settings_get_max_clients_in_master()
{
return max_clients_in_master;
return max_clients_in_master > 0 ? max_clients_in_master : 0;
}
void settings_set_max_clients_in_master(const int new_max_clients_in_master)