From: Michael D. Lowis Date: Tue, 24 Mar 2020 03:28:12 +0000 (-0400) Subject: added method to switch back to stacked mode X-Git-Url: https://git.mdlowis.com/?a=commitdiff_plain;h=41d947a6588d73f4f9203c382ac2d862930f0dac;p=proto%2Fanvil.git added method to switch back to stacked mode --- diff --git a/tile.c b/tile.c index f2ff479..2788d89 100644 --- a/tile.c +++ b/tile.c @@ -40,7 +40,6 @@ void monocled_set(Monitor* mon, Column* col, Client* c) void stacked_add(Monitor* mon, Column* col, Client* c) { - /* TODO: unshade when client before is is removed */ /* TODO: add floating client add function */ coldims(mon, col, &(c->x), &(c->y), &(c->w), &(c->h)); if (col->clients) @@ -106,15 +105,28 @@ void stacked_del(Monitor* mon, Column* col, Client* c) for (; prev->next != c; prev = prev->next); prev->next = c->next; prev->h += c->h; + client_setshade(prev, 0); client_adjust(prev); } } void stacked_set(Monitor* mon, Column* col, Client* c) { - (void)mon, (void)col, (void)c; - puts("switching to stacked mode"); - /* TODO: implement switch back to stacked mode */ + (void)c; + col->focused = NULL; + int nclients = 0; + for (Client* c = col->clients->next; c; c = c->next, nclients++); + int starty = (mon->y + mon->h) - (nclients * MIN_HEIGHT); + col->clients->h = starty - mon->y - 1; + client_adjust(col->clients); + for (Client* c = col->clients->next; c; c = c->next) + { + c->y = starty; + c->h = MIN_HEIGHT; + client_setshade(c, 0); + client_adjust(c); + starty += MIN_HEIGHT; + } } void stacked_addheight(Monitor* mon, Column* col, Client* c, int amount)