[hackers] [wmii] Fix printing of client ids.

From: Kris Maglione <jg_AT_suckless.org>
Date: Mon Jul 02 19:33:54 2007

changeset: 2183:8c8fcf21722e
tag: tip
user: Kris Maglione <jg_AT_suckless.org>
date: Mon Jul 02 13:31:29 2007 -0400
summary: Fix printing of client ids.

diff -r ffe49100c79d -r 8c8fcf21722e cmd/wmii/client.c
--- a/cmd/wmii/client.c Mon Jul 02 12:46:01 2007 -0400
+++ b/cmd/wmii/client.c Mon Jul 02 13:31:29 2007 -0400
@@ -439,10 +439,17 @@ kill_client(Client * c) {
 }
 
 void
-fullscreen(Client *c, Bool fullscreen) {
+fullscreen(Client *c, int fullscreen) {
         Frame *f;
-
+
+ if(fullscreen == Toggle)
+ fullscreen = c->fullscreen ^ On;
+ if(fullscreen == c->fullscreen)
+ return;
+
+ write_event("Fullscreen %C %s\n", c, (fullscreen ? "on" : "off"));
         c->fullscreen = fullscreen;
+
         if((f = c->sel)) {
                 if(fullscreen) {
                         if(!f->area->floating)
@@ -455,11 +462,14 @@ fullscreen(Client *c, Bool fullscreen) {
 }
 
 void
-set_urgent(Client *c, Bool urgent, Bool write) {
+set_urgent(Client *c, int urgent, Bool write) {
         XWMHints *wmh;
         char *cwrite, *cnot;
         Frame *f, *ff;
         Area *a;
+
+ if(urgent == Toggle)
+ urgent = c->urgent ^ On;
 
         cwrite = (write ? "Manager" : "Client");
         cnot = (urgent ? "" : "Not");
diff -r ffe49100c79d -r 8c8fcf21722e cmd/wmii/dat.h
--- a/cmd/wmii/dat.h Mon Jul 02 12:46:01 2007 -0400
+++ b/cmd/wmii/dat.h Mon Jul 02 13:31:29 2007 -0400
@@ -21,8 +21,6 @@
 # pragma varargck type "R" Rectangle
 # pragma varargck type "r" void
 #endif
-
-typedef struct CTuple CTuple;
 
 enum Align {
         NORTH = 0x01,
@@ -33,9 +31,10 @@ enum Align {
         NWEST = NORTH | WEST,
         SEAST = SOUTH | EAST,
         SWEST = SOUTH | WEST,
- CENTER = NEAST | SWEST
-};
-
+ CENTER = NEAST | SWEST,
+};
+
+typedef struct CTuple CTuple;
 typedef enum Align Align;
 
 struct CTuple {
@@ -46,7 +45,13 @@ struct CTuple {
 };
 
 enum {
- Coldefault, Colstack, Colmax
+ Coldefault, Colstack, Colmax,
+};
+
+enum {
+ Off,
+ On,
+ Toggle,
 };
 
 enum {
@@ -54,12 +59,12 @@ enum {
         CurNECorner, CurNWCorner, CurSECorner, CurSWCorner,
         CurDHArrow, CurMove, CurInput, CurSizing, CurIcon,
         CurNone,
- CurLast
-};
-
-enum {
+ CurLast,
+};
+
+enum {
         NCOL = 16,
- WM_PROTOCOL_DELWIN = 1
+ WM_PROTOCOL_DELWIN = 1,
 };
 
 /* Data Structures */
diff -r ffe49100c79d -r 8c8fcf21722e cmd/wmii/fns.h
--- a/cmd/wmii/fns.h Mon Jul 02 12:46:01 2007 -0400
+++ b/cmd/wmii/fns.h Mon Jul 02 13:31:29 2007 -0400
@@ -127,13 +127,13 @@ void* hashrm(Map*, char*);
 void* hashrm(Map*, char*);
 
 /* message.c */
-char * getword(IxpMsg*);
-Area * strarea(View*, char*);
-char * message_view(View*, IxpMsg*);
-char * parse_colors(IxpMsg*, CTuple*);
-char * message_root(void*, IxpMsg*);
-char * read_root_ctl(void);
-char * message_client(Client*, IxpMsg*);
+char *getword(IxpMsg*);
+Area *strarea(View*, char*);
+char *message_view(View*, IxpMsg*);
+char *parse_colors(IxpMsg*, CTuple*);
+char *message_root(void*, IxpMsg*);
+char *read_root_ctl(void);
+char *message_client(Client*, IxpMsg*);
 char *select_area(Area*, IxpMsg*);
 char *send_client(View*, IxpMsg*, Bool swap);
 
diff -r ffe49100c79d -r 8c8fcf21722e cmd/wmii/fs.c
--- a/cmd/wmii/fs.c Mon Jul 02 12:46:01 2007 -0400
+++ b/cmd/wmii/fs.c Mon Jul 02 13:31:29 2007 -0400
@@ -699,7 +699,6 @@ fs_read(Ixp9Req *r) {
         assert(!"Read called on an unreadable file");
 }
 
-/* This function needs to be seriously cleaned up */
 void
 fs_write(Ixp9Req *r) {
         FileId *f;
diff -r ffe49100c79d -r 8c8fcf21722e cmd/wmii/message.c
--- a/cmd/wmii/message.c Mon Jul 02 12:46:01 2007 -0400
+++ b/cmd/wmii/message.c Mon Jul 02 13:31:29 2007 -0400
@@ -12,13 +12,12 @@
 
 static char
         Ebadcmd[] = "bad command",
- Ebadvalue[] = "bad value";
+ Ebadvalue[] = "bad value",
+ Ebadusage[] = "bad usage";
 
 /* Edit |sort Edit s/"([^"]+)"/L\1/g Edit |tr 'a-z' 'A-Z' */
 enum {
         LFULLSCREEN,
- LNOTFULLSCREEN,
- LNOTURGENT,
         LURGENT,
         LBORDER,
         LCLIENT,
@@ -31,6 +30,8 @@ enum {
         LKILL,
         LLEFT,
         LNORMCOLORS,
+ LOFF,
+ LON,
         LQUIT,
         LRIGHT,
         LSELCOLORS,
@@ -44,8 +45,6 @@ enum {
 };
 char *symtab[] = {
         "Fullscreen",
- "NotFullscreen",
- "NotUrgent",
         "Urgent",
         "border",
         "client",
@@ -58,6 +57,8 @@ char *symtab[] = {
         "kill",
         "left",
         "normcolors",
+ "off",
+ "on",
         "quit",
         "right",
         "selcolors",
@@ -78,6 +79,9 @@ static int
 static int
 getsym(char *s) {
         int i, n, m, cmp;
+
+ if(s == nil)
+ return -1;
 
         n = nelem(symtab);
         i = 0;
@@ -96,6 +100,20 @@ getsym(char *s) {
         return -1;
 }
 
+static int
+gettoggle(IxpMsg *m) {
+ switch(getsym(getword(m))) {
+ case LON:
+ return On;
+ case LOFF:
+ return Off;
+ case LTOGGLE:
+ return Toggle;
+ default:
+ return -1;
+ }
+}
+
 static void
 eatrunes(IxpMsg *m, int (*p)(Rune), int val) {
         Rune r;
@@ -129,7 +147,6 @@ getword(IxpMsg *m) {
                 return nil;
         return ret;
 }
-
 
 #define strbcmp(str, const) (strncmp((str), (const), sizeof(const)-1))
 static int
@@ -369,6 +386,7 @@ char *
 char *
 message_client(Client *c, IxpMsg *m) {
         char *s;
+ int i;
 
         s = getword(m);
 
@@ -377,16 +395,16 @@ message_client(Client *c, IxpMsg *m) {
                 kill_client(c);
                 break;
         case LURGENT:
- set_urgent(c, True, True);
- break;
- case LNOTURGENT:
- set_urgent(c, False, True);
+ i = gettoggle(m);
+ if(i == -1)
+ return Ebadusage;
+ set_urgent(c, i, True);
                 break;
         case LFULLSCREEN:
- fullscreen(c, True);
- break;
- case LNOTFULLSCREEN:
- fullscreen(c, False);
+ i = gettoggle(m);
+ if(i == -1)
+ return Ebadusage;
+ fullscreen(c, i);
                 break;
         default:
                 return Ebadcmd;
diff -r ffe49100c79d -r 8c8fcf21722e cmd/wmii/x11.c
--- a/cmd/wmii/x11.c Mon Jul 02 12:46:01 2007 -0400
+++ b/cmd/wmii/x11.c Mon Jul 02 13:31:29 2007 -0400
@@ -15,9 +15,9 @@ Point ZP = {0, 0};
 Point ZP = {0, 0};
 Rectangle ZR = {{0, 0}, {0, 0}};
 
-Map wmap, amap;
-MapEnt *wbucket[137];
-MapEnt *abucket[137];
+static Map wmap, amap;
+static MapEnt *wbucket[137];
+static MapEnt *abucket[137];
 
 XRectangle
 XRect(Rectangle r) {
@@ -117,7 +117,7 @@ Wfmt(Fmt *f) {
         Window *w;
 
         w = va_arg(f->args, Window*);
- return fmtprint(f, "0x%ux", w);
+ return fmtprint(f, "0x%ux", w->w);
 }
 
 /* Init */
diff -r ffe49100c79d -r 8c8fcf21722e rc/rc.wmii.rc
--- a/rc/rc.wmii.rc Mon Jul 02 12:46:01 2007 -0400
+++ b/rc/rc.wmii.rc Mon Jul 02 13:31:29 2007 -0400
@@ -215,7 +215,7 @@ fn Key-$MODKEY-Return { run_command $WMI
 fn Key-$MODKEY-Return { run_command $WMII_TERM & }
 fn Key-$MODKEY-t { wmiir xwrite /ctl view `{read_tags | wmiimenu} & }
 fn Key-$MODKEY-Shift-t {
- wmiir xwrite /client/`{wmiir read /client/sel/ctl}^/tags `{read_tags | wmiimenu} &
+ wmiir xwrite /client/`{wmiir read /client/sel/ctl|sed 1q}^/tags `{read_tags | wmiimenu} &
 }
 
 fn Key-$MODKEY-^`{seq 0 9} { wmiir xwrite /ctl view `{echo $1 | sed 's/.*-//'} }
Received on Mon Jul 02 2007 - 19:33:54 UTC

This archive was generated by hypermail 2.2.0 : Sun Jul 13 2008 - 15:57:30 UTC