From 91525a7b52ba74c41b25442ce6837eac23d0848f Mon Sep 17 00:00:00 2001 From: Kris Maglione Date: Fri, 15 May 2009 13:56:57 -0400 Subject: [PATCH] Augment /client/*/ctl Fullscreen command, make info available on read. --- cmd/menu/keys.txt | 2 +- cmd/wmii/client.c | 6 +++--- cmd/wmii/ewmh.c | 2 +- cmd/wmii/fns.h | 3 ++- cmd/wmii/fs.c | 12 +++--------- cmd/wmii/message.c | 38 +++++++++++++++++++++++++++++++------- 6 files changed, 41 insertions(+), 22 deletions(-) diff --git a/cmd/menu/keys.txt b/cmd/menu/keys.txt index a3d5c7d7..1bebda5b 100644 --- a/cmd/menu/keys.txt +++ b/cmd/menu/keys.txt @@ -24,7 +24,7 @@ Up History backward Control-n History forward Down History forward -BackSpace Kill char +Backspace Kill char Control-h Kill char Control-Backspace Kill word Control-w Kill word diff --git a/cmd/wmii/client.c b/cmd/wmii/client.c index b3e51490..daca73b7 100644 --- a/cmd/wmii/client.c +++ b/cmd/wmii/client.c @@ -204,7 +204,7 @@ client_manage(Client *c) { if(Dx(c->r) == Dx(screen->r)) if(Dy(c->r) == Dy(screen->r)) if(c->w.ewmh.type == 0) - fullscreen(c, true); + fullscreen(c, true, -1); tags = getprop_string(&c->w, "_WMII_TAGS"); @@ -590,7 +590,7 @@ client_kill(Client *c, bool nice) { } void -fullscreen(Client *c, int fullscreen) { +fullscreen(Client *c, int fullscreen, long screen) { Frame *f; bool wassel; @@ -620,7 +620,7 @@ fullscreen(Client *c, int fullscreen) { } } else { - c->fullscreen = ownerscreen(c->r); + c->fullscreen = screen >= 0 ? screen : ownerscreen(c->r); for(f=c->frame; f; f=f->cnext) f->oldarea = -1; if((f = c->sel)) diff --git a/cmd/wmii/ewmh.c b/cmd/wmii/ewmh.c index a1ea744e..17e6555a 100644 --- a/cmd/wmii/ewmh.c +++ b/cmd/wmii/ewmh.c @@ -323,7 +323,7 @@ ewmh_setstate(Client *c, Atom state, int action) { return; if(state == STATE("FULLSCREEN")) - fullscreen(c, action); + fullscreen(c, action, -1); else if(state == STATE("DEMANDS_ATTENTION")) client_seturgent(c, action, UrgClient); diff --git a/cmd/wmii/fns.h b/cmd/wmii/fns.h index e701e00b..25027922 100644 --- a/cmd/wmii/fns.h +++ b/cmd/wmii/fns.h @@ -90,7 +90,7 @@ void client_unmap(Client*, int state); Frame* client_viewframe(Client *c, View *v); char* clientname(Client*); void focus(Client*, bool restack); -void fullscreen(Client*, int); +void fullscreen(Client*, int, long); Client* group_leader(Group*); int map_frame(Client*); Client* selclient(void); @@ -224,6 +224,7 @@ char* msg_getword(IxpMsg*); char* msg_parsecolors(IxpMsg*, CTuple*); char* msg_selectarea(Area*, IxpMsg*); char* msg_sendclient(View*, IxpMsg*, bool swap); +char* readctl_client(Client*); char* readctl_root(void); char* readctl_view(View*); Area* strarea(View*, int, const char*); diff --git a/cmd/wmii/fs.c b/cmd/wmii/fs.c index 8834c057..1a52b00a 100644 --- a/cmd/wmii/fs.c +++ b/cmd/wmii/fs.c @@ -473,19 +473,13 @@ fs_read(Ixp9Req *r) { respond(r, nil); return; case FsFCctl: - if(r->ifcall.io.offset) { - respond(r, nil); - return; - } - r->ofcall.io.data = smprint("%C", f->p.client); - /* Will (and should) die if result is nil */ - r->ofcall.io.count = strlen(r->ofcall.io.data); + buf = readctl_client(f->p.client); + ixp_srv_readbuf(r, buf, strlen(buf)); respond(r, nil); return; case FsFTindex: buf = view_index(f->p.view); - n = strlen(buf); - ixp_srv_readbuf(r, buf, n); + ixp_srv_readbuf(r, buf, strlen(buf)); respond(r, nil); return; case FsFTctl: diff --git a/cmd/wmii/message.c b/cmd/wmii/message.c index 25516a8f..e238f264 100644 --- a/cmd/wmii/message.c +++ b/cmd/wmii/message.c @@ -108,6 +108,11 @@ static char* incmodetab[] = { "show", "squeeze", }; +static char* toggletab[] = { + "off", + "on", + "toggle", +}; /* Edit ,y/^[a-zA-Z].*\n.* {\n/d * Edit s/^([a-zA-Z].*)\n(.*) {\n/\1 \2;\n/ @@ -154,8 +159,8 @@ setdef(int *ptr, char *s, char *tab[], int ntab) { } static int -gettoggle(IxpMsg *m) { - switch(getsym(msg_getword(m))) { +gettoggle(char *s) { + switch(getsym(s)) { case LON: return On; case LOFF: return Off; case LTOGGLE: return Toggle; @@ -391,9 +396,22 @@ getframe(View *v, int scrn, IxpMsg *m) { return f; } +char* +readctl_client(Client *c) { + bufclear(); + bufprint("%C\n", c); + if(c->fullscreen >= 0) + bufprint("Fullscreen %d\n", c->fullscreen); + else + bufprint("Fullscreen off\n"); + bufprint("Urgent %s\n", toggletab[(int)c->urgent]); + return buffer; +} + char* message_client(Client *c, IxpMsg *m) { char *s; + long l; int i; s = msg_getword(m); @@ -402,6 +420,7 @@ message_client(Client *c, IxpMsg *m) { * Toggle ::= on * | off * | toggle + * | * Fullscreen * Urgent * kill @@ -410,10 +429,15 @@ message_client(Client *c, IxpMsg *m) { switch(getsym(s)) { case LFULLSCREEN: - i = gettoggle(m); - if(i == -1) - return Ebadusage; - fullscreen(c, i); + s = msg_getword(m); + if(getlong(s, &l)) + fullscreen(c, On, l); + else { + i = gettoggle(s); + if(i == -1) + return Ebadusage; + fullscreen(c, i, -1); + } break; case LKILL: client_kill(c, true); @@ -422,7 +446,7 @@ message_client(Client *c, IxpMsg *m) { client_kill(c, false); break; case LURGENT: - i = gettoggle(m); + i = gettoggle(msg_getword(m)); if(i == -1) return Ebadusage; client_seturgent(c, i, UrgManager);