From: Michael D. Lowis Date: Thu, 9 Apr 2020 02:06:34 +0000 (-0400) Subject: added mouse action to expand a tile in place X-Git-Url: https://git.mdlowis.com/?a=commitdiff_plain;h=c1b43fae84133227dc7bd852fa7b7753c4538df9;p=proto%2Fanvil.git added mouse action to expand a tile in place --- diff --git a/mouse.c b/mouse.c index 2332c8c..fffdc50 100644 --- 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 66eae41..1307e5b 100644 --- a/tile.c +++ b/tile.c @@ -132,18 +132,33 @@ void stacked_del(Location* loc) 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; } }