Re: [dwm] Re: pertag patch

2009-01-03 Thread daniel fusser
2009/1/3 henry atting nspm...@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[] = {
...
-


[dwm] Re: pertag patch

2009-01-03 Thread henry atting
On Sa, Jan 03 2009, daniel fusser wrote:

 2009/1/3 henry atting nspm...@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...

Unfortunately it does not work for me, dwm crashes when switching to
another tag. But anyway it's a good start, thanks, I will further look
into it when I have a little more time.

henry