[hackers] wmii: new tip (= 1713)

From: Anselm R. Garbe <arg_AT_suckless.org>
Date: Fri, 02 Feb 2007 17:50:03 +0100

changeset: 1713:b679aeeb9fb6
tag: tip
user: Denis Grelich <denisg_AT_suckless.org>
date: Fri Feb 02 17:43:22 2007 +0100
files: client.c event.c fs.c view.c
description:
window IDs are provided in hexadecimal format, but understood in both decimal and hexadecimal

diff -r f4f25de0de54 -r b679aeeb9fb6 client.c
--- a/client.c Sun Jan 28 13:26:01 2007 +0100
+++ b/client.c Fri Feb 02 17:43:22 2007 +0100
@@ -109,7 +109,7 @@ create_client(Window w, XWindowAttribute
         for(t=&client; *t; t=&(*t)->next);
         c->next = *t; /* *t == NULL */
         *t = c;
- write_event("CreateClient %d\n", c->win);
+ write_event("CreateClient 0x%x\n", c->win);
         return c;
 }
 
@@ -177,7 +177,7 @@ focus_client(Client *c, Bool restack) {
                 if(a_i) write_event("ColumnFocus %d\n", a_i);
                 else write_event("FocusFloating\n");
         }
- write_event("ClientFocus %d\n", c->win);
+ write_event("ClientFocus 0x%x\n", c->win);
 }
 
 void
@@ -395,7 +395,7 @@ destroy_client(Client *c) {
         XSetErrorHandler(wmii_error_handler);
         XUngrabServer(blz.dpy);
         flush_masked_events(EnterWindowMask);
- write_event("DestroyClient %d\n", c->win);
+ write_event("DestroyClient 0x%x\n", c->win);
 }
 
 void
diff -r f4f25de0de54 -r b679aeeb9fb6 event.c
--- a/event.c Sun Jan 28 13:26:01 2007 +0100
+++ b/event.c Fri Feb 02 17:43:22 2007 +0100
@@ -74,7 +74,7 @@ buttonrelease(XEvent *e) {
                         }
         }
         else if((f = frame_of_win(ev->window)))
- write_event("ClientClick %d %d\n", f->client->win, ev->button);
+ write_event("ClientClick 0x%x %d\n", f->client->win, ev->button);
 }
 
 static void
diff -r f4f25de0de54 -r b679aeeb9fb6 fs.c
--- a/fs.c Sun Jan 28 13:26:01 2007 +0100
+++ b/fs.c Fri Feb 02 17:43:22 2007 +0100
@@ -391,7 +391,7 @@ lookup_file(FileId *parent, char *name)
                                         }if(name) goto LastItem;
                                 }
                                 if(name) {
- id = (unsigned int)strtol(name, &name, 10);
+ id = (unsigned int)strtol(name, &name, 16);
                                         if(*name) goto NextItem;
                                 }
                                 for(c=client; c; c=c->next) {
@@ -403,7 +403,7 @@ lookup_file(FileId *parent, char *name)
                                                 file->id = c->win;
                                                 file->tab = *dir;
                                                 file->tab.name = ixp_emallocz(16);
- snprintf(file->tab.name, 16, "%d", c->win);
+ snprintf(file->tab.name, 16, "0x%x", (unsigned int)c->win);
                                                 if(name) goto LastItem;
                                         }
                                 }
@@ -654,7 +654,7 @@ fs_read(P9Req *r) {
                                 return;
                         }
                         r->ofcall.data.rread.data = ixp_emallocz(16);
- n = snprintf(r->ofcall.data.rread.data, 16, "%d", f->index);
+ n = snprintf(r->ofcall.data.rread.data, 16, "0x%x", (unsigned int)f->index);
                         assert(n >= 0);
                         r->ofcall.data.rread.count = n;
                         respond(r, NULL);
diff -r f4f25de0de54 -r b679aeeb9fb6 view.c
--- a/view.c Sun Jan 28 13:26:01 2007 +0100
+++ b/view.c Fri Feb 02 17:43:22 2007 +0100
@@ -286,13 +286,13 @@ view_index(View *v) {
                 for(f=a->frame; f && len > 0; f=f->anext) {
                         XRectangle *r = &f->rect;
                         if(a->floating)
- n = snprintf(&buffer[buf_i], len, "~ %d %d %d %d %d %s\n",
- f->client->win,
+ n = snprintf(&buffer[buf_i], len, "~ 0x%x %d %d %d %d %s\n",
+ (unsigned int)f->client->win,
                                                 r->x, r->y, r->width, r->height,
                                                 f->client->props);
                         else
- n = snprintf(&buffer[buf_i], len, "%d %d %d %d %s\n",
- a_i, f->client->win, r->y,
+ n = snprintf(&buffer[buf_i], len, "%d 0x%x %d %d %s\n",
+ a_i, (unsigned int)f->client->win, r->y,
                                                 r->height, f->client->props);
                         if(len - n < 0)
                                 return (unsigned char *)buffer;
@@ -305,14 +305,17 @@ view_index(View *v) {
 
 Client *
 client_of_message(View *v, char *message, unsigned int *next) {
- unsigned int id;
+ unsigned long id = 0;
         Client *c;
 
         if(!strncmp(message, "sel ", 4)) {
                 *next = 4;
                 return sel_client_of_view(v);
         }
- if((1 != sscanf(message, "%d %n", &id, next)))
+ sscanf(message, "0x%lx %n", &id, next);
+ if(!id)
+ sscanf(message, "%lu %n", &id, next);
+ if(!id)
                 return NULL;
     for(c=client; c && c->win!=id; c=c->next);
         return c;
Received on Fri Feb 02 2007 - 17:50:03 UTC

This archive was generated by hypermail 2.2.0 : Sun Jul 13 2008 - 15:54:50 UTC