- c->dbuf = XCreatePixmap(dpy, win, xgwa.width, xgwa.height, xgwa.depth);
- val.function = GXcopy;
+#ifdef HAVE_DOUBLE_BUFFER_EXTENSION
+ c->back_buf = xdbe_get_backbuffer (c->dpy, c->win, XdbeUndefined);
+#endif /* HAVE_DOUBLE_BUFFER_EXTENSION */
+
+#ifdef HAVE_DOUBLE_BUFFER_EXTENSION
+ if (!c->back_buf)
+#endif /* HAVE_DOUBLE_BUFFER_EXTENSION */
+ c->pix_buf = XCreatePixmap (dpy, win, xgwa.width, xgwa.height,
+ xgwa.depth);