implemented reverting memory for toggle stuff between floating/managed area

This commit is contained in:
Anselm R. Garbe 2006-03-11 20:50:53 +01:00
parent f4db0019b2
commit 055fc504d7
4 changed files with 16 additions and 1 deletions

View File

@ -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);

View File

@ -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];
}

View File

@ -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;

View File

@ -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)