declare variables at the top of the blocks
This commit is contained in:
parent
0cceca2303
commit
ddb6bd4667
1 changed files with 144 additions and 140 deletions
|
@ -65,13 +65,16 @@ int main(int argc, char **argv)
|
||||||
long offset = 0;
|
long offset = 0;
|
||||||
unsigned int image = 0;
|
unsigned int image = 0;
|
||||||
unsigned int j; // loop counter
|
unsigned int j; // loop counter
|
||||||
|
Window id, win;
|
||||||
|
Pixmap p;
|
||||||
|
Cursor cur;
|
||||||
|
XEvent ev;
|
||||||
|
|
||||||
printf("Click on a window with an icon...\n");
|
printf("Click on a window with an icon...\n");
|
||||||
|
|
||||||
//int id = strtol(argv[1], NULL, 16);
|
//int id = strtol(argv[1], NULL, 16);
|
||||||
XUngrabPointer(d, CurrentTime);
|
XUngrabPointer(d, CurrentTime);
|
||||||
Window id;
|
cur = XCreateFontCursor(d, XC_crosshair);
|
||||||
Cursor cur = XCreateFontCursor(d, XC_crosshair);
|
|
||||||
XGrabPointer(d, RootWindow(d, s), False, ButtonPressMask, GrabModeAsync,
|
XGrabPointer(d, RootWindow(d, s), False, ButtonPressMask, GrabModeAsync,
|
||||||
GrabModeAsync, None, cur, CurrentTime);
|
GrabModeAsync, None, cur, CurrentTime);
|
||||||
XEvent ev;
|
XEvent ev;
|
||||||
|
@ -154,16 +157,17 @@ int main(int argc, char **argv)
|
||||||
++image;
|
++image;
|
||||||
} while (ret_bytesleft > 0 && image < MAX_IMAGES);
|
} 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);
|
0, 0, 0);
|
||||||
assert(win);
|
assert(win);
|
||||||
XMapWindow(d, 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);
|
XFillRectangle(d, p, DefaultGC(d, s), 0, 0, winw, winh);
|
||||||
|
|
||||||
unsigned int x = 0;
|
|
||||||
for (j = 0; j < image; ++j) {
|
for (j = 0; j < image; ++j) {
|
||||||
|
static unsigned int x = 0;
|
||||||
|
|
||||||
XPutImage(d, p, DefaultGC(d, s), i[j], 0, 0, x, 0,
|
XPutImage(d, p, DefaultGC(d, s), i[j], 0, 0, x, 0,
|
||||||
i[j]->width, i[j]->height);
|
i[j]->width, i[j]->height);
|
||||||
x += i[j]->width;
|
x += i[j]->width;
|
||||||
|
|
Loading…
Reference in a new issue