Re: [dwm] Re: pertag patch

From: daniel fusser <daniel.fusser_AT_googlemail.com>
Date: Sat, 3 Jan 2009 15:26:42 +0100

2009/1/3 henry atting <nspm_01_AT_literaturlatenight.de>

> On Fr, Jan 02 2009, v4hn wrote:
>
> dwm.c:1743: error: redefinition of 'viewnext'
> dwm.c:1709: error: previous definition of 'viewnext' was here
> dwm.c:1760: error: redefinition of 'viewprevious'
> dwm.c:1726: error: previous definition of 'viewprevious' was here
> make: *** [dwm.o] Fehler 1
>
> As far as I see I have to decide for either the pertag or the arrownav
> patch, so I decided for the latter.
>
> Thanks
> henry
>
>
>
Hi,

I had the same problem some time ago but i managed to make them both work.

I removed the pertag variables in dwm.c and put them into my config.h where
I also put the viewnext() and viewprevious() functions. These two functions
have to be modified as well to make them work with the pertag patch
otherwise the values won't get stored when the function is called (which
means if you use the arrowkeys to change tags the pertag patch stuff has no
effect).

I can't remember what exactly caused the redefiniton errors but it works for
me this way...

It looks like this:

config.h
-------------

static int curtag = 1, prevtag = 1;
static Layout *lts[LENGTH(tags) + 1];
static double mfacts[LENGTH(tags) + 1];
static Bool showbars[LENGTH(tags) + 1];

static void viewnext(const Arg *arg);
static void viewprevious(const Arg *arg);

void
viewnext(const Arg *arg) {
    unsigned int i, j;

    for(i = 0; i < LENGTH(tags); i++) {
        if((1 << i & TAGMASK) == tagset[seltags]) {
            seltags ^= 1;
            if(i == LENGTH(tags) - 1)
                tagset[seltags] = 1 << 0 & TAGMASK;
            else
                tagset[seltags] = 1 << (i + 1) & TAGMASK;
            break;
        }
    }
/* * pertag support * * * * * * * * * * * * * * * * * */
        if(i & TAGMASK){
        prevtag = curtag;
        if(i == ~0)
        curtag = 0;
        else {
            for (j=0; !(i & 1 << j); j++);
        curtag = j + 1;
        }
    } else {
        prevtag= curtag ^ prevtag;
        curtag^= prevtag;
    prevtag= curtag ^ prevtag;
    }
    lt[sellt]= lts[curtag];
    mfact = mfacts[curtag];
    if(showbar != showbars[curtag])
        togglebar(NULL);
/* * * * * * * * * * * * * * * * * * * * * * * * * */
    arrange();
}

void
viewprevious(const Arg *arg) {
    unsigned int i, j;

    for(i = 0; i < LENGTH(tags); i++) {
        if((1 << i & TAGMASK) == tagset[seltags]) {
            seltags ^= 1;
            if(i == 0)
                tagset[seltags] = 1 << (LENGTH(tags) - 1) & TAGMASK;
            else
                tagset[seltags] = 1 << (i - 1) & TAGMASK;
            break;
        }
    }
/* * pertag support * * * * * * * * * * * * * * * * * */
        if(i & TAGMASK){
        prevtag = curtag;
        if(i == ~0)
        curtag = 0;
        else {
            for (j=0; !(i & 1 << j); j++);
        curtag = j + 1;
        }
    } else {
        prevtag= curtag ^ prevtag;
        curtag^= prevtag;
        prevtag= curtag ^ prevtag;
    }
    lt[sellt]= lts[curtag];
    mfact = mfacts[curtag];
    if(showbar != showbars[curtag])
        togglebar(NULL);
/* * * * * * * * * * * * * * * * * * * * * * * * * */
     arrange();
 }

static Key keys[] = {
...
-------------
Received on Sat Jan 03 2009 - 14:26:42 UTC

This archive was generated by hypermail 2.2.0 : Sat Jan 03 2009 - 14:36:04 UTC