mirror of
https://github.com/0intro/wmii
synced 2025-02-23 17:55:13 +03:00
made increment handling the default, no option to disable it, instead columns do some relaxing calculation to minimize increment-related gaps
This commit is contained in:
parent
393eb4c87a
commit
01572b1897
@ -14,6 +14,7 @@ colmode2str(ColumnMode mode)
|
||||
switch(mode) {
|
||||
case COL_EQUAL: return "equal"; break;
|
||||
case COL_STACK: return "stack"; break;
|
||||
case COL_MAX: return "max"; break;
|
||||
default: break;
|
||||
}
|
||||
return nil;
|
||||
@ -26,6 +27,8 @@ str2colmode(char *arg)
|
||||
return COL_EQUAL;
|
||||
else if(!strncmp("stack", arg, 6))
|
||||
return COL_STACK;
|
||||
else if(!strncmp("max", arg, 4))
|
||||
return COL_STACK;
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -33,7 +36,7 @@ void
|
||||
arrange_column(Area *col)
|
||||
{
|
||||
unsigned int i, yoff;
|
||||
unsigned int h;
|
||||
unsigned int h, w, hdiff, wdiff;
|
||||
|
||||
if(!col->nclient)
|
||||
return;
|
||||
@ -69,9 +72,38 @@ arrange_column(Area *col)
|
||||
resize_client(c, &c->frame.rect, 0);
|
||||
}
|
||||
break;
|
||||
case COL_MAX:
|
||||
for(i = 0; i < col->nclient; i++) {
|
||||
Client *c = col->client[i];
|
||||
c->frame.rect = col->rect;
|
||||
resize_client(c, &c->frame.rect, 0);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
/* some relaxing due to potential increment gaps */
|
||||
h = w = 0;
|
||||
for(i = 0; i < col->nclient; i++) {
|
||||
h += col->client[i]->frame.rect.height;
|
||||
if(w < col->client[i]->frame.rect.width)
|
||||
w = col->client[i]->frame.rect.width;
|
||||
}
|
||||
if(col->mode == COL_MAX)
|
||||
h = col->client[i]->frame.rect.height;
|
||||
hdiff = (col->rect.height - h) / col->nclient;
|
||||
wdiff = (col->rect.width - w) / 2;
|
||||
|
||||
yoff = col->rect.y + hdiff / 2;
|
||||
for(i = 0; i < col->nclient; i++) {
|
||||
Client *c = col->client[i];
|
||||
c->frame.rect.x += wdiff;
|
||||
c->frame.rect.y = yoff;
|
||||
yoff = c->frame.rect.y + c->frame.rect.height + hdiff;
|
||||
XMoveWindow(dpy, col->client[i]->frame.win, col->client[i]->frame.rect.x,
|
||||
col->client[i]->frame.rect.y);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
|
26
cmd/wm/fs.c
26
cmd/wm/fs.c
@ -35,7 +35,6 @@ static char Enocommand[] = "command not supported";
|
||||
* /def/ Ddef
|
||||
* /def/border Fborder 0..n
|
||||
* /def/snap Fsnap 0..n
|
||||
* /def/inc Finc 0..n
|
||||
* /def/font Ffont xlib font name
|
||||
* /def/selcolors Fselcolors sel color
|
||||
* /def/normcolors Fnormcolors normal colors
|
||||
@ -193,7 +192,6 @@ qid2name(Qid *qid)
|
||||
case Fctl: return "ctl"; break;
|
||||
case Fborder: return "border"; break;
|
||||
case Fsnap: return "border"; break;
|
||||
case Finc: return "inc"; break;
|
||||
case Fgeom: return "geometry"; break;
|
||||
case Fname: return "name"; break;
|
||||
case Fmax: return "max"; break;
|
||||
@ -233,8 +231,6 @@ name2type(char *name, unsigned char dir_type)
|
||||
return Fname;
|
||||
if(!strncmp(name, "border", 7))
|
||||
return Fborder;
|
||||
if(!strncmp(name, "inc", 4))
|
||||
return Finc;
|
||||
if(!strncmp(name, "geometry", 9))
|
||||
return Fgeom;
|
||||
if(!strncmp(name, "expand", 7))
|
||||
@ -556,10 +552,6 @@ type2stat(Stat *stat, char *wname, Qid *dir)
|
||||
snprintf(buf, sizeof(buf), "%d", def.border);
|
||||
return mkstat(stat, dir, wname, strlen(buf), DMREAD | DMWRITE);
|
||||
break;
|
||||
case Finc:
|
||||
snprintf(buf, sizeof(buf), "%d", def.inc);
|
||||
return mkstat(stat, dir, wname, strlen(buf), DMREAD | DMWRITE);
|
||||
break;
|
||||
case Fgeom:
|
||||
c = page[dir_i1]->area[dir_i2]->client[dir_i3];
|
||||
snprintf(buf, sizeof(buf), "%d %d %d %d", c->frame.rect.x, c->frame.rect.y,
|
||||
@ -870,8 +862,6 @@ xread(IXPConn *c, Fcall *fcall)
|
||||
case Ddef:
|
||||
fcall->count += type2stat(&stat, "border", &m->qid);
|
||||
p = ixp_enc_stat(p, &stat);
|
||||
fcall->count += type2stat(&stat, "inc", &m->qid);
|
||||
p = ixp_enc_stat(p, &stat);
|
||||
fcall->count += type2stat(&stat, "snap", &m->qid);
|
||||
p = ixp_enc_stat(p, &stat);
|
||||
fcall->count += type2stat(&stat, "selcolors", &m->qid);
|
||||
@ -942,11 +932,6 @@ xread(IXPConn *c, Fcall *fcall)
|
||||
fcall->count = strlen(buf);
|
||||
memcpy(p, buf, fcall->count);
|
||||
break;
|
||||
case Finc:
|
||||
snprintf(buf, sizeof(buf), "%u", def.inc);
|
||||
fcall->count = strlen(buf);
|
||||
memcpy(p, buf, fcall->count);
|
||||
break;
|
||||
case Fgeom:
|
||||
client = page[i1]->area[i2]->client[i3];
|
||||
snprintf(buf, sizeof(buf), "%d %d %d %d", client->frame.rect.x, client->frame.rect.y,
|
||||
@ -1115,17 +1100,6 @@ xwrite(IXPConn *c, Fcall *fcall)
|
||||
def.border = i;
|
||||
resize_all_clients();
|
||||
break;
|
||||
case Finc:
|
||||
if(fcall->count > sizeof(buf))
|
||||
return "increment value out of range 0, 1";
|
||||
memcpy(buf, fcall->data, fcall->count);
|
||||
buf[fcall->count] = 0;
|
||||
i = cext_strtonum(buf, 0, 1, &err);
|
||||
if(err)
|
||||
return "increment value out of range 0, 1";
|
||||
def.inc = i;
|
||||
resize_all_clients();
|
||||
break;
|
||||
case Fgeom:
|
||||
cl = page[i1]->area[i2]->client[i3];
|
||||
if(fcall->count > sizeof(buf))
|
||||
|
@ -540,7 +540,6 @@ main(int argc, char *argv[])
|
||||
def.font = strdup(BLITZ_FONT);
|
||||
def.border = DEF_BORDER;
|
||||
def.snap = DEF_SNAP;
|
||||
def.inc = True;
|
||||
cext_strlcpy(def.selcolor, BLITZ_SELCOLORS, sizeof(def.selcolor));
|
||||
blitz_loadcolor(dpy, screen, def.selcolor, &def.sel);
|
||||
cext_strlcpy(def.normcolor, BLITZ_NORMCOLORS, sizeof(def.normcolor));
|
||||
|
@ -38,7 +38,6 @@ enum {
|
||||
Fborder,
|
||||
Fsnap,
|
||||
Fbar,
|
||||
Finc,
|
||||
Fgeom,
|
||||
Fevent,
|
||||
Fctl,
|
||||
@ -127,7 +126,6 @@ typedef struct {
|
||||
char selcolor[24];
|
||||
char normcolor[24];
|
||||
char *font;
|
||||
Bool inc;
|
||||
Color sel;
|
||||
Color norm;
|
||||
unsigned int border;
|
||||
|
Loading…
x
Reference in New Issue
Block a user