wmii

git clone git://oldgit.suckless.org/wmii/
Log | Files | Refs | README | LICENSE

commit 055fc504d767a8057be32934aec2b5dba42f4855
parent f4db0019b2d77c9815491bfe10fec65cb6857d2f
Author: Anselm R. Garbe <garbeam@wmii.de>
Date:   Sat, 11 Mar 2006 20:50:53 +0100

implemented reverting memory for toggle stuff between floating/managed area


Diffstat:
cmd/wm/area.c | 11+++++++++++
cmd/wm/client.c | 2++
cmd/wm/wm.h | 2++
rc/wmiirc | 2+-
4 files changed, 16 insertions(+), 1 deletion(-)

diff --git a/cmd/wm/area.c b/cmd/wm/area.c @@ -32,11 +32,17 @@ update_area_geometry(Area *a) void destroy_area(Area *a) { + unsigned int i; Tag *t = a->tag; if(a->nframe) return; if(a->frame) free(a->frame); + if(t->revert == area2index(a)) + t->revert = 0; + for(i = 0; i < nclient; i++) + if(client[i]->revert == a) + client[i]->revert = 0; cext_array_detach((void **)t->area, a, &t->areasz); t->narea--; if(t->sel > 1) @@ -73,9 +79,13 @@ select_area(Area *a, char *arg) int i = area2index(a); if(i == -1) return; + if(i) + t->revert = i; if(!strncmp(arg, "toggle", 7)) { if(i) i = 0; + else if(t->revert < t->narea) + i = t->revert; else i = 1; } else if(!strncmp(arg, "prev", 5)) { @@ -105,6 +115,7 @@ select_area(Area *a, char *arg) void send2area(Area *to, Area *from, Client *c) { + c->revert = from; detach_fromarea(from, c); attach_toarea(to, c); focus_client(c); diff --git a/cmd/wm/client.c b/cmd/wm/client.c @@ -513,6 +513,8 @@ send2area_client(Client *c, char *arg) else if(!strncmp(arg, "toggle", 7)) { if(i) to = t->area[0]; + else if(c->revert) + to = c->revert; else to = t->area[1]; } diff --git a/cmd/wm/wm.h b/cmd/wm/wm.h @@ -92,6 +92,7 @@ struct Tag { unsigned int areasz; unsigned int narea; unsigned int sel; + unsigned int revert; }; struct Area { @@ -131,6 +132,7 @@ struct Client { unsigned int framesz; unsigned int sel; unsigned int nframe; + Area *revert; }; typedef struct Key Key; diff --git a/rc/wmiirc b/rc/wmiirc @@ -143,7 +143,7 @@ do $MODKEY-Shift-Return) xwrite /ws/sel/sel/ctl sendto next;; $MODKEY-space) - xwrite /ws/sel/ctl select toggle;; + xwrite /ws/ctl select toggle;; $MODKEY-Shift-space) xwrite /ws/sel/sel/ctl sendto toggle;; $MODKEY-h)