summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnselm R Garbe <anselm@garbe.us>2009-06-20 15:51:34 +0100
committerAnselm R Garbe <anselm@garbe.us>2009-06-20 15:51:34 +0100
commit3da24539976b4474862415606f641d0f69336729 (patch)
tree22abfe616f488d2c07a813b4dafaa16281909389
parentexperimental xinerama support, two new actions, Mod1-w/e and Mod1-Shift-w/e (diff)
downloaddwm-3da24539976b4474862415606f641d0f69336729.tar.gz
dwm-3da24539976b4474862415606f641d0f69336729.zip
several fixes through ISVISIBLE change (takes Monitor into account)
-rw-r--r--dwm.c38
1 files changed, 20 insertions, 18 deletions
diff --git a/dwm.c b/dwm.c
index 0e8c927..6084123 100644
--- a/dwm.c
+++ b/dwm.c
@@ -44,8 +44,8 @@
44#define BUTTONMASK (ButtonPressMask|ButtonReleaseMask) 44#define BUTTONMASK (ButtonPressMask|ButtonReleaseMask)
45#define CLEANMASK(mask) (mask & ~(numlockmask|LockMask)) 45#define CLEANMASK(mask) (mask & ~(numlockmask|LockMask))
46#define INRECT(X,Y,RX,RY,RW,RH) ((X) >= (RX) && (X) < (RX) + (RW) && (Y) >= (RY) && (Y) < (RY) + (RH)) 46#define INRECT(X,Y,RX,RY,RW,RH) ((X) >= (RX) && (X) < (RX) + (RW) && (Y) >= (RY) && (Y) < (RY) + (RH))
47#define ISVISIBLE(x) (x->tags & tagset[mon[x->mon].seltags]) 47#define ISVISIBLE(M, C) ((M) == (&mon[C->mon]) && (C->tags & tagset[M->seltags]))
48#define LENGTH(x) (sizeof x / sizeof x[0]) 48#define LENGTH(X) (sizeof X / sizeof X[0])
49#define MAX(a, b) ((a) > (b) ? (a) : (b)) 49#define MAX(a, b) ((a) > (b) ? (a) : (b))
50#define MIN(a, b) ((a) < (b) ? (a) : (b)) 50#define MIN(a, b) ((a) < (b) ? (a) : (b))
51#define MOUSEMASK (BUTTONMASK|PointerMotionMask) 51#define MOUSEMASK (BUTTONMASK|PointerMotionMask)
@@ -493,7 +493,7 @@ configurenotify(XEvent *e) {
493 updategeom(); 493 updategeom();
494 if(dc.drawable != 0) 494 if(dc.drawable != 0)
495 XFreePixmap(dpy, dc.drawable); 495 XFreePixmap(dpy, dc.drawable);
496 dc.drawable = XCreatePixmap(dpy, root, DisplayWidth(dpy, screen), bh, DefaultDepth(dpy, screen)); 496 dc.drawable = XCreatePixmap(dpy, root, sw, bh, DefaultDepth(dpy, screen));
497 for(i = 0; i < nmons; i++) 497 for(i = 0; i < nmons; i++)
498 XMoveResizeWindow(dpy, mon[i].barwin, mon[i].wx, mon[i].by, mon[i].ww, bh); 498 XMoveResizeWindow(dpy, mon[i].barwin, mon[i].wx, mon[i].by, mon[i].ww, bh);
499 arrange(); 499 arrange();
@@ -524,7 +524,7 @@ configurerequest(XEvent *e) {
524 c->y = sy + (sh / 2 - c->h / 2); /* center in y direction */ 524 c->y = sy + (sh / 2 - c->h / 2); /* center in y direction */
525 if((ev->value_mask & (CWX|CWY)) && !(ev->value_mask & (CWWidth|CWHeight))) 525 if((ev->value_mask & (CWX|CWY)) && !(ev->value_mask & (CWWidth|CWHeight)))
526 configure(c); 526 configure(c);
527 if(ISVISIBLE(c)) 527 if(ISVISIBLE((&mon[c->mon]), c))
528 XMoveResizeWindow(dpy, c->win, c->x, c->y, c->w, c->h); 528 XMoveResizeWindow(dpy, c->win, c->x, c->y, c->w, c->h);
529 } 529 }
530 else 530 else
@@ -636,6 +636,7 @@ drawbar(Monitor *m) {
636 } 636 }
637 } 637 }
638 else { 638 else {
639 dc.x = x;
639 dc.w = m->ww - x; 640 dc.w = m->ww - x;
640 drawtext(NULL, dc.norm, False); 641 drawtext(NULL, dc.norm, False);
641 } 642 }
@@ -718,17 +719,18 @@ expose(XEvent *e) {
718 unsigned int i; 719 unsigned int i;
719 XExposeEvent *ev = &e->xexpose; 720 XExposeEvent *ev = &e->xexpose;
720 721
721 for(i = 0; i < nmons; i++) 722 if(ev->count == 0)
722 if(ev->count == 0 && (ev->window == mon[i].barwin)) { 723 for(i = 0; i < nmons; i++)
723 drawbar(&mon[i]); 724 if(ev->window == mon[i].barwin) {
724 break; 725 drawbar(&mon[i]);
725 } 726 break;
727 }
726} 728}
727 729
728void 730void
729focus(Client *c) { 731focus(Client *c) {
730 if(!c || !ISVISIBLE(c)) 732 if(!c || !ISVISIBLE((&mon[c->mon]), c))
731 for(c = stack; c && !ISVISIBLE(c); c = c->snext); 733 for(c = stack; c && !ISVISIBLE(selmon, c); c = c->snext);
732 if(sel && sel != c) { 734 if(sel && sel != c) {
733 grabbuttons(sel, False); 735 grabbuttons(sel, False);
734 XSetWindowBorder(dpy, sel->win, dc.norm[ColBorder]); 736 XSetWindowBorder(dpy, sel->win, dc.norm[ColBorder]);
@@ -776,17 +778,17 @@ focusstack(const Arg *arg) {
776 if(!sel) 778 if(!sel)
777 return; 779 return;
778 if(arg->i > 0) { 780 if(arg->i > 0) {
779 for(c = sel->next; c && !ISVISIBLE(c); c = c->next); 781 for(c = sel->next; c && !ISVISIBLE(selmon, c); c = c->next);
780 if(!c) 782 if(!c)
781 for(c = clients; c && !ISVISIBLE(c); c = c->next); 783 for(c = clients; c && !ISVISIBLE(selmon, c); c = c->next);
782 } 784 }
783 else { 785 else {
784 for(i = clients; i != sel; i = i->next) 786 for(i = clients; i != sel; i = i->next)
785 if(ISVISIBLE(i)) 787 if(ISVISIBLE(selmon, i))
786 c = i; 788 c = i;
787 if(!c) 789 if(!c)
788 for(; i; i = i->next) 790 for(; i; i = i->next)
789 if(ISVISIBLE(i)) 791 if(ISVISIBLE(selmon, i))
790 c = i; 792 c = i;
791 } 793 }
792 if(c) { 794 if(c) {
@@ -1126,7 +1128,7 @@ movemouse(const Arg *arg) {
1126Client * 1128Client *
1127nexttiled(Monitor *m, Client *c) { 1129nexttiled(Monitor *m, Client *c) {
1128 // TODO: m handling 1130 // TODO: m handling
1129 for(; c && (c->isfloating || m != &mon[c->mon] || !ISVISIBLE(c)); c = c->next); 1131 for(; c && (c->isfloating || !ISVISIBLE(m, c)); c = c->next);
1130 return c; 1132 return c;
1131} 1133}
1132 1134
@@ -1246,7 +1248,7 @@ restack(Monitor *m) {
1246 wc.stack_mode = Below; 1248 wc.stack_mode = Below;
1247 wc.sibling = m->barwin; 1249 wc.sibling = m->barwin;
1248 for(c = stack; c; c = c->snext) 1250 for(c = stack; c; c = c->snext)
1249 if(!c->isfloating && m == &mon[c->mon] && ISVISIBLE(c)) { 1251 if(!c->isfloating && ISVISIBLE(m, c)) {
1250 XConfigureWindow(dpy, c->win, CWSibling|CWStackMode, &wc); 1252 XConfigureWindow(dpy, c->win, CWSibling|CWStackMode, &wc);
1251 wc.sibling = c->win; 1253 wc.sibling = c->win;
1252 } 1254 }
@@ -1408,7 +1410,7 @@ void
1408showhide(Client *c) { 1410showhide(Client *c) {
1409 if(!c) 1411 if(!c)
1410 return; 1412 return;
1411 if(ISVISIBLE(c)) { /* show clients top down */ 1413 if(ISVISIBLE((&mon[c->mon]), c)) { /* show clients top down */
1412 XMoveWindow(dpy, c->win, c->x, c->y); 1414 XMoveWindow(dpy, c->win, c->x, c->y);
1413 if(!lt[selmon->sellt]->arrange || c->isfloating) 1415 if(!lt[selmon->sellt]->arrange || c->isfloating)
1414 resize(c, c->x, c->y, c->w, c->h); 1416 resize(c, c->x, c->y, c->w, c->h);