X-Git-Url: https://jasonwoof.com/gitweb/?a=blobdiff_plain;f=dwm.c;h=a13f07b529870678cab06ec13175e7bcd66845ac;hb=bf76cefe47749f784d4ee3b7b71c1c86460e236b;hp=0691029e00b03e23397dacc73176819337ddfc35;hpb=2431ae7df7f654f6dbe5e923fadf703eaa4a7bf4;p=dwm.git diff --git a/dwm.c b/dwm.c index 0691029..a13f07b 100644 --- a/dwm.c +++ b/dwm.c @@ -94,6 +94,8 @@ struct Client { Client *next; Client *snext; Window win; + void *aux; + void (*freeaux)(void *); }; typedef struct { @@ -723,19 +725,18 @@ gettextprop(Window w, Atom atom, char *text, uint size) { void grabbuttons(Client *c, Bool focused) { - int i, j; - uint buttons[] = { Button1, Button2, Button3 }; - uint modifiers[] = { MODKEY, MODKEY|LockMask, MODKEY|numlockmask, MODKEY|numlockmask|LockMask }; + uint i, j; + uint modifiers[] = { 0, LockMask, numlockmask, numlockmask|LockMask }; XUngrabButton(dpy, AnyButton, AnyModifier, c->win); - if(focused) + if(focused) { for(i = 0; i < LENGTH(buttons); i++) - for(j = 0; j < LENGTH(modifiers); j++) - XGrabButton(dpy, buttons[i], modifiers[j], c->win, False, - BUTTONMASK, GrabModeAsync, GrabModeSync, None, None); - else + if(buttons[i].click == ClkClientWin) + for(j = 0; j < LENGTH(modifiers); j++) + XGrabButton(dpy, buttons[i].button, buttons[i].mask | modifiers[j], c->win, False, BUTTONMASK, GrabModeAsync, GrabModeSync, None, None); + } else XGrabButton(dpy, AnyButton, AnyModifier, c->win, False, - BUTTONMASK, GrabModeAsync, GrabModeSync, None, None); + BUTTONMASK, GrabModeAsync, GrabModeSync, None, None); } void @@ -1520,6 +1521,8 @@ unmanage(Client *c) { detachstack(c); if(sel == c) focus(NULL); + if(c->aux && c->freeaux) + c->freeaux(c->aux); XUngrabButton(dpy, AnyButton, AnyModifier, c->win); setclientstate(c, WithdrawnState); free(c); @@ -1643,6 +1646,8 @@ updatewmhints(Client *c) { void view(const Arg *arg) { + if(arg && (arg->i & TAGMASK) == tagset[seltags]) + return; seltags ^= 1; /* toggle sel tagset */ if(arg && (arg->ui & TAGMASK)) tagset[seltags] = arg->i & TAGMASK;