mirror of
https://github.com/0intro/wmii
synced 2025-01-22 10:02:23 +03:00
implemented maxclient property for areas, the default is now, that first column has maxclient==1 (though if detached things still don't behave like I want it, detaching from maxclient column should fetch from next column a client if possible)
This commit is contained in:
parent
9c6b2d5bb0
commit
e9243fc7ce
@ -95,7 +95,7 @@ select_area(Area *a, char *arg)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
sendto_area(Area *new, Client *c)
|
sendto_area(Area *to, Client *c)
|
||||||
{
|
{
|
||||||
Area *a = c->area;
|
Area *a = c->area;
|
||||||
|
|
||||||
@ -104,12 +104,39 @@ sendto_area(Area *new, Client *c)
|
|||||||
if(a->sel >= a->nclient)
|
if(a->sel >= a->nclient)
|
||||||
a->sel = 0;
|
a->sel = 0;
|
||||||
|
|
||||||
new->client = (Client **)cext_array_attach(
|
attach_client2area(to, c);
|
||||||
(void **)new->client, c, sizeof(Client *), &new->clientsz);
|
|
||||||
new->nclient++;
|
|
||||||
|
|
||||||
c->area = new;
|
|
||||||
arrange_column(a);
|
|
||||||
arrange_column(new);
|
|
||||||
focus_client(c);
|
focus_client(c);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
attach_client2area(Area *a, Client *c)
|
||||||
|
{
|
||||||
|
Page *p = a->page;
|
||||||
|
if(area2index(a) && a->maxclient && (a->maxclient == a->nclient)) {
|
||||||
|
Area *to = nil;
|
||||||
|
int i;
|
||||||
|
for(i = p->sel; i < p->narea; i++) {
|
||||||
|
to = p->area[i];
|
||||||
|
if(!to->maxclient || (to->maxclient > to->nclient))
|
||||||
|
break;
|
||||||
|
to = nil;
|
||||||
|
}
|
||||||
|
if(!to) {
|
||||||
|
to = alloc_area(p);
|
||||||
|
sendto_area(to, a->client[a->sel]);
|
||||||
|
arrange_page(p, True);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
sendto_area(to, a->client[a->sel]);
|
||||||
|
}
|
||||||
|
|
||||||
|
a->client = (Client **)cext_array_attach(
|
||||||
|
(void **)a->client, c, sizeof(Client *), &a->clientsz);
|
||||||
|
a->nclient++;
|
||||||
|
c->area = a;
|
||||||
|
if(p->sel > 0) /* column mode */
|
||||||
|
arrange_column(a);
|
||||||
|
else /* normal mode */
|
||||||
|
resize_client(c, &c->frame.rect, nil, False);
|
||||||
|
}
|
||||||
|
|
||||||
|
@ -352,14 +352,7 @@ attach_client2page(Page *p, Client *c)
|
|||||||
Area *a = p->area[p->sel];
|
Area *a = p->area[p->sel];
|
||||||
|
|
||||||
reparent_client(c, c->frame.win, c->rect.x, c->rect.y);
|
reparent_client(c, c->frame.win, c->rect.x, c->rect.y);
|
||||||
a->client = (Client **)cext_array_attach((void **)a->client, c,
|
attach_client2area(a, c);
|
||||||
sizeof(Client *), &a->clientsz);
|
|
||||||
a->nclient++;
|
|
||||||
c->area = a;
|
|
||||||
if(p->sel > 0) /* column mode */
|
|
||||||
arrange_column(a);
|
|
||||||
else /* normal mode */
|
|
||||||
resize_client(c, &c->frame.rect, nil, False);
|
|
||||||
map_client(c);
|
map_client(c);
|
||||||
XMapWindow(dpy, c->frame.win);
|
XMapWindow(dpy, c->frame.win);
|
||||||
}
|
}
|
||||||
@ -566,7 +559,7 @@ select_client(Client *c, char *arg)
|
|||||||
void
|
void
|
||||||
sendtopage_client(Client *c, char *arg) {
|
sendtopage_client(Client *c, char *arg) {
|
||||||
Page *p;
|
Page *p;
|
||||||
Client *next;
|
Client *to;
|
||||||
|
|
||||||
if(!strncmp(arg, "new", 4))
|
if(!strncmp(arg, "new", 4))
|
||||||
p = alloc_page();
|
p = alloc_page();
|
||||||
@ -583,14 +576,14 @@ sendtopage_client(Client *c, char *arg) {
|
|||||||
attach_client2page(p, c);
|
attach_client2page(p, c);
|
||||||
if(p == page[sel])
|
if(p == page[sel])
|
||||||
focus_client(c);
|
focus_client(c);
|
||||||
else if((next = sel_client_of_page(page[sel])))
|
else if((to = sel_client_of_page(page[sel])))
|
||||||
focus_client(next);
|
focus_client(to);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
sendtoarea_client(Client *c, char *arg) {
|
sendtoarea_client(Client *c, char *arg) {
|
||||||
const char *errstr;
|
const char *errstr;
|
||||||
Area *next, *a = c->area;
|
Area *to, *a = c->area;
|
||||||
Page *p = a->page;
|
Page *p = a->page;
|
||||||
int i = area2index(a);
|
int i = area2index(a);
|
||||||
|
|
||||||
@ -598,23 +591,24 @@ sendtoarea_client(Client *c, char *arg) {
|
|||||||
return;
|
return;
|
||||||
if(!strncmp(arg, "prev", 5)) {
|
if(!strncmp(arg, "prev", 5)) {
|
||||||
if(i == 1)
|
if(i == 1)
|
||||||
next = p->area[p->narea - 1];
|
to = p->area[p->narea - 1];
|
||||||
else
|
else
|
||||||
next = p->area[i - 1];
|
to = p->area[i - 1];
|
||||||
}
|
}
|
||||||
else if(!strncmp(arg, "next", 5)) {
|
else if(!strncmp(arg, "next", 5)) {
|
||||||
if(i < p->narea - 1)
|
if(i < p->narea - 1)
|
||||||
next = p->area[i + 1];
|
to = p->area[i + 1];
|
||||||
else
|
else
|
||||||
next = p->area[1];
|
to = p->area[1];
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
i = cext_strtonum(arg, 0, p->narea - 1, &errstr);
|
i = cext_strtonum(arg, 0, p->narea - 1, &errstr);
|
||||||
if(errstr)
|
if(errstr)
|
||||||
return;
|
return;
|
||||||
next = p->area[i];
|
to = p->area[i];
|
||||||
}
|
}
|
||||||
sendto_area(next, c);
|
sendto_area(to, c);
|
||||||
|
arrange_column(to);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -232,8 +232,10 @@ drop_moving(Client *c, XRectangle *new, XPoint * pt)
|
|||||||
for(i = 1; (i < p->narea) &&
|
for(i = 1; (i < p->narea) &&
|
||||||
!blitz_ispointinrect(pt->x, pt->y, &p->area[i]->rect); i++);
|
!blitz_ispointinrect(pt->x, pt->y, &p->area[i]->rect); i++);
|
||||||
if((tgt = ((i < p->narea) ? p->area[i] : nil))) {
|
if((tgt = ((i < p->narea) ? p->area[i] : nil))) {
|
||||||
if(tgt != src)
|
if(tgt != src) {
|
||||||
sendto_area(tgt, c);
|
sendto_area(tgt, c);
|
||||||
|
arrange_column(tgt);
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
for(i = 0; (i < src->nclient) &&
|
for(i = 0; (i < src->nclient) &&
|
||||||
!blitz_ispointinrect(pt->x, pt->y, &src->client[i]->frame.rect); i++);
|
!blitz_ispointinrect(pt->x, pt->y, &src->client[i]->frame.rect); i++);
|
||||||
|
@ -18,7 +18,7 @@ alloc_page()
|
|||||||
|
|
||||||
p->id = id++;
|
p->id = id++;
|
||||||
alloc_area(p);
|
alloc_area(p);
|
||||||
alloc_area(p);
|
alloc_area(p)->maxclient = 1; /* default column is master */
|
||||||
page = (Page **)cext_array_attach((void **)page, p, sizeof(Page *), &pagesz);
|
page = (Page **)cext_array_attach((void **)page, p, sizeof(Page *), &pagesz);
|
||||||
npage++;
|
npage++;
|
||||||
focus_page(p);
|
focus_page(p);
|
||||||
|
@ -195,7 +195,8 @@ int area2index(Area *a);
|
|||||||
int aid2index(Page *p, unsigned short id);
|
int aid2index(Page *p, unsigned short id);
|
||||||
void update_area_geometry(Area *a);
|
void update_area_geometry(Area *a);
|
||||||
void select_area(Area *a, char *arg);
|
void select_area(Area *a, char *arg);
|
||||||
void sendto_area(Area *new, Client *c);
|
void sendto_area(Area *to, Client *c);
|
||||||
|
void attach_client2area(Area *a, Client *c);
|
||||||
|
|
||||||
/* bar.c */
|
/* bar.c */
|
||||||
Label *new_label();
|
Label *new_label();
|
||||||
|
Loading…
Reference in New Issue
Block a user