X-Git-Url: https://jasonwoof.com/gitweb/?a=blobdiff_plain;f=dwm.c;h=a13f07b529870678cab06ec13175e7bcd66845ac;hb=bf76cefe47749f784d4ee3b7b71c1c86460e236b;hp=b7e937dc3ff04cb7eaabcba97715da5bcacfef09;hpb=7f7c3140a9c0841e34fd8689dc5d46627c949147;p=dwm.git diff --git a/dwm.c b/dwm.c index b7e937d..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; @@ -1704,7 +1709,9 @@ main(int argc, char *argv[]) { else if(argc != 1) eprint("usage: dwm [-v]\n"); - setlocale(LC_CTYPE, ""); + if(!setlocale(LC_CTYPE, "") || !XSupportsLocale()) + fprintf(stderr, "warning: no locale support\n"); + if(!(dpy = XOpenDisplay(0))) eprint("dwm: cannot open display\n");