How to set Xlib window background transpatrent?
LIDE
1053481745 at qq.com
Sun Apr 13 19:48:04 PDT 2014
Hi:
I want to create a window that has transparent background.How to do?I use XSetBackground(display, gc, 0), the background is black.I change the depth of the screen to 32.The resault is still black.Here is my code:
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);
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.x.org/archives/xorg/attachments/20140414/fc65c283/attachment-0001.html>
More information about the xorg
mailing list