mirror of
https://github.com/0intro/wmii
synced 2025-01-06 02:22:01 +03:00
exclusive mode of columns done with $MODKEY-x
This commit is contained in:
parent
5e43254a12
commit
6ce7eb4337
@ -143,8 +143,9 @@ attach_toarea(Area *a, Client *c)
|
||||
a->frame = (Frame **)cext_array_attach(
|
||||
(void **)a->frame, f, sizeof(Frame *), &a->framesz);
|
||||
a->nframe++;
|
||||
a->sel = a->nframe - 1;
|
||||
if(area2index(a)) /* column */
|
||||
arrange_area(a);
|
||||
arrange_column(a);
|
||||
else /* floating */
|
||||
resize_client(c, &f->rect, False);
|
||||
}
|
||||
@ -174,7 +175,7 @@ detach_fromarea(Area *a, Client *c)
|
||||
|
||||
i = area2index(a);
|
||||
if(i && a->nframe)
|
||||
arrange_area(a);
|
||||
arrange_column(a);
|
||||
else {
|
||||
if(i) {
|
||||
if(v->narea > 2)
|
||||
@ -205,6 +206,7 @@ mode2str(int mode)
|
||||
switch(mode) {
|
||||
case Colequal: return "equal"; break;
|
||||
case Colstack: return "stack"; break;
|
||||
case Colexcl: return "excl"; break;
|
||||
case Colmax: return "max"; break;
|
||||
default: break;
|
||||
}
|
||||
@ -218,6 +220,8 @@ str2mode(char *arg)
|
||||
return Colequal;
|
||||
if(!strncmp("stack", arg, 6))
|
||||
return Colstack;
|
||||
if(!strncmp("excl", arg, 5))
|
||||
return Colexcl;
|
||||
if(!strncmp("max", arg, 4))
|
||||
return Colmax;
|
||||
return -1;
|
||||
@ -263,7 +267,7 @@ relax_area(Area *a)
|
||||
h = 0;
|
||||
for(i = 0; i < a->nframe; i++) {
|
||||
Frame *f = a->frame[i];
|
||||
if(a->mode == Colmax) {
|
||||
if(a->mode == Colmax || a->mode == Colexcl) {
|
||||
if(h < f->rect.height)
|
||||
h = f->rect.height;
|
||||
}
|
||||
@ -288,14 +292,14 @@ relax_area(Area *a)
|
||||
Frame *f = a->frame[i];
|
||||
f->rect.x = a->rect.x + (a->rect.width - f->rect.width) / 2;
|
||||
f->rect.y = yoff;
|
||||
if(a->mode != Colmax)
|
||||
if((a->mode != Colmax) && (a->mode != Colexcl))
|
||||
yoff = f->rect.y + f->rect.height + hdiff;
|
||||
resize_client(f->client, &f->rect, False);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
arrange_area(Area *a)
|
||||
arrange_column(Area *a)
|
||||
{
|
||||
unsigned int i, yoff, h;
|
||||
|
||||
@ -337,6 +341,31 @@ arrange_area(Area *a)
|
||||
resize_client(f->client, &f->rect, True);
|
||||
}
|
||||
break;
|
||||
case Colexcl:
|
||||
if(a->nframe > 1) {
|
||||
Client *c = a->frame[a->sel]->client;
|
||||
Area *to = nil;
|
||||
for(i = area2index(a) + 1; i < a->view->narea; i++)
|
||||
if(a->view->area[i]->mode != Colexcl) {
|
||||
to = a->view->area[i];
|
||||
break;
|
||||
}
|
||||
if(!to) {
|
||||
to = alloc_area(a->view);
|
||||
a->view->sel = area2index(a);
|
||||
arrange_view(a->view, True);
|
||||
}
|
||||
while(a->nframe > 1) {
|
||||
for(i = 0; i < a->nframe; i++) {
|
||||
Client *cl = a->frame[i]->client;
|
||||
if(cl != c) {
|
||||
detach_fromarea(a, cl);
|
||||
attach_toarea(to, cl);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Fallthrough:
|
||||
case Colmax:
|
||||
for(i = 0; i < a->nframe; i++) {
|
||||
@ -415,7 +444,7 @@ drop_resize(Frame *f, XRectangle *new)
|
||||
if(horiz_resize)
|
||||
match_horiz(a, &a->rect);
|
||||
|
||||
if(a->mode == Colstack || a->mode == Colmax)
|
||||
if(a->mode != Colequal)
|
||||
goto AfterVertical;
|
||||
/* vertical resize */
|
||||
if(north && (new->y != f->rect.y)) {
|
||||
@ -472,7 +501,7 @@ drop_moving(Frame *f, XRectangle *new, XPoint * pt)
|
||||
Frame *tmp = src->frame[j];
|
||||
src->frame[j] = src->frame[i];
|
||||
src->frame[i] = tmp;
|
||||
arrange_area(src);
|
||||
arrange_column(src);
|
||||
focus_client(f->client);
|
||||
}
|
||||
}
|
||||
|
@ -81,7 +81,7 @@ update_bar_geometry()
|
||||
for(j = 1; j < view[i]->narea; j++) {
|
||||
Area *a = view[i]->area[j];
|
||||
a->rect.height = rect.height - brect.height;
|
||||
arrange_area(a);
|
||||
arrange_column(a);
|
||||
}
|
||||
for(j = 0; j < view[i]->area[0]->nframe; j++) {
|
||||
Frame *f = view[i]->area[0]->frame[j];
|
||||
|
@ -100,7 +100,7 @@ focus_client(Client *c)
|
||||
draw_client(c);
|
||||
XSync(dpy, False);
|
||||
if(i > 0 && f->area->mode == Colstack)
|
||||
arrange_area(f->area);
|
||||
arrange_column(f->area);
|
||||
}
|
||||
|
||||
void
|
||||
@ -532,7 +532,7 @@ restack_client(Client *c, char *arg)
|
||||
|
||||
a->frame[j] = a->frame[i];
|
||||
a->frame[i] = f;
|
||||
arrange_area(a);
|
||||
arrange_column(a);
|
||||
focus_client(c);
|
||||
}
|
||||
|
||||
|
@ -1333,7 +1333,7 @@ xwrite(IXPConn *c, Fcall *fcall)
|
||||
if((i = str2mode(buf)) == -1)
|
||||
return Ebadvalue;
|
||||
view[i1]->area[i2]->mode = i;
|
||||
arrange_area(view[i1]->area[i2]);
|
||||
arrange_column(view[i1]->area[i2]);
|
||||
break;
|
||||
case FsFevent:
|
||||
if(fcall->count > sizeof(buf))
|
||||
|
@ -315,6 +315,6 @@ arrange_view(View *v, Bool updategeometry)
|
||||
a->rect.x = (i - 1) * width;
|
||||
a->rect.width = width;
|
||||
}
|
||||
arrange_area(a);
|
||||
arrange_column(a);
|
||||
}
|
||||
}
|
||||
|
@ -22,6 +22,7 @@ enum {
|
||||
enum {
|
||||
Colequal,
|
||||
Colstack,
|
||||
Colexcl,
|
||||
Colmax
|
||||
};
|
||||
|
||||
@ -206,7 +207,7 @@ void select_area(Area *a, char *arg);
|
||||
void send2area(Area *to, Area *from, Client *c);
|
||||
void attach_toarea(Area *a, Client *c);
|
||||
void detach_fromarea(Area *a, Client *c);
|
||||
void arrange_area(Area *a);
|
||||
void arrange_column(Area *a);
|
||||
void resize_area(Client *c, XRectangle *r, XPoint *pt);
|
||||
int str2mode(char *arg);
|
||||
char *mode2str(int mode);
|
||||
|
@ -63,6 +63,7 @@ $MODKEY-n
|
||||
$MODKEY-m
|
||||
$MODKEY-s
|
||||
$MODKEY-e
|
||||
$MODKEY-x
|
||||
$MODKEY-0
|
||||
$MODKEY-1
|
||||
$MODKEY-2
|
||||
@ -120,6 +121,8 @@ do
|
||||
xwrite /view/sel/mode stack;;
|
||||
$MODKEY-e)
|
||||
xwrite /view/sel/mode equal;;
|
||||
$MODKEY-x)
|
||||
xwrite /view/sel/mode excl;;
|
||||
$MODKEY-n)
|
||||
xwrite /view/sel/sel/ctl sendto new;;
|
||||
$MODKEY-Shift-h)
|
||||
|
Loading…
Reference in New Issue
Block a user