Search code examples
gtktransparencygtk3headlessxvfb

Xvfb GTK3 transparency


I have a GTK a application which creates "transparent" windows using the following snippet of code

GdkScreen* screen = gtk_window_get_screen(window);
GdkVisual* screen_visual = gdk_screen_get_rgba_visual(screen);
gtk_widget_set_visual(GTK_WIDGET(window), screen_visual);
gtk_widget_set_app_paintable(GTK_WIDGET(window), true);

This works just fine when running on a "regular" display and the windows are correctly layered on top of each other, however when running it in an Xvfb screen, using something like this Xvfb :0 -nocursor -screen 0 1920x1080x24+32 +extension RANDR +extension XVideo +extension RENDER, GTK completely disables the transparancy and the windows end up being opaque. (resuting in only the top layer window being visible)

Is there a way to allow GTK to create this transparancy inside the headless screen?


Solution

  • For anyone looking into the same issue, I was missing an x composite manager for Xvfb (such as xcompmgr). When running this for the Xvfb display it works as expected.