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