+ unsigned int n, i;
+ Atom state = XInternAtom(d, "WM_STATE", True);
+ Atom ret_type;
+ int ret_format;
+ unsigned long ret_items, ret_bytesleft;
+ unsigned long *prop_return;
+
XQueryTree(d, win, &r, &r, &children, &n);
XQueryTree(d, win, &r, &r, &children, &n);
- Atom state = XInternAtom(d, "WM_STATE", true);
- Atom ret_type;
- int ret_format;
- unsigned long ret_items, ret_bytesleft;
- unsigned long *prop_return;
XGetWindowProperty(d, win, state, 0, 1,
XGetWindowProperty(d, win, state, 0, 1,
- false, state, &ret_type, &ret_format,
+ False, state, &ret_type, &ret_format,
&ret_items, &ret_bytesleft,
(unsigned char**) &prop_return);
if (ret_type == None || ret_items < 1)
&ret_items, &ret_bytesleft,
(unsigned char**) &prop_return);
if (ret_type == None || ret_items < 1)
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);
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);
- XGrabPointer(d, RootWindow(d, s), false, ButtonPressMask, GrabModeAsync,
+ XGrabPointer(d, RootWindow(d, s), False, ButtonPressMask, GrabModeAsync,
GrabModeAsync, None, cur, CurrentTime);
XEvent ev;
GrabModeAsync, None, cur, CurrentTime);
XEvent ev;
XNextEvent(d, &ev);
if (ev.type == ButtonPress) {
XUngrabPointer(d, CurrentTime);
XNextEvent(d, &ev);
if (ev.type == ButtonPress) {
XUngrabPointer(d, CurrentTime);
XGetWindowProperty(d, id, net_wm_icon, offset++, 1,
XGetWindowProperty(d, id, net_wm_icon, offset++, 1,
- false, XA_CARDINAL, &ret_type, &ret_format,
+ False, XA_CARDINAL, &ret_type, &ret_format,
&ret_items, &ret_bytesleft,
(unsigned char**) &prop_return[image]);
if (ret_type == None || ret_items < 1) {
printf("No icon found\n");
return 1;
}
&ret_items, &ret_bytesleft,
(unsigned char**) &prop_return[image]);
if (ret_type == None || ret_items < 1) {
printf("No icon found\n");
return 1;
}
XFree(prop_return[image]);
XGetWindowProperty(d, id, net_wm_icon, offset++, 1,
XFree(prop_return[image]);
XGetWindowProperty(d, id, net_wm_icon, offset++, 1,
- false, XA_CARDINAL, &ret_type, &ret_format,
+ False, XA_CARDINAL, &ret_type, &ret_format,
&ret_items, &ret_bytesleft,
(unsigned char**) &prop_return[image]);
if (ret_type == None || ret_items < 1) {
printf("Failed to get height\n");
return 1;
}
&ret_items, &ret_bytesleft,
(unsigned char**) &prop_return[image]);
if (ret_type == None || ret_items < 1) {
printf("Failed to get height\n");
return 1;
}
XFree(prop_return[image]);
XGetWindowProperty(d, id, net_wm_icon, offset, w*h,
XFree(prop_return[image]);
XGetWindowProperty(d, id, net_wm_icon, offset, w*h,
- false, XA_CARDINAL, &ret_type, &ret_format,
+ False, XA_CARDINAL, &ret_type, &ret_format,
&ret_items, &ret_bytesleft,
(unsigned char**) &prop_return[image]);
if (ret_type == None || ret_items < w*h) {
&ret_items, &ret_bytesleft,
(unsigned char**) &prop_return[image]);
if (ret_type == None || ret_items < w*h) {
i[image] = XCreateImage(d, DefaultVisual(d, s), DefaultDepth(d, s),
ZPixmap, 0, NULL, w, h, 32, 0);
assert(i[image]);
i[image]->byte_order = LSBFirst;
i[image]->data = (char*)prop_return[image];
i[image] = XCreateImage(d, DefaultVisual(d, s), DefaultDepth(d, s),
ZPixmap, 0, NULL, w, h, 32, 0);
assert(i[image]);
i[image]->byte_order = LSBFirst;
i[image]->data = (char*)prop_return[image];
unsigned char alpha = (unsigned char)i[image]->data[j*4+3];
unsigned char r = (unsigned char) i[image]->data[j*4+0];
unsigned char g = (unsigned char) i[image]->data[j*4+1];
unsigned char b = (unsigned char) i[image]->data[j*4+2];
// background color
unsigned char alpha = (unsigned char)i[image]->data[j*4+3];
unsigned char r = (unsigned char) i[image]->data[j*4+0];
unsigned char g = (unsigned char) i[image]->data[j*4+1];
unsigned char b = (unsigned char) i[image]->data[j*4+2];
// background color
Window win = XCreateSimpleWindow(d, RootWindow(d, s), 0, 0, winw, winh,
0, 0, 0);
assert(win);
Window win = XCreateSimpleWindow(d, RootWindow(d, s), 0, 0, winw, winh,
0, 0, 0);
assert(win);
XFillRectangle(d, p, DefaultGC(d, s), 0, 0, winw, winh);
unsigned int x = 0;
XFillRectangle(d, p, DefaultGC(d, s), 0, 0, winw, winh);
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;
XPutImage(d, p, DefaultGC(d, s), i[j], 0, 0, x, 0,
i[j]->width, i[j]->height);
x += i[j]->width;