- // printf("%dx%d\n", allocation->width, allocation->height);
- if (scr_w != allocation->width - 2 || scr_h != allocation->height - 2) {
- scr_w = allocation->width - 2;
- scr_h = allocation->height - 2;
- scr_changed = 1;
- }
+ void *xlib_screen;
+
+ XLockDisplay(xlib_display);
+
+ if (ximage != NULL)
+ XDestroyImage(ximage);
+ ximage = NULL;
+
+ xlib_screen = calloc(scr_w * scr_h, 4);
+ if (xlib_screen != NULL)
+ ximage = XCreateImage(display, visual, 24, ZPixmap, 0,
+ xlib_screen, scr_w, scr_h, 32, 0);
+ if (ximage == NULL)
+ fprintf(stderr, "failed to alloc ximage\n");
+
+ XUnlockDisplay(xlib_display);