changeset: 2109:0b51728c2e71
user: Kris Maglione <jg_AT_suckless.org>
date: Sat Apr 21 22:04:11 2007 -0400
summary: Added writable /client/n/label
diff -r f2e8f05273db -r 0b51728c2e71 cmd/wmii/client.c
--- a/cmd/wmii/client.c Sat Apr 21 18:46:17 2007 -0400
+++ b/cmd/wmii/client.c Sat Apr 21 22:04:11 2007 -0400
@@ -385,10 +385,22 @@ clientname(Client *c) {
return "<nil>";
}
+void
+update_class(Client *c) {
+ char **class;
+ int n;
+
+ n = gettextlistproperty(&c->w, "WM_CLASS", &class);
+ snprintf(c->props, sizeof(c->props), "%s:%s:%s",
+ (n > 0 ? class[0] : "<nil>"),
+ (n > 1 ? class[1] : "<nil>"),
+ c->name);
+ freestringlist(class);
+}
+
static void
update_client_name(Client *c) {
- char *str, **class;
- int n;
+ char *str;
c->name[0] = '\0';
@@ -398,13 +410,6 @@ update_client_name(Client *c) {
if(str)
utfecpy(c->name, c->name+sizeof(c->name), str);
free(str);
-
- n = gettextlistproperty(&c->w, "WM_CLASS", &class);
- snprintf(c->props, sizeof(c->props), "%s:%s:%s",
- (n > 0 ? class[0] : "<nil>"),
- (n > 1 ? class[1] : "<nil>"),
- c->name);
- freestringlist(class);
}
void
diff -r f2e8f05273db -r 0b51728c2e71 cmd/wmii/column.c
--- a/cmd/wmii/column.c Sat Apr 21 18:46:17 2007 -0400
+++ b/cmd/wmii/column.c Sat Apr 21 22:04:11 2007 -0400
@@ -218,17 +218,18 @@ scale_column(Area *a) {
ncol = 0;
nuncol = 0;
dy = 0;
- for(f=a->frame; f; f=f->anext)
+ for(f=a->frame; f; f=f->anext) {
+ resize_frame(f, f->r);
if(f->collapsed)
ncol++;
else
nuncol++;
-
- surplus = Dy(a->r);
- surplus -= ncol * colh;
- surplus -= nuncol * uncolh;
+ }
+
+ surplus = Dy(a->r) - (ncol * colh) - (nuncol * uncolh);
+
if(surplus < 0) {
- i = ceil((float)(-surplus)/(uncolh - colh));
+ i = ceil((float)(-surplus) / (uncolh - colh));
if(i >= nuncol)
i = nuncol - 1;
nuncol -= i;
@@ -246,19 +247,16 @@ scale_column(Area *a) {
i = ncol - 1;
j = nuncol - 1;
for(f=a->frame; f; f=f->anext) {
- f->r = rectsubpt(f->r, f->r.min);
- f->crect = rectsubpt(f->crect, f->crect.min);
if(f == a->sel)
j++;
if(!f->collapsed) {
- if(j < 0 && f != a->sel)
+ if(j < 0 && (f != a->sel))
f->collapsed = True;
else {
if(Dy(f->crect) <= minh)
f->crect.max.y = 1;
else
f->crect.max.y -= minh;
- dy += Dy(f->crect);
}
j--;
}
@@ -274,29 +272,35 @@ scale_column(Area *a) {
continue;
}
i--;
+ f->r.max.y = colh;
+ }
+
+ f->r = rectsubpt(f->r, f->r.min);
+ f->crect = rectsubpt(f->crect, f->crect.min);
+ f->r.max.x = Dx(a->r);
+ if(!f->collapsed) {
+ dy += Dy(f->crect);
+ f->r.max.y = uncolh;
}
fp=&f->anext;
}
-
- i = nuncol;
+ for(f = a->frame; f; f = f->anext)
+ f->ratio = (float)Dy(f->crect)/dy;
+
+ j = 0;
+ while(surplus != j) {
+ j = surplus;
+ dy = 0;
for(f=a->frame; f; f=f->anext) {
- f->r.max.x = Dx(a->r);
- if(f->collapsed)
- f->r.max.y = labelh(def.font);
- else {
- if(--i != 0)
- f->r.max.y = (float)Dy(f->crect) / dy * surplus;
- else
- f->r.max.y = surplus;
- f->r.max.y += uncolh;
- f->r = frame_hints(f, f->r, NWEST);
-
- dy -= Dy(f->r) - uncolh;
- surplus -= Dy(f->r) - uncolh;
-
+ if(!f->collapsed) {
+ f->r.max.y += f->ratio * surplus;
resize_frame(f, f->r);
+ f->r.max.y = Dy(f->crect) + frame_delta_h();
}
- }
+ dy += Dy(f->r);
+ }
+ surplus = Dy(a->r) - dy;
+ }
yoff = a->r.min.y;
i = nuncol;
diff -r f2e8f05273db -r 0b51728c2e71 cmd/wmii/dat.h
--- a/cmd/wmii/dat.h Sat Apr 21 18:46:17 2007 -0400
+++ b/cmd/wmii/dat.h Sat Apr 21 22:04:11 2007 -0400
@@ -112,6 +112,7 @@ struct Frame {
Bool collapsed;
Rectangle grabbox;
Rectangle titlebar;
+ float ratio;
};
struct Client {
diff -r f2e8f05273db -r 0b51728c2e71 cmd/wmii/fns.h
--- a/cmd/wmii/fns.h Sat Apr 21 18:46:17 2007 -0400
+++ b/cmd/wmii/fns.h Sat Apr 21 22:04:11 2007 -0400
@@ -28,6 +28,7 @@ Client *create_client(XWindow, XWindowAt
Client *create_client(XWindow, XWindowAttributes*);
void destroy_client(Client*);
void configure_client(Client*);
+void update_class(Client *c);
void prop_client(Client *c, Atom);
void kill_client(Client*);
void gravitate_client(Client*, Bool invert);
diff -r f2e8f05273db -r 0b51728c2e71 cmd/wmii/fs.c
--- a/cmd/wmii/fs.c Sat Apr 21 18:46:17 2007 -0400
+++ b/cmd/wmii/fs.c Sat Apr 21 22:04:11 2007 -0400
@@ -53,7 +53,7 @@ enum { /* Dirs */
FsRoot, FsDClient, FsDClients, FsDBars,
FsDTag, FsDTags,
/* Files */
- FsFBar, FsFCctl, FsFColRules,
+ FsFBar, FsFCctl, FsFColRules, FsFClabel,
FsFCtags, FsFEvent, FsFKeys, FsFRctl,
FsFTagRules, FsFTctl, FsFTindex,
FsFprops
@@ -111,6 +111,7 @@ dirtab_clients[]={{".", QTDIR, FsDClie
{nil}},
dirtab_client[]= {{".", QTDIR, FsDClient, 0500|P9_DMDIR },
{"ctl", QTAPPEND, FsFCctl, 0600|P9_DMAPPEND },
+ {"label", QTFILE, FsFClabel, 0600 },
{"tags", QTFILE, FsFCtags, 0600 },
{"props", QTFILE, FsFprops, 0400 },
{nil}},
@@ -613,6 +614,8 @@ fs_size(FileId *f) {
return def.keyssz;
case FsFCtags:
return strlen(f->p.client->tags);
+ case FsFClabel:
+ return strlen(f->p.client->name);
case FsFprops:
return strlen(f->p.client->props);
}
@@ -707,6 +710,10 @@ fs_read(Ixp9Req *r) {
write_buf(r, f->p.client->tags, strlen(f->p.client->tags));
respond(r, nil);
return;
+ case FsFClabel:
+ write_buf(r, f->p.client->name, strlen(f->p.client->name));
+ respond(r, nil);
+ return;
case FsFTctl:
write_buf(r, f->p.view->name, strlen(f->p.view->name));
respond(r, nil);
@@ -773,6 +780,14 @@ fs_write(Ixp9Req *r) {
return;
case FsFKeys:
write_to_buf(r, &def.keys, &def.keyssz, 0);
+ respond(r, nil);
+ return;
+ case FsFClabel:
+ data_to_cstring(r);
+ utfecpy(f->p.client->name, f->p.client->name+sizeof(client->name), r->ifcall.data);
+ draw_frame(f->p.client->sel);
+ update_class(f->p.client);
+ r->ofcall.count = r->ifcall.count;
respond(r, nil);
return;
case FsFCtags:
Received on Fri Jun 01 2007 - 03:09:53 UTC
This archive was generated by hypermail 2.2.0 : Sun Jul 13 2008 - 15:57:01 UTC