]> git.mdlowis.com Git - proto/anvil.git/commitdiff
handle unshading when deleting stacked clients
authorMichael D. Lowis <mike@mdlowis.com>
Mon, 23 Mar 2020 03:28:23 +0000 (23:28 -0400)
committerMichael D. Lowis <mike@mdlowis.com>
Mon, 23 Mar 2020 03:28:23 +0000 (23:28 -0400)
tile.c

diff --git a/tile.c b/tile.c
index 3bd1ad0afcb03ad4b1caafcbab85f258f0d46398..f2ff479c96a73ff8caa34d0f455589b19adaedd6 100644 (file)
--- 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);
         }
     }