made arrange again like it was once

This commit is contained in:
Anselm R Garbe 2008-06-19 14:58:19 +01:00
parent 2bd46d1ce6
commit c2a916bf30
1 changed files with 15 additions and 15 deletions

30
dwm.c
View File

@ -53,6 +53,7 @@
#define MOUSEMASK (BUTTONMASK|PointerMotionMask) #define MOUSEMASK (BUTTONMASK|PointerMotionMask)
#define TAGMASK ((int)((1LL << LENGTH(tags)) - 1)) #define TAGMASK ((int)((1LL << LENGTH(tags)) - 1))
#define TEXTW(x) (textnw(x, strlen(x)) + dc.font.height) #define TEXTW(x) (textnw(x, strlen(x)) + dc.font.height)
#define ISVISIBLE(x) (x->tags & tagset[seltags])
/* enums */ /* enums */
enum { CurNormal, CurResize, CurMove, CurLast }; /* cursor */ enum { CurNormal, CurResize, CurMove, CurLast }; /* cursor */
@ -89,7 +90,7 @@ struct Client {
int basew, baseh, incw, inch, maxw, maxh, minw, minh; int basew, baseh, incw, inch, maxw, maxh, minw, minh;
int bw, oldbw; int bw, oldbw;
uint tags; uint tags;
Bool isbanned, isfixed, isfloating, isurgent; Bool isfixed, isfloating, isurgent;
Client *next; Client *next;
Client *snext; Client *snext;
Window win; Window win;
@ -273,14 +274,13 @@ arrange(void) {
Client *c; Client *c;
for(c = clients; c; c = c->next) for(c = clients; c; c = c->next)
if(c->tags & tagset[seltags]) { /* is visible */ if(ISVISIBLE(c)) {
c->isbanned = False; XMoveWindow(dpy, c->win, c->x, c->y);
if(!lt[sellt]->arrange || c->isfloating) if(!lt[sellt]->arrange || c->isfloating)
resize(c, c->x, c->y, c->w, c->h, True); resize(c, c->x, c->y, c->w, c->h, True);
} }
else if(!c->isbanned) { else {
XMoveWindow(dpy, c->win, c->x + 2 * sw, c->y); XMoveWindow(dpy, c->win, c->x + 2 * sw, c->y);
c->isbanned = True;
} }
focus(NULL); focus(NULL);
@ -428,7 +428,7 @@ configurerequest(XEvent *e) {
c->y = sy + (sh / 2 - c->h / 2); /* center in y direction */ c->y = sy + (sh / 2 - c->h / 2); /* center in y direction */
if((ev->value_mask & (CWX|CWY)) && !(ev->value_mask & (CWWidth|CWHeight))) if((ev->value_mask & (CWX|CWY)) && !(ev->value_mask & (CWWidth|CWHeight)))
configure(c); configure(c);
if(!c->isbanned) if(ISVISIBLE(c))
XMoveResizeWindow(dpy, c->win, c->x, c->y, c->w, c->h); XMoveResizeWindow(dpy, c->win, c->x, c->y, c->w, c->h);
} }
else else
@ -605,8 +605,8 @@ expose(XEvent *e) {
void void
focus(Client *c) { focus(Client *c) {
if(!c || c->isbanned) if(!c || !ISVISIBLE(c))
for(c = stack; c && c->isbanned; c = c->snext); for(c = stack; c && !ISVISIBLE(c); c = c->snext);
if(sel && sel != c) { if(sel && sel != c) {
grabbuttons(sel, False); grabbuttons(sel, False);
XSetWindowBorder(dpy, sel->win, dc.norm[ColBorder]); XSetWindowBorder(dpy, sel->win, dc.norm[ColBorder]);
@ -639,17 +639,17 @@ focusstack(const Arg *arg) {
if(!sel) if(!sel)
return; return;
if (arg->i > 0) { if (arg->i > 0) {
for(c = sel->next; c && c->isbanned; c = c->next); for(c = sel->next; c && !ISVISIBLE(c); c = c->next);
if(!c) if(!c)
for(c = clients; c && c->isbanned; c = c->next); for(c = clients; c && !ISVISIBLE(c); c = c->next);
} }
else { else {
for(i = clients; i != sel; i = i->next) for(i = clients; i != sel; i = i->next)
if (!i->isbanned) if(ISVISIBLE(i))
c = i; c = i;
if(!c) if(!c)
for(; i; i = i->next) for(; i; i = i->next)
if (!i->isbanned) if(ISVISIBLE(i))
c = i; c = i;
} }
if(c) { if(c) {
@ -1018,7 +1018,7 @@ movemouse(const Arg *arg) {
Client * Client *
nexttiled(Client *c) { nexttiled(Client *c) {
for(; c && (c->isfloating || c->isbanned); c = c->next); for(; c && (c->isfloating || !ISVISIBLE(c)); c = c->next);
return c; return c;
} }
@ -1113,7 +1113,7 @@ resize(Client *c, int x, int y, int w, int h, Bool sizehints) {
h = bh; h = bh;
if(w < bh) if(w < bh)
w = bh; w = bh;
if(!c->isbanned || c->x != x || c->y != y || c->w != w || c->h != h) { if(c->x != x || c->y != y || c->w != w || c->h != h) {
c->x = wc.x = x; c->x = wc.x = x;
c->y = wc.y = y; c->y = wc.y = y;
c->w = wc.width = w; c->w = wc.width = w;
@ -1189,7 +1189,7 @@ restack(void) {
wc.stack_mode = Below; wc.stack_mode = Below;
wc.sibling = barwin; wc.sibling = barwin;
for(c = stack; c; c = c->snext) for(c = stack; c; c = c->snext)
if(!c->isfloating && !c->isbanned) { if(!c->isfloating && ISVISIBLE(c)) {
XConfigureWindow(dpy, c->win, CWSibling|CWStackMode, &wc); XConfigureWindow(dpy, c->win, CWSibling|CWStackMode, &wc);
wc.sibling = c->win; wc.sibling = c->win;
} }