Re: [dwm] found a nice way to do the setgeom stuff

From: Anselm R. Garbe <arg_AT_suckless.org>
Date: Wed, 19 Mar 2008 12:42:13 +0100

On Wed, Mar 19, 2008 at 11:04:35AM +0100, Szabolcs Nagy wrote:
> On 3/19/08, Anselm R. Garbe <arg_AT_suckless.org> wrote:
> > The problem is:
> >
> > void
> > configurenotify(XEvent *e) {
> > XConfigureEvent *ev = &e->xconfigure;
> >
> > if(ev->window == root && (ev->width != sw || ev->height != sh)) {
> > sw = ev->width;
> > sh = ev->height;
> > setgeom(NULL);
> > }
> > }
> >
> > This event handler is invoked whenever X changes the screen
> > resolution dynamically. So for the case of
> > shrinkmaster/growmaster being the current geometry this means,
> > that the master area will shrink/grow whenever the
> > screen resolution is changed dynamically.
>
> what's wrong with
>
> void growm(const char *arg) {
> mw += 20;
> }

Well, it's not very general. If you use bottom stack, then
growm() should touch mh, th and ty instead. With DEFGEOM this is
possible already. Having a growm() function like your proposal
is too limited in my opinion.

The only way I can think of is a revival of mfact, which
is the 0.55 by default. Then we could have

in config.h:

double mfact = 0.55;
DEFGEOM ...

in dwm.c:

void
setmfact(const char *arg) {
        double delta;

        if(!arg)
                return;
        delta = strtod(arg, NULL);
        if(arg[0] = '-' || arg[0] == '+') {
                if(mfact + delta < 0.1 || mfact + delta > 0.9)
                        return;
                mfact += delta;
        }
        else {
                if(delta < 0.1 || delta > 0.9)
                        return;
                mfact = delta;
        }
        arrange();
}

Though I'm not sure if we really need this, because there having
2 different geoms with different master area dimensions should
fit well and work already using the DEFGEOM approach.

Kind regards,

-- 
 Anselm R. Garbe >< http://www.suckless.org/ >< GPG key: 0D73F361
Received on Wed Mar 19 2008 - 12:42:13 UTC

This archive was generated by hypermail 2.2.0 : Sun Jul 13 2008 - 15:27:23 UTC