Search code examples
c#c++gtkx11

Create a layered window on Linux X11/Gtk


My question is generally how can I create and position layered windows on Linux using X11 or some toolkit such as Gtk. When I say layered window I mean a window which whose shape and transparency is defined by a pixel data containing rgb and alpha (transparency) channels. See the screenshot below.

I've used them extensively on Windows using the simple enough UpdateLayeredWindow API and am wondering how to do the same thing on Linux.

Thanks.

Layered butterflies on Windows


Solution

  • X11 originally supports only one-bit transparency (requires the SHAPE extension, but these days nearly all X11 servers implement it). Use XShapeCombineMask or gtk_widget_shape_combine_mask functions.

    If you want antialiased transparency, then probably the simplest way is to use the cairo toolkit. An example can be found here.