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);
{ 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 },
};
void stacked_set(Location* loc)
{
- Client* c = 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;
}
}