【发布时间】:2014-04-14 03:43:26
【问题描述】:
我想创建一个具有透明背景的窗口。怎么做?
我用XSetBackground(display, gc, 0),背景是黑色。我将屏幕的深度更改为32。结果还是黑的。这是我的代码:
display = XOpenDisplay(getenv("DISPALY"));
screen = DefaultScreen(display);
depth = DefaultDepth(display,screen);
printf("depth: %d\n", depth);
rootwindow = RootWindow(display,screen);
XVisualInfo vinfo;
XMatchVisualInfo(display, DefaultScreen(display), 32, TrueColor, &vinfo);
XSetWindowAttributes attr;
attr.colormap = XCreateColormap(display, DefaultRootWindow(display), vinfo.visual, AllocNone);
attr.border_pixel = 0;
attr.background_pixel = 0;
window = XCreateWindow(display, DefaultRootWindow(display), 0, 0, 1440, 900, 0, vinfo.depth, InputOutput,
vinfo.visual, CWColormap | CWBorderPixel | CWBackPixel, &attr);
gc = XCreateGC (display, window, 0, NULL);
XSetBackground(display, gc, 0L);
【问题讨论】:
标签: background transparent xlib