mirror of
https://github.com/0intro/wmii
synced 2024-12-24 04:16:50 +03:00
renamed maxclient into capacity, using a different way than hardcoding existing first column to capacity=1
This commit is contained in:
parent
854999c376
commit
7e28da7db3
@ -112,12 +112,12 @@ void
|
||||
attach_client2area(Area *a, Client *c)
|
||||
{
|
||||
Page *p = a->page;
|
||||
if(area2index(a) && a->maxclient && (a->maxclient == a->nclient)) {
|
||||
if(area2index(a) && a->capacity && (a->capacity == 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))
|
||||
if(!to->capacity || (to->capacity > to->nclient))
|
||||
break;
|
||||
to = nil;
|
||||
}
|
||||
@ -151,10 +151,10 @@ detach_client_area(Client *c)
|
||||
if(a->sel >= a->nclient)
|
||||
a->sel = 0;
|
||||
if(i) { /* column */
|
||||
if(a->maxclient && (a->nclient < a->maxclient)) {
|
||||
if(a->capacity && (a->nclient < a->capacity)) {
|
||||
for(++i; i < p->narea; i++) {
|
||||
Area *tmp = p->area[i];
|
||||
if(!tmp->maxclient)
|
||||
if(!tmp->capacity)
|
||||
sendto_area(a, tmp->client[0]);
|
||||
else
|
||||
continue;
|
||||
|
22
cmd/wm/fs.c
22
cmd/wm/fs.c
@ -194,7 +194,7 @@ qid2name(Qid *qid)
|
||||
case Fsnap: return "border"; break;
|
||||
case Fgeom: return "geometry"; break;
|
||||
case Fname: return "name"; break;
|
||||
case Fmax: return "max"; break;
|
||||
case Fcapacity: return "capacity"; break;
|
||||
case Fmode: return "mode"; break;
|
||||
case Fevent: return "event"; break;
|
||||
case Fkey: return key[i1]->name; break;
|
||||
@ -245,8 +245,8 @@ name2type(char *name, unsigned char dir_type)
|
||||
return Ffont;
|
||||
if(!strncmp(name, "data", 5))
|
||||
return Fdata;
|
||||
if(!strncmp(name, "max", 4))
|
||||
return Fmax;
|
||||
if(!strncmp(name, "capacity", 9))
|
||||
return Fcapacity;
|
||||
if(!strncmp(name, "mode", 5))
|
||||
return Fmode;
|
||||
if(name2key(name))
|
||||
@ -576,8 +576,8 @@ type2stat(Stat *stat, char *wname, Qid *dir)
|
||||
case Fdata:
|
||||
return mkstat(stat, dir, wname, (dir_i1 == nlabel) ? 0 : strlen(label[dir_i1]->data), DMREAD | DMWRITE);
|
||||
break;
|
||||
case Fmax:
|
||||
snprintf(buf, sizeof(buf), "%d", page[dir_i1]->area[dir_i2]->maxclient);
|
||||
case Fcapacity:
|
||||
snprintf(buf, sizeof(buf), "%d", page[dir_i1]->area[dir_i2]->capacity);
|
||||
return mkstat(stat, dir, wname, strlen(buf), DMREAD | DMWRITE);
|
||||
break;
|
||||
case Fmode:
|
||||
@ -766,7 +766,7 @@ xread(IXPConn *c, Fcall *fcall)
|
||||
/* jump to offset */
|
||||
len = type2stat(&stat, "ctl", &m->qid);
|
||||
if(i2) {
|
||||
len += type2stat(&stat, "max", &m->qid);
|
||||
len += type2stat(&stat, "capacity", &m->qid);
|
||||
len += type2stat(&stat, "mode", &m->qid);
|
||||
}
|
||||
for(i = 0; i < page[i1]->area[i2]->nclient; i++) {
|
||||
@ -892,7 +892,7 @@ xread(IXPConn *c, Fcall *fcall)
|
||||
fcall->count = type2stat(&stat, "ctl", &m->qid);
|
||||
p = ixp_enc_stat(p, &stat);
|
||||
if(i2) {
|
||||
fcall->count += type2stat(&stat, "max", &m->qid);
|
||||
fcall->count += type2stat(&stat, "capacity", &m->qid);
|
||||
p = ixp_enc_stat(p, &stat);
|
||||
fcall->count += type2stat(&stat, "mode", &m->qid);
|
||||
p = ixp_enc_stat(p, &stat);
|
||||
@ -977,10 +977,10 @@ xread(IXPConn *c, Fcall *fcall)
|
||||
if((fcall->count = strlen(def.font)))
|
||||
memcpy(p, def.font, fcall->count);
|
||||
break;
|
||||
case Fmax:
|
||||
case Fcapacity:
|
||||
if(!i2)
|
||||
return Enofile;
|
||||
snprintf(buf, sizeof(buf), "%d", page[i1]->area[i2]->maxclient);
|
||||
snprintf(buf, sizeof(buf), "%d", page[i1]->area[i2]->capacity);
|
||||
fcall->count = strlen(buf);
|
||||
memcpy(p, buf, fcall->count);
|
||||
break;
|
||||
@ -1182,7 +1182,7 @@ xwrite(IXPConn *c, Fcall *fcall)
|
||||
update_bar_geometry();
|
||||
resize_all_clients();
|
||||
break;
|
||||
case Fmax:
|
||||
case Fcapacity:
|
||||
if(!i2)
|
||||
return Enofile;
|
||||
memcpy(buf, fcall->data, fcall->count);
|
||||
@ -1190,7 +1190,7 @@ xwrite(IXPConn *c, Fcall *fcall)
|
||||
i = cext_strtonum(buf, 1, 0xffff, &err);
|
||||
if(err)
|
||||
return "max value out of range 0x0001..0xffff";
|
||||
page[i1]->area[i2]->maxclient = i;
|
||||
page[i1]->area[i2]->capacity = i;
|
||||
/* TODO: detach to many clients/attach */
|
||||
break;
|
||||
case Fmode:
|
||||
|
@ -18,7 +18,7 @@ alloc_page()
|
||||
|
||||
p->id = id++;
|
||||
alloc_area(p);
|
||||
alloc_area(p)->maxclient = 1; /* default column is master */
|
||||
alloc_area(p);
|
||||
page = (Page **)cext_array_attach((void **)page, p, sizeof(Page *), &pagesz);
|
||||
npage++;
|
||||
focus_page(p);
|
||||
|
@ -42,7 +42,7 @@ enum {
|
||||
Fevent,
|
||||
Fctl,
|
||||
Fname,
|
||||
Fmax,
|
||||
Fcapacity,
|
||||
Fmode
|
||||
};
|
||||
|
||||
@ -69,7 +69,7 @@ struct Area {
|
||||
unsigned int clientsz;
|
||||
unsigned int sel;
|
||||
unsigned int nclient;
|
||||
unsigned int maxclient;
|
||||
unsigned int capacity;
|
||||
ColumnMode mode;
|
||||
XRectangle rect;
|
||||
};
|
||||
|
@ -28,11 +28,11 @@ WMII_SELCOLORS='#ffffff #285577 #4c7899' export WMII_SELCOLORS
|
||||
|
||||
# WM CONFIGURATION
|
||||
xwrite /def/border 3
|
||||
xwrite /def/inc 1
|
||||
xwrite /def/snap 20
|
||||
xwrite /def/font $WMII_FONT
|
||||
xwrite /def/selcolors $WMII_SELCOLORS
|
||||
xwrite /def/normcolors $WMII_NORMCOLORS
|
||||
xwrite /1/1/capacity 1
|
||||
|
||||
# BAR CONFIGURATION
|
||||
while wmiir remove /bar/0 2>/dev/null
|
||||
@ -144,7 +144,7 @@ do
|
||||
$MODKEY-Shift-Return)
|
||||
xwrite /sel/sel/sel/ctl sendtoarea next;;
|
||||
$MODKEY-Control-y)
|
||||
wmiir read /new >/dev/null;;
|
||||
xwrite /new/1/capacity 1;;
|
||||
$MODKEY-h)
|
||||
xwrite /sel/ctl select prev;;
|
||||
$MODKEY-l)
|
||||
|
Loading…
Reference in New Issue
Block a user