Improve code of togglefloating func

This commit is contained in:
Alex Kotov 2021-11-14 00:39:06 +05:00
parent 17607d3d5a
commit 72e4325629
Signed by: kotovalexarian
GPG Key ID: 553C0EBBEB5D5F08
1 changed files with 13 additions and 5 deletions

18
dwm.c
View File

@ -2004,14 +2004,22 @@ togglebar(const Arg *arg)
void void
togglefloating(const Arg *arg) togglefloating(const Arg *arg)
{ {
if (!selmon->sel) if (!selmon->sel) return;
return;
selmon->sel->isfloating = !selmon->sel->isfloating || selmon->sel->isfixed; selmon->sel->isfloating = !selmon->sel->isfloating || selmon->sel->isfixed;
if (selmon->sel->isfloating)
resize(selmon->sel, selmon->sel->x, selmon->sel->y, if (selmon->sel->isfloating) {
resize(
selmon->sel,
selmon->sel->x,
selmon->sel->y,
selmon->sel->w - 2 * (borderpx - selmon->sel->bw), selmon->sel->w - 2 * (borderpx - selmon->sel->bw),
selmon->sel->h - 2 * (borderpx - selmon->sel->bw), selmon->sel->h - 2 * (borderpx - selmon->sel->bw),
borderpx, 0); borderpx,
0
);
}
arrange(selmon); arrange(selmon);
} }