window IDs are provided in hexadecimal format, but understood in both decimal and hexadecimal

This commit is contained in:
Denis Grelich 2007-02-02 17:43:22 +01:00
parent 31c7d39da4
commit 6f11af4fbb
4 changed files with 16 additions and 13 deletions

View File

@ -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

View File

@ -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

6
fs.c
View File

@ -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);

15
view.c
View File

@ -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;