2008/4/20, Premysl Hruby <[EMAIL PROTECTED]>: > On (20/04/08 21:49), yy wrote: > > To: dynamic window manager <[email protected]> > > From: yy <[EMAIL PROTECTED]> > > Subject: Re: [dwm] Yet another simplification, this time sel/prevtags > > Reply-To: dynamic window manager <[email protected]> > > List-Id: dynamic window manager <dwm.suckless.org> > > > > > I like this change, good work Premysl! But once you are using the > > array, you don't need seltags any more. The attached patch saves 2 or > > 3 loc. It also includes the functionality of my patch to see prevtags, > > but if you do the XOR inside memcpy you can save another line of code. > > I have also changed a little your notation (because I don't like > > underscores in variable names), but maybe you can think of better > > names. > > I think I will like dwm 5.0... > > > > > > > > Hi > > - if(memcmp(seltags, tmp, TAGSZ) != 0) { > - seltags = viewtags[viewtags_set ^= 1]; /* toggle tagset */ > - memcpy(seltags, tmp, TAGSZ); > - arrange(); > - } > + seltags ^= 1; /* toggle sel tagset */ > + if(memcmp(tagset[seltags ^ 1], tmp, TAGSZ) != 0) > + memcpy(tagset[seltags], tmp, TAGSZ); > + arrange(); > > This doesn't do same thing, as seltags is always toggled, even if > current and new tagset are same. So this will broke that "change only if > differ" behaviour or I miss something? :) > > If we will throw away this behaviour, things can be even more simpler. > We then can substitute whole view with: > > void > view(const char *arg) { > seltags ^= 1; > memset(tagset[seltag], (NULL == arg), TAGSZ); > tagset[seltag][idxoftag(arg)] = True; > arrange(); > } > > (memset can be used, because tags are always only test if they are zero > or nonzero, so it doesn't matter that tagset[i][j] (because Bool is defined > as int) can be something like 0x01010101 on x86) > > -Ph >
The idea is to have the same behavior that with my patch from April 7th. I like to view the previous tags when there is no difference. This way you can temporally see one tag (or all of them) in a convenient way. To sum up, the behavior would be: "change if differ, else viewprevtag" Try it, please. This feature has become a must-have for me. If this is not desired you could do memcpy(tagset[seltags ^= 1], tmp, TAGSZ) and remove the seltags ^= 1; line. I tried to explain it in my previous message, I hope it is clearer now. -- - yiyus || JGL .
