X-Git-Url: https://jasonwoof.com/gitweb/?p=dwm.git;a=blobdiff_plain;f=dwm.c;h=5df912bbb5ac07c3a10f9e9761a960b8fbb66dc5;hp=f6cec0b22ec61b7be08a5a12b541bcf93f5c94e7;hb=d83454f6b7bcc982ab52b61aac564369ac8994e6;hpb=d384cee751a2d23220df45c3c34dab5567c0594f diff --git a/dwm.c b/dwm.c index f6cec0b..5df912b 100644 --- a/dwm.c +++ b/dwm.c @@ -42,7 +42,7 @@ /* macros */ #define BUTTONMASK (ButtonPressMask|ButtonReleaseMask) -#define CLEANMASK(mask) (mask & ~(numlockmask|LockMask)) +#define CLEANMASK(mask) (mask & ~(numlockmask|LockMask) & (ShiftMask|ControlMask|Mod1Mask|Mod2Mask|Mod3Mask|Mod4Mask|Mod5Mask)) #define INRECT(X,Y,RX,RY,RW,RH) ((X) >= (RX) && (X) < (RX) + (RW) && (Y) >= (RY) && (Y) < (RY) + (RH)) #define ISVISIBLE(C) ((C->tags & C->mon->tagset[C->mon->seltags])) #define LENGTH(X) (sizeof X / sizeof X[0]) @@ -389,7 +389,6 @@ arrange(Monitor *m) { showhide(m->stack); else for(m = mons; m; m = m->next) showhide(m->stack); - focus(NULL); if(m) arrangemon(m); else for(m = mons; m; m = m->next) @@ -442,7 +441,7 @@ buttonpress(XEvent *e) { } else if(ev->x < x + blw) click = ClkLtSymbol; - else if(ev->x > selmon->wx + selmon->ww - TEXTW(stext)) + else if(ev->x > selmon->ww - TEXTW(stext)) click = ClkStatusText; else click = ClkWinTitle; @@ -529,7 +528,7 @@ clientmessage(XEvent *e) { if(!c) return; if(cme->message_type == netatom[NetWMState] && cme->data.l[1] == netatom[NetWMFullscreen]) { - if(cme->data.l[0]) { + if(cme->data.l[0] && !c->isfullscreen) { XChangeProperty(dpy, cme->window, netatom[NetWMState], XA_ATOM, 32, PropModeReplace, (unsigned char*)&netatom[NetWMFullscreen], 1); c->isfullscreen = True; @@ -585,17 +584,20 @@ void configurenotify(XEvent *e) { Monitor *m; XConfigureEvent *ev = &e->xconfigure; + Bool dirty; if(ev->window == root) { + dirty = (sw != ev->width); sw = ev->width; sh = ev->height; - if(updategeom()) { + if(updategeom() || dirty) { if(dc.drawable != 0) XFreePixmap(dpy, dc.drawable); dc.drawable = XCreatePixmap(dpy, root, sw, bh, DefaultDepth(dpy, screen)); updatebars(); for(m = mons; m; m = m->next) XMoveResizeWindow(dpy, m->barwin, m->wx, m->by, m->ww, bh); + focus(NULL); arrange(NULL); } } @@ -818,15 +820,19 @@ drawtext(const char *text, unsigned long col[ColLast], Bool invert) { void enternotify(XEvent *e) { + Client *c; Monitor *m; XCrossingEvent *ev = &e->xcrossing; if((ev->mode != NotifyNormal || ev->detail == NotifyInferior) && ev->window != root) return; + c = wintoclient(ev->window); if((m = wintomon(ev->window)) && m != selmon) { unfocus(selmon->sel, True); selmon = m; } + else if(c == selmon->sel || c == NULL) + return; focus((wintoclient(ev->window))); } @@ -1143,9 +1149,10 @@ manage(Window w, XWindowAttributes *wa) { attach(c); attachstack(c); XMoveResizeWindow(dpy, c->win, c->x + 2 * sw, c->y, c->w, c->h); /* some windows require this */ - XMapWindow(dpy, c->win); setclientstate(c, NormalState); arrange(c->mon); + XMapWindow(dpy, c->win); + focus(c); } void @@ -1610,6 +1617,7 @@ void tag(const Arg *arg) { if(selmon->sel && arg->ui & TAGMASK) { selmon->sel->tags = arg->ui & TAGMASK; + focus(NULL); arrange(selmon); } } @@ -1690,6 +1698,7 @@ toggletag(const Arg *arg) { newtags = selmon->sel->tags ^ (arg->ui & TAGMASK); if(newtags) { selmon->sel->tags = newtags; + focus(NULL); arrange(selmon); } } @@ -1700,6 +1709,7 @@ toggleview(const Arg *arg) { if(newtagset) { selmon->tagset[selmon->seltags] = newtagset; + focus(NULL); arrange(selmon); } } @@ -1965,6 +1975,7 @@ view(const Arg *arg) { selmon->seltags ^= 1; /* toggle sel tagset */ if(arg->ui & TAGMASK) selmon->tagset[selmon->seltags] = arg->ui & TAGMASK; + focus(NULL); arrange(selmon); } @@ -2034,7 +2045,6 @@ zoom(const Arg *arg) { Client *c = selmon->sel; if(!selmon->lt[selmon->sellt]->arrange - || selmon->lt[selmon->sellt]->arrange == monocle || (selmon->sel && selmon->sel->isfloating)) return; if(c == nexttiled(selmon->clients))