aboutsummaryrefslogtreecommitdiff
path: root/tag.c
diff options
context:
space:
mode:
authorAnselm R.Garbe <arg@10ksloc.org>2006-08-14 10:18:24 +0200
committerAnselm R.Garbe <arg@10ksloc.org>2006-08-14 10:18:24 +0200
commitd4b7a9a3735deeab639f28b5bb2f568e0dc49616 (patch)
tree9cff17d7a5d4fa2fe94b39d0d18d8d72c8429736 /tag.c
parent4d67199a4bb68e5377d2fece62a83fde66c92861 (diff)
downloaddwm-d4b7a9a3735deeab639f28b5bb2f568e0dc49616.tar.gz
dwm-d4b7a9a3735deeab639f28b5bb2f568e0dc49616.tar.bz2
dwm-d4b7a9a3735deeab639f28b5bb2f568e0dc49616.zip
implemented restack behavior (floats are on top in tiled mode)
Diffstat (limited to 'tag.c')
-rw-r--r--tag.c64
1 files changed, 54 insertions, 10 deletions
diff --git a/tag.c b/tag.c
index d27d91a..01979d5 100644
--- a/tag.c
+++ b/tag.c
@@ -58,18 +58,17 @@ dofloat(Arg *arg)
ban(c);
}
if((sel = getnext(clients))) {
- higher(sel);
focus(sel);
+ restack();
}
else
XSetInputFocus(dpy, root, RevertToPointerRoot, CurrentTime);
- drawall();
}
void
dotile(Arg *arg)
{
- int n, i, w, h;
+ int h, i, n, w;
Client *c;
w = sw - mw;
@@ -86,7 +85,6 @@ dotile(Arg *arg)
c->ismax = False;
if(isvisible(c)) {
if(c->isfloat) {
- higher(c);
resize(c, True, TopLeft);
continue;
}
@@ -123,13 +121,11 @@ dotile(Arg *arg)
else
ban(c);
}
- if((sel = getnext(clients))) {
- higher(sel);
+ if((sel = getnext(clients)))
focus(sel);
- }
else
XSetInputFocus(dpy, root, RevertToPointerRoot, CurrentTime);
- drawall();
+ restack();
}
Client *
@@ -200,6 +196,56 @@ replacetag(Arg *arg)
}
void
+restack()
+{
+ static unsigned int nwins = 0;
+ static Window *wins = NULL;
+ unsigned int f, fi, m, mi, n;
+ Client *c;
+ XEvent ev;
+
+ for(f = 0, m = 0, c = clients; c; c = c->next)
+ if(isvisible(c)) {
+ if(c->isfloat || arrange == dofloat)
+ f++;
+ else
+ m++;
+ }
+
+ n = 2 * (f + m);
+ if(nwins < n) {
+ nwins = n;
+ wins = erealloc(wins, nwins * sizeof(Window));
+ }
+
+ fi = 0;
+ mi = 2 * f;
+ if(sel->isfloat || arrange == dofloat) {
+ wins[fi++] = sel->title;
+ wins[fi++] = sel->win;
+ }
+ else {
+ wins[mi++] = sel->title;
+ wins[mi++] = sel->win;
+ }
+ for(c = clients; c; c = c->next)
+ if(isvisible(c) && c != sel) {
+ if(c->isfloat || arrange == dofloat) {
+ wins[fi++] = c->title;
+ wins[fi++] = c->win;
+ }
+ else {
+ wins[mi++] = c->title;
+ wins[mi++] = c->win;
+ }
+ }
+ XRestackWindows(dpy, wins, n);
+ drawall();
+ XSync(dpy, False);
+ while(XCheckMaskEvent(dpy, EnterWindowMask, &ev));
+}
+
+void
settags(Client *c)
{
char classinst[256];
@@ -248,7 +294,6 @@ view(Arg *arg)
seltag[i] = False;
seltag[arg->i] = True;
arrange(NULL);
- drawall();
}
void
@@ -261,5 +306,4 @@ toggleview(Arg *arg)
if(i == ntags)
seltag[arg->i] = True; /* cannot toggle last view */
arrange(NULL);
- drawall();
}