2019-09-04 22:32:39 +00:00
|
|
|
|
|
|
|
static int useargb = 0;
|
|
|
|
static Visual *visual;
|
|
|
|
static int depth;
|
|
|
|
static Colormap cmap;
|
|
|
|
|
|
|
|
void
|
|
|
|
xinitvisual()
|
|
|
|
{
|
|
|
|
XVisualInfo *infos;
|
|
|
|
XRenderPictFormat *fmt;
|
|
|
|
int nitems;
|
|
|
|
int i;
|
|
|
|
|
|
|
|
XVisualInfo tpl = {
|
|
|
|
.screen = screen,
|
|
|
|
.depth = 32,
|
|
|
|
.class = TrueColor
|
|
|
|
};
|
|
|
|
long masks = VisualScreenMask | VisualDepthMask | VisualClassMask;
|
|
|
|
|
|
|
|
infos = XGetVisualInfo(dpy, masks, &tpl, &nitems);
|
|
|
|
visual = NULL;
|
|
|
|
for (i = 0; i < nitems; i ++) {
|
|
|
|
fmt = XRenderFindVisualFormat(dpy, infos[i].visual);
|
|
|
|
if (fmt->type == PictTypeDirect && fmt->direct.alphaMask) {
|
|
|
|
visual = infos[i].visual;
|
|
|
|
depth = infos[i].depth;
|
|
|
|
cmap = XCreateColormap(dpy, root, visual, AllocNone);
|
|
|
|
useargb = 1;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
XFree(infos);
|
|
|
|
|
2020-07-18 11:03:30 +00:00
|
|
|
if (!visual) {
|
2019-09-04 22:32:39 +00:00
|
|
|
visual = DefaultVisual(dpy, screen);
|
|
|
|
depth = DefaultDepth(dpy, screen);
|
|
|
|
cmap = DefaultColormap(dpy, screen);
|
|
|
|
}
|
|
|
|
}
|
2021-06-14 05:16:17 +00:00
|
|
|
|