[hackers] [wmii] Augment /client/*/ctl Fullscreen command, make info available on read. || Kris Maglione

From: <hg_AT_suckless.org>
Date: Fri, 15 May 2009 17:57:01 +0000 (UTC)

changeset: 2452:9cab98a04837
tag: tip
user: Kris Maglione <jg_AT_suckless.org>
date: Fri May 15 13:56:57 2009 -0400
files: cmd/menu/keys.txt cmd/wmii/client.c cmd/wmii/ewmh.c cmd/wmii/fns.h cmd/wmii/fs.c cmd/wmii/message.c
description:
Augment /client/*/ctl Fullscreen command, make info available on read.

diff -r 10fb573a801e -r 9cab98a04837 cmd/menu/keys.txt
--- a/cmd/menu/keys.txt Thu May 14 13:07:41 2009 -0400
+++ b/cmd/menu/keys.txt Fri May 15 13:56:57 2009 -0400
@@ -24,7 +24,7 @@
 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 -r 10fb573a801e -r 9cab98a04837 cmd/wmii/client.c
--- a/cmd/wmii/client.c Thu May 14 13:07:41 2009 -0400
+++ b/cmd/wmii/client.c Fri May 15 13:56:57 2009 -0400
@@ -204,7 +204,7 @@
         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 @@
 }
 
 void
-fullscreen(Client *c, int fullscreen) {
+fullscreen(Client *c, int fullscreen, long screen) {
         Frame *f;
         bool wassel;
         
@@ -620,7 +620,7 @@
                         }
                 }
         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 -r 10fb573a801e -r 9cab98a04837 cmd/wmii/ewmh.c
--- a/cmd/wmii/ewmh.c Thu May 14 13:07:41 2009 -0400
+++ b/cmd/wmii/ewmh.c Fri May 15 13:56:57 2009 -0400
@@ -323,7 +323,7 @@
                 return;
 
         if(state == STATE("FULLSCREEN"))
- fullscreen(c, action);
+ fullscreen(c, action, -1);
         else
         if(state == STATE("DEMANDS_ATTENTION"))
                 client_seturgent(c, action, UrgClient);
diff -r 10fb573a801e -r 9cab98a04837 cmd/wmii/fns.h
--- a/cmd/wmii/fns.h Thu May 14 13:07:41 2009 -0400
+++ b/cmd/wmii/fns.h Fri May 15 13:56:57 2009 -0400
@@ -90,7 +90,7 @@
 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_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 -r 10fb573a801e -r 9cab98a04837 cmd/wmii/fs.c
--- a/cmd/wmii/fs.c Thu May 14 13:07:41 2009 -0400
+++ b/cmd/wmii/fs.c Fri May 15 13:56:57 2009 -0400
@@ -473,19 +473,13 @@
                         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 -r 10fb573a801e -r 9cab98a04837 cmd/wmii/message.c
--- a/cmd/wmii/message.c Thu May 14 13:07:41 2009 -0400
+++ b/cmd/wmii/message.c Fri May 15 13:56:57 2009 -0400
@@ -108,6 +108,11 @@
         "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 @@
 }
 
 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;
@@ -392,8 +397,21 @@
 }
 
 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 @@
          * Toggle ::= on
          * | off
          * | toggle
+ * | <screen>
          * Fullscreen <toggle>
          * Urgent <toggle>
          * kill
@@ -410,10 +429,15 @@
 
         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 @@
                 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);
Received on Fri May 15 2009 - 17:57:01 UTC

This archive was generated by hypermail 2.2.0 : Fri May 15 2009 - 18:00:06 UTC