- GC gc = XCreateGC (dpy, window, 0, &gcv);
- Colormap cmap;
- XWindowAttributes xgwa;
- XGetWindowAttributes (dpy, window, &xgwa);
- cmap = xgwa.colormap;
+ GC gc = XCreateGC (dpy, drawable, 0, &gcv);
+
+ if (width <= 0 || height <= 0)
+ {
+ Window root;
+ int xx, yy;
+ unsigned int bw, d;
+ XGetGeometry (dpy, drawable,
+ &root, &xx, &yy,
+ (unsigned int *) &width,
+ (unsigned int *) &height,
+ &bw, &d);
+ }