mirror of https://github.com/0intro/wmii
implemented /def/colwidth (takes 0 for default scaling, or a px value for a specific size, ie 500 seems fine for 1400x1050 screens)
This commit is contained in:
parent
391f88e730
commit
ca7547d056
|
@ -17,7 +17,14 @@ vector_of_areas(AreaVector *av)
|
|||
Area *
|
||||
create_area(View *v)
|
||||
{
|
||||
if(v->area.size >= 2 && v->area.size - 1 >= rect.width / MIN_COLWIDTH)
|
||||
unsigned int w;
|
||||
if(def.colw)
|
||||
w = def.colw;
|
||||
else if(v->area.size > 1)
|
||||
w = rect.width / v->area.size;
|
||||
else
|
||||
w = rect.width;
|
||||
if(v->area.size >= 2 && (v->area.size - 1) * MIN_COLWIDTH + w > rect.width)
|
||||
return nil;
|
||||
{
|
||||
static unsigned short id = 1;
|
||||
|
@ -28,7 +35,8 @@ create_area(View *v)
|
|||
a->rect.height = rect.height - brect.height;
|
||||
a->mode = def.colmode;
|
||||
if(v->area.size > 1)
|
||||
a->rect.width = rect.width / (v->area.size - 1);
|
||||
w *= 2;
|
||||
a->rect.width = w;
|
||||
cext_vattach(vector_of_areas(&v->area), a);
|
||||
v->sel = v->area.size - 1;
|
||||
return a;
|
||||
|
|
24
cmd/wm/fs.c
24
cmd/wm/fs.c
|
@ -188,6 +188,7 @@ qid2name(Qid *qid)
|
|||
case FsFselcolors: return "selcolors"; break;
|
||||
case FsFnormcolors: return "normcolors"; break;
|
||||
case FsFfont: return "font"; break;
|
||||
case FsFcolw: return "colwidth"; break;
|
||||
case FsFgrabmod: return "grabmod"; break;
|
||||
case FsFrules: return "rules"; break;
|
||||
case FsFkeys: return "keys"; break;
|
||||
|
@ -275,6 +276,8 @@ name2type(char *name, unsigned char dir_type)
|
|||
return FsFnormcolors;
|
||||
if(!strncmp(name, "font", 5))
|
||||
return FsFfont;
|
||||
if(!strncmp(name, "colwidth", 9))
|
||||
return FsFcolw;
|
||||
if(!strncmp(name, "grabmod", 8))
|
||||
return FsFgrabmod;
|
||||
if(!strncmp(name, "keys", 5))
|
||||
|
@ -428,6 +431,7 @@ mkqid(Qid *dir, char *wname, Qid *new)
|
|||
case FsFborder:
|
||||
case FsFgrabmod:
|
||||
case FsFfont:
|
||||
case FsFcolw:
|
||||
case FsFrules:
|
||||
case FsFselcolors:
|
||||
case FsFnormcolors:
|
||||
|
@ -575,6 +579,9 @@ type2stat(Stat *stat, char *wname, Qid *dir)
|
|||
case FsFrules:
|
||||
return mkstat(stat, dir, wname, def.rules ? strlen(def.rules) : 0, IXP_DMREAD | IXP_DMWRITE);
|
||||
break;
|
||||
case FsFcolw:
|
||||
snprintf(buf, sizeof(buf), "%d", def.colw);
|
||||
return mkstat(stat, dir, wname, strlen(buf), IXP_DMREAD | IXP_DMWRITE);
|
||||
case FsFfont:
|
||||
return mkstat(stat, dir, wname, strlen(def.font), IXP_DMREAD | IXP_DMWRITE);
|
||||
case FsFgrabmod:
|
||||
|
@ -993,6 +1000,8 @@ xread(IXPConn *c, Fcall *fcall)
|
|||
p = ixp_enc_stat(p, &stat);
|
||||
fcall->count += type2stat(&stat, "colmode", &m->qid);
|
||||
p = ixp_enc_stat(p, &stat);
|
||||
fcall->count += type2stat(&stat, "colwidth", &m->qid);
|
||||
p = ixp_enc_stat(p, &stat);
|
||||
break;
|
||||
case FsDview:
|
||||
if(view.size) {
|
||||
|
@ -1165,6 +1174,11 @@ xread(IXPConn *c, Fcall *fcall)
|
|||
if((fcall->count = strlen(def.grabmod)))
|
||||
memcpy(p, def.grabmod, fcall->count);
|
||||
break;
|
||||
case FsFcolw:
|
||||
snprintf(buf, sizeof(buf), "%d", def.colw);
|
||||
if((fcall->count = strlen(buf)))
|
||||
memcpy(p, buf, fcall->count);
|
||||
break;
|
||||
case FsFfont:
|
||||
if((fcall->count = strlen(def.font)))
|
||||
memcpy(p, def.font, fcall->count);
|
||||
|
@ -1390,6 +1404,16 @@ xwrite(IXPConn *c, Fcall *fcall)
|
|||
restack_view(view.data[sel]);
|
||||
}
|
||||
break;
|
||||
case FsFcolw:
|
||||
if(fcall->count > sizeof(buf))
|
||||
return Ebadvalue;
|
||||
memcpy(buf, fcall->data, fcall->count);
|
||||
buf[fcall->count] = 0;
|
||||
i = cext_strtonum(buf, MIN_COLWIDTH, rect.width - MIN_COLWIDTH, &err);
|
||||
if(err)
|
||||
return Ebadvalue;
|
||||
def.colw = i;
|
||||
break;
|
||||
case FsFfont:
|
||||
if(def.font)
|
||||
free(def.font);
|
||||
|
|
|
@ -205,8 +205,8 @@ do_mouse_move(Client *c)
|
|||
Window dummy;
|
||||
XEvent ev;
|
||||
/* borders */
|
||||
int snapw = rect.width * def.snap / 1000;
|
||||
int snaph = rect.height * def.snap / 1000;
|
||||
int snapw = (rect.width * def.snap) / 1000;
|
||||
int snaph = (rect.height * def.snap) / 1000;
|
||||
unsigned int num;
|
||||
unsigned int dmask;
|
||||
XRectangle *rects = rects_of_view(c->frame.data[c->sel]->area->view,
|
||||
|
@ -447,8 +447,8 @@ do_mouse_resize(Client *c, Align align)
|
|||
Window dummy;
|
||||
XEvent ev;
|
||||
/* borders */
|
||||
int snapw = rect.width * def.snap / 1000;
|
||||
int snaph = rect.height * def.snap / 1000;
|
||||
int snapw = (rect.width * def.snap) / 1000;
|
||||
int snaph = (rect.height * def.snap) / 1000;
|
||||
unsigned int dmask;
|
||||
unsigned int num;
|
||||
XRectangle *rects = rects_of_view(c->frame.data[c->sel]->area->view,
|
||||
|
|
|
@ -293,6 +293,7 @@ main(int argc, char *argv[])
|
|||
def.font = strdup(BLITZ_FONT);
|
||||
def.border = 2;
|
||||
def.colmode = Coldefault;
|
||||
def.colw = 0;
|
||||
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));
|
||||
|
|
|
@ -154,6 +154,7 @@ typedef struct {
|
|||
char grabmod[5];
|
||||
unsigned long mod;
|
||||
int colmode;
|
||||
unsigned int colw;
|
||||
} Default;
|
||||
|
||||
/* global variables */
|
||||
|
|
Loading…
Reference in New Issue