Thanks Peter, I applied your fix.

Regards,
        Anselm

On Tue, Sep 18, 2007 at 11:42:55PM +0200, Peter Hartlich wrote:
> Hi,
> 
> I might have added that I've been using the togglemax patch for several
> months now without any issues.
> 
> That aside, there's some code of the form
> 
> | if(!p && !q)
> |     x
> | else
> |     y
> 
> rewritable as
> 
> | if(p || q)
> |     y
> | else
> |     x
> 
> and two occurences of "if (" as opposed to "if(" (one of which from my patch,
> sorry). Attached is a trivial patch in case you want to bother.
> 
> Regards,
> Peter

> diff -rup dwm~/dwm.c dwm/dwm.c
> --- dwm~/dwm.c        2007-09-18 20:25:23.000000000 +0200
> +++ dwm/dwm.c 2007-09-18 23:32:23.000000000 +0200
> @@ -334,10 +334,10 @@ buttonpress(XEvent *e) {
>               if(CLEANMASK(ev->state) != MODKEY)
>                       return;
>               if(ev->button == Button1) {
> -                     if(!isarrange(floating) && !c->isfloating)
> -                             togglefloating(NULL);
> -                     else
> +                     if(isarrange(floating) || c->isfloating)
>                               restack();
> +                     else
> +                             togglefloating(NULL);
>                       movemouse(c);
>               }
>               else if(ev->button == Button2) {
> @@ -347,10 +347,10 @@ buttonpress(XEvent *e) {
>                               zoom(NULL);
>               }
>               else if(ev->button == Button3 && !c->isfixed) {
> -                     if(!isarrange(floating) && !c->isfloating)
> -                             togglefloating(NULL);
> -                     else
> +                     if(isarrange(floating) || c->isfloating)
>                               restack();
> +                     else
> +                             togglefloating(NULL);
>                       resizemouse(c);
>               }
>       }
> @@ -444,7 +444,7 @@ void
>  configurenotify(XEvent *e) {
>       XConfigureEvent *ev = &e->xconfigure;
>  
> -     if (ev->window == root && (ev->width != sw || ev->height != sh)) {
> +     if(ev->window == root && (ev->width != sw || ev->height != sh)) {
>               sw = ev->width;
>               sh = ev->height;
>               XFreePixmap(dpy, dc.drawable);
> @@ -1404,10 +1404,10 @@ setmwfact(const char *arg) {
>       if(arg == NULL)
>               mwfact = MWFACT;
>       else if(1 == sscanf(arg, "%lf", &delta)) {
> -             if(arg[0] != '+' && arg[0] != '-')
> -                     mwfact = delta;
> -             else
> +             if(arg[0] == '+' || arg[0] == '-')
>                       mwfact += delta;
> +             else
> +                     mwfact = delta;
>               if(mwfact < 0.1)
>                       mwfact = 0.1;
>               else if(mwfact > 0.9)
> @@ -1644,7 +1644,7 @@ togglemax(const char *arg) {
>       }
>       else {
>               resize(sel, sel->rx, sel->ry, sel->rw, sel->rh, True);
> -             if (!sel->wasfloating)
> +             if(!sel->wasfloating)
>                       togglefloating(NULL);
>       }
>       drawbar();


-- 
 Anselm R. Garbe >< http://www.suckless.org/ >< GPG key: 0D73F361

Reply via email to