From 6f11af4fbbf569007a737cc0d2426740663c7800 Mon Sep 17 00:00:00 2001 From: Denis Grelich Date: Fri, 2 Feb 2007 17:43:22 +0100 Subject: [PATCH] window IDs are provided in hexadecimal format, but understood in both decimal and hexadecimal --- client.c | 6 +++--- event.c | 2 +- fs.c | 6 +++--- view.c | 15 +++++++++------ 4 files changed, 16 insertions(+), 13 deletions(-) diff --git a/client.c b/client.c index 0a337442..c7fc432f 100644 --- a/client.c +++ b/client.c @@ -109,7 +109,7 @@ create_client(Window w, XWindowAttributes *wa) { 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 --git a/event.c b/event.c index 7147faa9..433df6f7 100644 --- a/event.c +++ b/event.c @@ -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 --git a/fs.c b/fs.c index b4cb5acf..09b5723a 100644 --- a/fs.c +++ b/fs.c @@ -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 --git a/view.c b/view.c index fa238750..e62dfe9f 100644 --- a/view.c +++ b/view.c @@ -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;