declare variables at the top of the blocks

This commit is contained in:
Dana Jansens 2003-09-21 16:47:42 +00:00
parent 0cceca2303
commit ddb6bd4667

View file

@ -65,13 +65,16 @@ int main(int argc, char **argv)
long offset = 0;
unsigned int image = 0;
unsigned int j; // loop counter
Window id, win;
Pixmap p;
Cursor cur;
XEvent ev;
printf("Click on a window with an icon...\n");
//int id = strtol(argv[1], NULL, 16);
XUngrabPointer(d, CurrentTime);
Window id;
Cursor cur = XCreateFontCursor(d, XC_crosshair);
cur = XCreateFontCursor(d, XC_crosshair);
XGrabPointer(d, RootWindow(d, s), False, ButtonPressMask, GrabModeAsync,
GrabModeAsync, None, cur, CurrentTime);
XEvent ev;
@ -154,16 +157,17 @@ int main(int argc, char **argv)
++image;
} while (ret_bytesleft > 0 && image < MAX_IMAGES);
Window win = XCreateSimpleWindow(d, RootWindow(d, s), 0, 0, winw, winh,
win = XCreateSimpleWindow(d, RootWindow(d, s), 0, 0, winw, winh,
0, 0, 0);
assert(win);
XMapWindow(d, win);
Pixmap p = XCreatePixmap(d, win, winw, winh, DefaultDepth(d, s));
p = XCreatePixmap(d, win, winw, winh, DefaultDepth(d, s));
XFillRectangle(d, p, DefaultGC(d, s), 0, 0, winw, winh);
unsigned int x = 0;
for (j = 0; j < image; ++j) {
static unsigned int x = 0;
XPutImage(d, p, DefaultGC(d, s), i[j], 0, 0, x, 0,
i[j]->width, i[j]->height);
x += i[j]->width;