diff --git a/src/dwm.c b/src/dwm.c index 7272bb7..0353135 100644 --- a/src/dwm.c +++ b/src/dwm.c @@ -407,42 +407,39 @@ applysizehints(Client *c, int *x, int *y, int *w, int *h, int bw, int interact) void arrange(Monitor *m) { - if (m) - showhide(m->stack); - else for (m = mons; m; m = m->next) + if (m) { showhide(m->stack); + } else { + for (m = mons; m; m = m->next) { + showhide(m->stack); + } + } + if (m) { arrangemon(m); restack(m); - } else for (m = mons; m; m = m->next) - arrangemon(m); + } else { + for (m = mons; m; m = m->next) { + arrangemon(m); + } + } } void arrangemon(Monitor *m) { unsigned int visible_clients = 0; + for (const Client *client = m->clients; client; client = client->next) { - if (ISVISIBLE(client)) ++visible_clients; + if (ISVISIBLE(client)) { + ++visible_clients; + } } - if (m->lt[m->sellt]->arrange) + if (m->lt[m->sellt]->arrange) { m->lt[m->sellt]->arrange(m); - else { - const int border_width = settings_get_border_width(); - - /* <>< case; rather than providing an arrange function and upsetting other logic that tests for its presence, simply add borders here */ - for (Client *c = selmon->clients; c; c = c->next) - if (ISVISIBLE(c) && c->bw == 0) - resize( - c, - c->x, - c->y, - c->w - 2 * border_width, - c->h - 2 * border_width, - border_width, - 0 - ); + } else { + floating(selmon); } } diff --git a/src/dwm/layouts.c b/src/dwm/layouts.c index 91b7dc1..4ebd4ae 100644 --- a/src/dwm/layouts.c +++ b/src/dwm/layouts.c @@ -1,8 +1,7 @@ #ifndef _DWM_LAYOUTS_C #define _DWM_LAYOUTS_C -void -centeredmaster(Monitor *m) +void centeredmaster(Monitor *m) { unsigned int n = 0; for (Client *c = nexttiled(m->clients); c; c = nexttiled(c->next), ++n); @@ -103,8 +102,26 @@ centeredmaster(Monitor *m) } } -void -horizontile(Monitor *m) +void floating(Monitor *m) +{ + const int border_width = settings_get_border_width(); + + for (Client *c = m->clients; c; c = c->next) { + if (ISVISIBLE(c) && c->bw == 0) { + resize( + c, + c->x, + c->y, + c->w - 2 * border_width, + c->h - 2 * border_width, + border_width, + 0 + ); + } + } +} + +void horizontile(Monitor *m) { unsigned int n = 0; for (Client *c = nexttiled(m->clients); c; c = nexttiled(c->next), ++n); @@ -173,8 +190,7 @@ horizontile(Monitor *m) } } -void -monocle(Monitor *m) +void monocle(Monitor *m) { bool any_is_fullscreen = false; for (Client *c = nexttiled(m->clients); c; c = nexttiled(c->next)) { @@ -199,8 +215,7 @@ monocle(Monitor *m) } } -void -tile(Monitor *m) +void tile(Monitor *m) { unsigned int n = 0; for (Client *c = nexttiled(m->clients); c; c = nexttiled(c->next), ++n); diff --git a/src/dwm/layouts.h b/src/dwm/layouts.h index e57a34e..eb9f6bb 100644 --- a/src/dwm/layouts.h +++ b/src/dwm/layouts.h @@ -2,6 +2,7 @@ #define _DWM_LAYOUTS_H static void centeredmaster(Monitor *m); +static void floating(Monitor *m); static void horizontile(Monitor *); static void monocle(Monitor *m); static void tile(Monitor *);