Re: [dwm] addtomwfact -> setmwfact proposal

From: Enno \ <gottox_AT_gmail.com>
Date: Fri, 17 Aug 2007 12:38:14 +0200

bloated :)

A smaller version:

diff -r 8b502be8b8e0 tile.c
--- a/tile.c Thu Aug 16 18:41:22 2007 +0200
+++ b/tile.c Fri Aug 17 12:36:56 2007 +0200
@@ -19,7 +19,9 @@ addtomwfact(const char *arg) {
        if(arg == NULL)
                mwfact = MWFACT;
        else if(1 == sscanf(arg, "%lf", &delta)) {
- if(delta + mwfact > 0.1 && delta + mwfact < 0.9)
+ if(arg[0] != '+' && arg[0] != '-')
+ mwfact = delta;
+ else if(delta + mwfact > 0.1 && delta + mwfact < 0.9)
                        mwfact += delta;
        }
        arrange();

2007/8/17, Jukka Salmi <j+dwm_AT_2007.salmi.ch>:
> Hi,
>
> what about renaming addtomwfact() to setmwfact() and allowing for
> mwfact to be set both relatively and abolutely? Sometimes I need a
> terminal window which has exactly 80 columns; that's where being able
> to set mwfact explicitly would be nice.
>
> The attached patch implements this minor change. The argument passed
> to setmwfact() is handled as follows:
>
> - If the first character is either '+' or '-', the value is added
> or subtracted from mwfact. This is the current behaviour of
> addtomwfact(), except that a plus sign is needed to incement mwfact.
>
> - If the first chararcter is neither '+' nor '-', mwfact is set to the
> value, no matter what the current mwfact value is.
>
> Furthermore, for large delta values mwfact currently doesn't come close
> to its limits (0.1, 0.9). The patch fixes this as well.
>
> It also prevents arrange() from being called if sscanf() fails
> (shouldn't happen, but...).
>
> Comments are welcome!
>
>
> Cheers, Jukka
>
> --
> bashian roulette:
> $ ((RANDOM%6)) || rm -rf ~
>
>

-- 
http://www.gnuffy.org - Real Community Distro
http://www.gnuffy.org/index.php/GnuEm - Gnuffy on Ipaq (Codename Peggy)
Received on Fri Aug 17 2007 - 12:38:16 UTC

This archive was generated by hypermail 2.2.0 : Sun Jul 13 2008 - 14:50:02 UTC