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

@ -1,19 +1,19 @@
/* -*- indent-tabs-mode: nil; tab-width: 4; c-basic-offset: 4; -*-
icons.c for the Openbox window manager
Copyright (c) 2003 Ben Jansens
icons.c for the Openbox window manager
Copyright (c) 2003 Ben Jansens
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
See the COPYING file for a copy of the GNU General Public License.
See the COPYING file for a copy of the GNU General Public License.
*/
#include <X11/Xlib.h>
@ -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;