- XVisualInfo *visinfo = dynamic_cast<const XlibVisual *>(visual)->visinfo;
-
- Window root = RootWindow(display, screen);
-
- /* window attributes */
- XSetWindowAttributes attr;
- attr.background_pixel = 0;
- attr.border_pixel = 0;
- attr.colormap = XCreateColormap(display, root, visinfo->visual, AllocNone);
- attr.event_mask = StructureNotifyMask | ExposureMask | KeyPressMask;
-
- unsigned long mask;
- mask = CWBackPixel | CWBorderPixel | CWColormap | CWEventMask;
-
- int x = 0, y = 0, width = 256, height = 256;
-
- Window window = XCreateWindow(
- display, root,
- x, y, width, height,
- 0,
- visinfo->depth,
- InputOutput,
- visinfo->visual,
- mask,
- &attr);
-
- XSizeHints sizehints;
- sizehints.x = x;
- sizehints.y = y;
- sizehints.width = width;
- sizehints.height = height;
- sizehints.flags = USSize | USPosition;
- XSetNormalHints(display, window, &sizehints);
-
- const char *name = "glretrace";
- XSetStandardProperties(
- display, window, name, name,
- None, (char **)NULL, 0, &sizehints);
-
- XMapWindow(display, window);
-
- return new XlibDrawable(visual, display, window);