]> git.mdlowis.com Git - proto/anvil.git/commitdiff
added mouse action to expand a tile in place
authorMichael D. Lowis <mike@mdlowis.com>
Thu, 9 Apr 2020 02:06:34 +0000 (22:06 -0400)
committerMichael D. Lowis <mike@mdlowis.com>
Thu, 9 Apr 2020 02:06:34 +0000 (22:06 -0400)
mouse.c
tile.c

diff --git a/mouse.c b/mouse.c
index 2332c8cb484de70ba0b9c3e4a7aef6a2fe18d9a5..fffdc50fbec9b3779f393ffa5ee151ff139d219c 100644 (file)
--- a/mouse.c
+++ b/mouse.c
@@ -77,12 +77,6 @@ static void reposition_tile(Location* loc)
     X.mode = (X.edge == E_TOP ? M_TILE_RESIZE : M_COL_RESIZE);
 }
 
-static void expand_tile(Location* loc)
-{
-    (void)loc;
-    puts("expand in place");
-}
-
 static void monocle_client(Location* loc)
 {
     monocled_set(loc);
@@ -108,7 +102,7 @@ MouseAct Stacked[] = {
     { 0,                Button1, ButtonPress, reposition_tile },
     { MODKEY|ShiftMask, Button2, ButtonPress, toggle_float    },
     { MODKEY,           Button2, ButtonPress, close_client    },
-    { 0,                Button2, ButtonPress, expand_tile     },
+    { 0,                Button2, ButtonPress, stack_clients   },
     { 0,                Button3, ButtonPress, monocle_client  },
 };
 
diff --git a/tile.c b/tile.c
index 66eae41d3b99639eedf84ee67293e20319241364..1307e5b9bd18d4f37b098ea8f6731ddbc0f5457d 100644 (file)
--- a/tile.c
+++ b/tile.c
@@ -132,18 +132,33 @@ void stacked_del(Location* loc)
 
 void stacked_set(Location* loc)
 {
-    Clientc = loc->client;
+    Client *curr, *c = loc->client;
     loc->column->focused = NULL;
-    int nclients = list_length(loc->column->clients->next);
-    int starty = (loc->monitor->y + loc->monitor->h) - (nclients * MIN_HEIGHT);
-    loc->column->clients->h = starty - loc->monitor->y - 1;
-    client_adjust(loc->column->clients);
-    LIST_FOR_EACH(c, loc->column->clients->next)
+    int starty = loc->monitor->y;
+    /* stack the windows before the target */
+    LIST_FOR_EACH_UNTIL(curr, loc->column->clients, curr == c)
     {
-        c->y = starty;
-        c->h = MIN_HEIGHT;
-        client_setshade(c, 1);
-        client_adjust(c);
+        curr->y = starty;
+        curr->h = MIN_HEIGHT;
+        client_setshade(curr, 1);
+        client_adjust(curr);
+        starty += MIN_HEIGHT;
+    }
+    /* expand the target window */
+    int nclients = list_length(curr->next);
+    curr->y = starty;
+    curr->h = (loc->monitor->h - starty) - (nclients * MIN_HEIGHT);
+    client_setshade(c, 0);
+    client_adjust(curr);
+    mouse_totitle(curr);
+    starty = (curr->y + curr->h - 1);
+    /* stack the windows after the target */
+    LIST_FOR_EACH(curr, curr->next)
+    {
+        curr->y = starty;
+        curr->h = MIN_HEIGHT;
+        client_setshade(curr, 1);
+        client_adjust(curr);
         starty += MIN_HEIGHT;
     }
 }