- Window parent = win;
- unsigned int i;
- for (i = 0; i < 16 && parent != RootWindow(display, screen); i++) {
- Window r, *children;
- unsigned int n;
-
- XSetWindowBackgroundPixmap(display, parent,
- ParentRelative);
-
- XQueryTree(display, parent, &r, &parent, &children, &n);
- XFree(children);
+ static int colour_set = -1;
+ if (set_transparent) {
+ Window parent = win;
+ unsigned int i;
+ for (i = 0; i < 50 && parent != RootWindow(display, screen); i++) {
+ Window r, *children;
+ unsigned int n;
+
+ XSetWindowBackgroundPixmap(display, parent, ParentRelative);
+
+ XQueryTree(display, parent, &r, &parent, &children, &n);
+ XFree(children);
+ }
+ } else if (colour_set != background_colour) {
+ XSetWindowBackground(display, win, background_colour);
+ colour_set = background_colour;