0
votes

So using the code here Why I set xlib window background transparent failed? I have a transparent window.

What I want though is to have a semi transparent window background, how can i do this with c and xlib?

If it helps, I'm using the compton compositor for my desktop enviroment.

1
just draw your background with some alpha value ( note that in x it's pre-multiplied - en.wikipedia.org/wiki/Alpha_compositing#Description ). With pure xlib ( no xrender / glx ) your only option is to prepare 32 bit RGBA data on the client and then draw in onto window or offcxrin pixmap using XPutImage call - Andrey Sidorov

1 Answers

0
votes

As far as I can find, it's impossible to do this in pure xlib. Instead you need to use OpenGL and set the clear color to semitransparent/argb when you draw the window:

glClearColor (0.7, 0.7, 0.7, 0.7);
glClear (GL_COLOR_BUFFER_BIT);
glXSwapBuffers (display, win);
glXWaitGL ();

There is an example here as to how to draw a window in XLib using OpenGL: https://gist.github.com/je-so/903479