removed swap(), implemented pop for everything
This commit is contained in:
parent
0b7c0f10ee
commit
7ac0de8350
69
view.c
69
view.c
@ -11,44 +11,6 @@ nexttiled(Client *c) {
|
|||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Bool
|
|
||||||
ismaster(Client *c) {
|
|
||||||
Client *cl;
|
|
||||||
unsigned int i;
|
|
||||||
|
|
||||||
for(cl = nexttiled(clients), i = 0; cl && cl != c; cl = nexttiled(cl->next), i++);
|
|
||||||
return i < nmaster;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
pop(Client *c) {
|
|
||||||
detach(c);
|
|
||||||
if(clients)
|
|
||||||
clients->prev = c;
|
|
||||||
c->next = clients;
|
|
||||||
clients = c;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
swap(Client *c1, Client *c2) {
|
|
||||||
Client tmp = *c1;
|
|
||||||
Client *c1p = c1->prev;
|
|
||||||
Client *c1n = c1->next;
|
|
||||||
Client *c1s = c1->snext;
|
|
||||||
Client *c2p = c2->prev;
|
|
||||||
Client *c2n = c2->next;
|
|
||||||
Client *c2s = c2->snext;
|
|
||||||
|
|
||||||
*c1 = *c2;
|
|
||||||
*c2 = tmp;
|
|
||||||
c1->prev = c1p;
|
|
||||||
c1->next = c1n;
|
|
||||||
c1->snext = c1s;
|
|
||||||
c2->prev = c2p;
|
|
||||||
c2->next = c2n;
|
|
||||||
c2->snext = c2s;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
togglemax(Client *c) {
|
togglemax(Client *c) {
|
||||||
XEvent ev;
|
XEvent ev;
|
||||||
@ -72,15 +34,6 @@ togglemax(Client *c) {
|
|||||||
while(XCheckMaskEvent(dpy, EnterWindowMask, &ev));
|
while(XCheckMaskEvent(dpy, EnterWindowMask, &ev));
|
||||||
}
|
}
|
||||||
|
|
||||||
static Client *
|
|
||||||
topofstack() {
|
|
||||||
Client *c;
|
|
||||||
unsigned int i;
|
|
||||||
|
|
||||||
for(c = nexttiled(clients), i = 0; c && i < nmaster; c = nexttiled(c->next), i++);
|
|
||||||
return (i < nmaster) ? NULL : c;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* extern */
|
/* extern */
|
||||||
|
|
||||||
void (*arrange)(void) = DEFMODE;
|
void (*arrange)(void) = DEFMODE;
|
||||||
@ -308,19 +261,13 @@ zoom(Arg *arg) {
|
|||||||
n++;
|
n++;
|
||||||
|
|
||||||
c = sel;
|
c = sel;
|
||||||
if(arrange == dofloat)
|
if(arrange != dofloat) {
|
||||||
return;
|
detach(c);
|
||||||
else if(n <= nmaster)
|
if(clients)
|
||||||
pop(c);
|
clients->prev = c;
|
||||||
else if(ismaster(sel)) {
|
c->next = clients;
|
||||||
if(!(c = topofstack()))
|
clients = c;
|
||||||
return;
|
focus(c);
|
||||||
swap(c, sel);
|
arrange();
|
||||||
c = sel;
|
|
||||||
}
|
}
|
||||||
else
|
|
||||||
pop(c);
|
|
||||||
|
|
||||||
focus(c);
|
|
||||||
arrange();
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user