From 97c05d194644bdacc229b2d5def5386ecd7edd79 Mon Sep 17 00:00:00 2001 From: "Michael D. Lowis" Date: Sun, 22 Mar 2020 23:28:23 -0400 Subject: [PATCH] handle unshading when deleting stacked clients --- tile.c | 35 ++++++++++++++++++++++++++++------- 1 file changed, 28 insertions(+), 7 deletions(-) diff --git a/tile.c b/tile.c index 3bd1ad0..f2ff479 100644 --- a/tile.c +++ b/tile.c @@ -40,6 +40,8 @@ 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) { @@ -51,13 +53,31 @@ void stacked_add(Monitor* mon, Column* col, Client* c) max = c; } } - c->h = max->h/2; - c->y = max->y + c->h; - max->h -= max->h/2; - c->next = max->next; - max->next = c; - client_adjust(c); - client_adjust(max); + if (max->h < 3*MIN_HEIGHT) + { + if (col->next) + { + stacked_add(mon, col->next, c); + } + else + { + c->next = mon->cspace->floating; + mon->cspace->floating = c; + c->x = mon->midx - c->w/2; + c->y = mon->midy - c->h/2; + client_adjust(c); + } + } + else + { + c->h = max->h/2; + c->y = max->y + c->h; + max->h -= max->h/2; + c->next = max->next; + max->next = c; + client_adjust(c); + client_adjust(max); + } } else { @@ -76,6 +96,7 @@ void stacked_del(Monitor* mon, Column* col, Client* c) { col->clients->h += col->clients->y - mon->y; col->clients->y = mon->y; + client_setshade(col->clients, 0); client_adjust(col->clients); } } -- 2.52.0