mirror of https://github.com/0intro/wmii
vertical scaling in 'equal' mode (will be called 'default' soon) for columns
This commit is contained in:
parent
40a69dddaf
commit
c94aff285c
|
@ -136,11 +136,12 @@ void
|
||||||
attach_toarea(Area *a, Client *c)
|
attach_toarea(Area *a, Client *c)
|
||||||
{
|
{
|
||||||
static unsigned short id = 1;
|
static unsigned short id = 1;
|
||||||
|
unsigned int aidx = area2index(a);
|
||||||
Frame *f;
|
Frame *f;
|
||||||
|
|
||||||
if(clientofview(a->view, c))
|
if(clientofview(a->view, c))
|
||||||
return;
|
return;
|
||||||
c->floating = !area2index(a); /* set floating flag */
|
c->floating = !aidx;
|
||||||
f = cext_emallocz(sizeof(Frame));
|
f = cext_emallocz(sizeof(Frame));
|
||||||
f->id = id++;
|
f->id = id++;
|
||||||
f->area = a;
|
f->area = a;
|
||||||
|
@ -152,8 +153,11 @@ attach_toarea(Area *a, Client *c)
|
||||||
c->sel = c->frame.size - 1;
|
c->sel = c->frame.size - 1;
|
||||||
cext_vattach(frame2vector(&a->frame),f);
|
cext_vattach(frame2vector(&a->frame),f);
|
||||||
a->sel = a->frame.size - 1;
|
a->sel = a->frame.size - 1;
|
||||||
if(area2index(a)) /* column */
|
if(aidx) { /* column */
|
||||||
arrange_column(a);
|
if(a->frame.size > 1)
|
||||||
|
f->rect.height = a->rect.height / (a->frame.size - 1);
|
||||||
|
arrange_column(a, False);
|
||||||
|
}
|
||||||
else /* floating */
|
else /* floating */
|
||||||
resize_client(c, &f->rect, False);
|
resize_client(c, &f->rect, False);
|
||||||
}
|
}
|
||||||
|
@ -181,7 +185,7 @@ detach_fromarea(Area *a, Client *c)
|
||||||
|
|
||||||
i = area2index(a);
|
i = area2index(a);
|
||||||
if(i && a->frame.size)
|
if(i && a->frame.size)
|
||||||
arrange_column(a);
|
arrange_column(a, False);
|
||||||
else {
|
else {
|
||||||
if(i) {
|
if(i) {
|
||||||
if(v->area.size > 2)
|
if(v->area.size > 2)
|
||||||
|
@ -302,33 +306,39 @@ relax_area(Area *a)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
arrange_column(Area *a)
|
arrange_column(Area *a, Bool dirty)
|
||||||
{
|
{
|
||||||
unsigned int i, yoff, h;
|
unsigned int i, yoff = a->rect.y, h, dy = 0;
|
||||||
|
float scale = 1.0;
|
||||||
|
|
||||||
if(!a->frame.size)
|
if(!a->frame.size)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
switch(a->mode) {
|
switch(a->mode) {
|
||||||
case Colequal:
|
case Colequal:
|
||||||
h = a->rect.height;
|
h = a->rect.height / a->frame.size;
|
||||||
h /= a->frame.size;
|
if(h < (2 * bar_height()))
|
||||||
if(h < 2 * bar_height())
|
|
||||||
goto Fallthrough;
|
goto Fallthrough;
|
||||||
|
if(dirty) {
|
||||||
|
for(i = 0; i < a->frame.size; i++)
|
||||||
|
a->frame.data[i]->rect.height = h;
|
||||||
|
}
|
||||||
|
for(i = 0; i < a->frame.size; i++)
|
||||||
|
dy += a->frame.data[i]->rect.height;
|
||||||
|
scale = (float)a->rect.height / (float)dy;
|
||||||
for(i = 0; i < a->frame.size; i++) {
|
for(i = 0; i < a->frame.size; i++) {
|
||||||
Frame *f = a->frame.data[i];
|
Frame *f = a->frame.data[i];
|
||||||
f->rect = a->rect;
|
f->rect.x = a->rect.x;
|
||||||
f->rect.y += i * h;
|
f->rect.y = yoff;
|
||||||
if(i + 1 < a->frame.size)
|
f->rect.width = a->rect.width;
|
||||||
f->rect.height = h;
|
f->rect.height *= scale;
|
||||||
else
|
if(i == a->frame.size - 1)
|
||||||
f->rect.height =
|
f->rect.height = a->rect.height - f->rect.y + a->rect.y;
|
||||||
a->rect.height - f->rect.y + a->rect.y;
|
yoff += f->rect.height;
|
||||||
resize_client(f->client, &f->rect, True);
|
resize_client(f->client, &f->rect, True);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case Colstack:
|
case Colstack:
|
||||||
yoff = a->rect.y;
|
|
||||||
h = a->rect.height - (a->frame.size - 1) * bar_height();
|
h = a->rect.height - (a->frame.size - 1) * bar_height();
|
||||||
if(h < 3 * bar_height())
|
if(h < 3 * bar_height())
|
||||||
goto Fallthrough;
|
goto Fallthrough;
|
||||||
|
@ -501,7 +511,7 @@ drop_moving(Frame *f, XRectangle *new, XPoint * pt)
|
||||||
Frame *tmp = src->frame.data[j];
|
Frame *tmp = src->frame.data[j];
|
||||||
src->frame.data[j] = src->frame.data[i];
|
src->frame.data[j] = src->frame.data[i];
|
||||||
src->frame.data[i] = tmp;
|
src->frame.data[i] = tmp;
|
||||||
arrange_column(src);
|
arrange_column(src, False);
|
||||||
focus_client(f->client);
|
focus_client(f->client);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -85,7 +85,7 @@ update_bar_geometry()
|
||||||
for(j = 1; j < view.data[i]->area.size; j++) {
|
for(j = 1; j < view.data[i]->area.size; j++) {
|
||||||
Area *a = view.data[i]->area.data[j];
|
Area *a = view.data[i]->area.data[j];
|
||||||
a->rect.height = rect.height - brect.height;
|
a->rect.height = rect.height - brect.height;
|
||||||
arrange_column(a);
|
arrange_column(a, False);
|
||||||
}
|
}
|
||||||
for(j = 0; j < view.data[i]->area.data[0]->frame.size; j++) {
|
for(j = 0; j < view.data[i]->area.data[0]->frame.size; j++) {
|
||||||
Frame *f = view.data[i]->area.data[0]->frame.data[j];
|
Frame *f = view.data[i]->area.data[0]->frame.data[j];
|
||||||
|
|
|
@ -98,7 +98,7 @@ focus_client(Client *c)
|
||||||
draw_client(c);
|
draw_client(c);
|
||||||
XSync(dpy, False);
|
XSync(dpy, False);
|
||||||
if(i > 0 && f->area->mode == Colstack)
|
if(i > 0 && f->area->mode == Colstack)
|
||||||
arrange_column(f->area);
|
arrange_column(f->area, False);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -522,7 +522,7 @@ Swaparea:
|
||||||
a->frame.data[j]->area = a;
|
a->frame.data[j]->area = a;
|
||||||
o->frame.data[o->sel] = f;
|
o->frame.data[o->sel] = f;
|
||||||
f->area = o;
|
f->area = o;
|
||||||
arrange_column(o);
|
arrange_column(o, False);
|
||||||
}
|
}
|
||||||
else if(!strncmp(arg, "up", 3) && i) {
|
else if(!strncmp(arg, "up", 3) && i) {
|
||||||
if(j)
|
if(j)
|
||||||
|
@ -541,7 +541,7 @@ Swaparea:
|
||||||
a->frame.data[i] = f;
|
a->frame.data[i] = f;
|
||||||
}
|
}
|
||||||
if(area2index(a))
|
if(area2index(a))
|
||||||
arrange_column(a);
|
arrange_column(a, False);
|
||||||
focus_client(c);
|
focus_client(c);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -532,10 +532,12 @@ type2stat(Stat *stat, char *wname, Qid *dir)
|
||||||
return mkstat(stat, dir, wname, strlen(def.tag), IXP_DMREAD);
|
return mkstat(stat, dir, wname, strlen(def.tag), IXP_DMREAD);
|
||||||
break;
|
break;
|
||||||
case FsFdata:
|
case FsFdata:
|
||||||
return mkstat(stat, dir, wname, (dir_i1 == label.size) ? 0 : strlen(label.data[dir_i1]->data), IXP_DMREAD | IXP_DMWRITE);
|
return mkstat(stat, dir, wname, (dir_i1 == label.size) ? 0 : strlen(label.data[dir_i1]->data),
|
||||||
|
IXP_DMREAD | IXP_DMWRITE);
|
||||||
break;
|
break;
|
||||||
case FsFmode:
|
case FsFmode:
|
||||||
return mkstat(stat, dir, wname, strlen(mode2str(view.data[dir_i1]->area.data[dir_i2]->mode)), IXP_DMREAD | IXP_DMWRITE);
|
return mkstat(stat, dir, wname, strlen(mode2str(view.data[dir_i1]->area.data[dir_i2]->mode)),
|
||||||
|
IXP_DMREAD | IXP_DMWRITE);
|
||||||
break;
|
break;
|
||||||
case FsFcolors:
|
case FsFcolors:
|
||||||
case FsFselcolors:
|
case FsFselcolors:
|
||||||
|
@ -1324,7 +1326,7 @@ xwrite(IXPConn *c, Fcall *fcall)
|
||||||
if((i = str2mode(buf)) == -1)
|
if((i = str2mode(buf)) == -1)
|
||||||
return Ebadvalue;
|
return Ebadvalue;
|
||||||
view.data[i1]->area.data[i2]->mode = i;
|
view.data[i1]->area.data[i2]->mode = i;
|
||||||
arrange_column(view.data[i1]->area.data[i2]);
|
arrange_column(view.data[i1]->area.data[i2], True);
|
||||||
if(view.data[i1]->area.data[i2]->frame.size == 1) /* little hack to update the taglabel */
|
if(view.data[i1]->area.data[i2]->frame.size == 1) /* little hack to update the taglabel */
|
||||||
draw_client(view.data[i1]->area.data[i2]->frame.data[view.data[i1]->area.data[i2]->sel]->client);
|
draw_client(view.data[i1]->area.data[i2]->frame.data[view.data[i1]->area.data[i2]->sel]->client);
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -289,7 +289,7 @@ restack_view(View *v)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
arrange_view(View *v, Bool updategeometry)
|
arrange_view(View *v, Bool dirty)
|
||||||
{
|
{
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
unsigned int width;
|
unsigned int width;
|
||||||
|
@ -300,11 +300,11 @@ arrange_view(View *v, Bool updategeometry)
|
||||||
width = rect.width / (v->area.size - 1);
|
width = rect.width / (v->area.size - 1);
|
||||||
for(i = 1; i < v->area.size; i++) {
|
for(i = 1; i < v->area.size; i++) {
|
||||||
Area *a = v->area.data[i];
|
Area *a = v->area.data[i];
|
||||||
if(updategeometry) {
|
if(dirty) {
|
||||||
a->rect.height = rect.height - brect.height;
|
a->rect.height = rect.height - brect.height;
|
||||||
a->rect.x = (i - 1) * width;
|
a->rect.x = (i - 1) * width;
|
||||||
a->rect.width = width;
|
a->rect.width = width;
|
||||||
}
|
}
|
||||||
arrange_column(a);
|
arrange_column(a, False);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -193,7 +193,7 @@ void select_area(Area *a, char *arg);
|
||||||
void send2area(Area *to, Area *from, Client *c);
|
void send2area(Area *to, Area *from, Client *c);
|
||||||
void attach_toarea(Area *a, Client *c);
|
void attach_toarea(Area *a, Client *c);
|
||||||
void detach_fromarea(Area *a, Client *c);
|
void detach_fromarea(Area *a, Client *c);
|
||||||
void arrange_column(Area *a);
|
void arrange_column(Area *a, Bool dirty);
|
||||||
void resize_area(Client *c, XRectangle *r, XPoint *pt);
|
void resize_area(Client *c, XRectangle *r, XPoint *pt);
|
||||||
int str2mode(char *arg);
|
int str2mode(char *arg);
|
||||||
char *mode2str(int mode);
|
char *mode2str(int mode);
|
||||||
|
@ -272,7 +272,7 @@ void update_tags();
|
||||||
void str2tagvector(TagVector *tv, const char *tags);
|
void str2tagvector(TagVector *tv, const char *tags);
|
||||||
|
|
||||||
/* view.c */
|
/* view.c */
|
||||||
void arrange_view(View *v, Bool updategeometry);
|
void arrange_view(View *v, Bool dirty);
|
||||||
View *alloc_view(char *name);
|
View *alloc_view(char *name);
|
||||||
void focus_view(View *v);
|
void focus_view(View *v);
|
||||||
XRectangle *rectangles(View *v, Bool isfloat, unsigned int *num);
|
XRectangle *rectangles(View *v, Bool isfloat, unsigned int *num);
|
||||||
|
|
Loading…
Reference in New Issue