Hi, at the bottom of this e-mail is a modified version of dotile() from tag.c which fills a compile time constant number of stack columns (rather than the standard 1). On a normal display more than one column is crazy, but on a xinerama multiscreen setup it's one approach to making use of the extra space. (I suppose it might also be useful with one of them new-fangled widescreen monitors :-) )
Each stack column will have either floor(no clients/no columns) or ceil(no clients/no columns) entries, with each type containing equal height clients. The columns with fewer clients (& hence taller windows) will be placed next to the master column. It's basically as few changes from existing dotile as possible.
So its _not_ a patch submission for mainline, more a "in case it's useful to anyone" thing...
Not included as a proper diff because I'm still trying to think if this is really the best way to tile things for the "effective widescreen" you get with multiple monitors and if it is, how to minimise & properly format the code before proper "publication". The only change wrt the rest of the dwm code is that now
mw (which gets set from MASTERW in config.h) is now the width of a slave column; this simplifies making the master column absorb any spare pixels from rounding errors.
cheers, dave tweed
#define NO_SLAVE_COLS 3
void
dotile(Arg *arg)
{
int n, i, w;
Client *c;
w = sw - mw;
for(n = 0, c = clients; c; c = c->next)
if(c->tags[tsel] && !c->isfloat)
n++;
/* array offset by 1 to ease doing cumulative stuff */
int noPerCol[NO_SLAVE_COLS+1],heights[NO_SLAVE_COLS+1];
noPerCol[0]=1;
if(n-1<NO_SLAVE_COLS){
/*if we don't have enough clients, just make each one full column*/
for(i=1;i<NO_SLAVE_COLS;++i){
noPerCol[i]=i+1;
heights[i]=sh-bh;
}
}else{
int noLongCols=(n-1)%NO_SLAVE_COLS;
for(i=1;i<=NO_SLAVE_COLS;++i){
/* put the columns with more entries away from master column */
noPerCol[i]=(n-1)/NO_SLAVE_COLS;
if(i>NO_SLAVE_COLS-noLongCols){ /* long column */
noPerCol[i]+=1;
}
heights[i]=(sh - bh) / noPerCol[i];
/* convert into cumulative total of when new column begins */
noPerCol[i]+=noPerCol[i-1];
}
}
/* stop rounding down errors accumulating */
int mainColWid=sw-sx-NO_SLAVE_COLS*mw;
int colNo=1,cumHgt=sy+bh;
for(i = 0, c = clients; c; c = c->next) {
c->ismax = False;
if(c->tags[tsel]) {
if(c->isfloat) {
higher(c);
resize(c, True, TopLeft);
continue;
}
if(n<NO_SLAVE_COLS+1) {
c->x = sx+(i*sw)/n;
c->y = sy + bh;
c->w = sw/n - 2;
c->h = sh - 2 - bh;
}
else if(i == 0) { /*master column */
c->x = sx;
c->y = sy + bh;
c->w = mainColWid - 2;
c->h = sh - 2 - bh;
}
else if(heights[colNo] > bh) {
if(i==noPerCol[colNo]){ /* this client starts a new column */
++colNo;
cumHgt=sy+bh;
}
c->x = sx + mainColWid+(colNo-1)*mw;
c->y = cumHgt;
c->w = mw - 2;
c->h = heights[colNo] - 2;
cumHgt+=heights[colNo];
}
else { /* fallback if heights[colNo] < bh */
c->x = sx + mw;
c->y = sy + bh;
c->w = w - 2;
c->h = sh - 2 - bh;
}
resize(c, False, TopLeft);
i++;
}
else
ban(c);
}
if((sel = getnext(clients))) {
higher(sel);
focus(sel);
}
else
XSetInputFocus(dpy, root, RevertToPointerRoot, CurrentTime);
drawall();
}
Received on Sat Aug 12 2006 - 18:53:45 UTC
This archive was generated by hypermail 2.2.0 : Sun Jul 13 2008 - 14:30:07 UTC