xfdesktop transparent background

Brian J. Tarricone bjt23 at cornell.edu
Mon Nov 8 11:17:53 CET 2004


Didier Trosset wrote:

> Hello,
>
> I've been trying to add a transparent background color style option to 
> xfdesktop. I managed to get it in the setting panel, along with the 
> .po files for the translations, got it compiled and installed (from 
> os-cillation debian source packages).
>
> But then, when it comes to implement it I tried several options but 
> always got into having a non transparent background.

[snip]

> Could someone give me a hint on how to do this?

to put it simply, you can't.

when you're using X without the composite extension (only the x.org 
server, version 6.8.0 and above support composite), there's essentially 
no such thing as a transparent background of a window.  you can set a 
pixmap with an alpha channel with the alpha set to zero, but that won't 
do anything, because X doesn't support transparent windows (essentially, 
there are no X visual types that have an alpha channel, so therefore no 
X windows can have an alpha channel).  you'll still end up seeing the 
"back" of the window.  at various times, people have implemented "fake" 
transparency (in things like terminals) by taking a snapshot of the root 
window, and then painting it as the back pixmap of their window.  i 
suppose you could do something like that with xfdesktop, but i'm not 
going to accept it into the mainline, as it's a hack i'm not fond of.

if you have X _with_ the composite extension, this becomes possible, 
with one small problem: compositing managers don't (can't?) watch the 
real root window, and don't actually composite all windows on top of the 
root.  at least, that's been my experience: when i run a compositing 
manager when xfdesktop isn't running, and then draw on the root window, 
it never shows up on screen.  sometimes i ended up with a BadWindow 
error, which i never really tried to debug.

now, if a composite manager isn't running, it _might_ be possible, 
because x.org 6.8.0+ has a new X visual that supports an alpha channel.  
i messed around with this a little bit, but got distracted by more 
important things.  i think this is really the only way you're going to 
get a transparent xfdesktop window.  that's assuming it works, anyway.  
if you want to do this, i'll consider including it.  but i don't really 
like the idea of using another color style.  probably the way to do this 
would be to add back the old "don't set backdrop" option.  of course, if 
this gets included, it's going to have to query gdk to see if a 32-bit 
visual exists, and only show the option if it does.  i'm not sure, but 
you may have to override XfceDesktop's realize() method, since i think 
the default in GtkWindow is to create a normal window with a 24-bit 
visual (or whatever the default is; but probably rarely 32).  you also 
might need to set your display depth to 32 bits in xorg.conf (but i'm 
not sure about that).  basically, i think working this out is more 
trouble than it's worth, and only a smallish number of people are going 
to be able to use this, and only after reconfiguring their X server.  
but that's just my opinion; feel free to implement it if you still want to.

at any rate, i consider the practice of drawing directly to the real 
root window to be deprecated, at least in the presence of a full desktop 
environment.  freedesktop should create a standard so desktop managers 
like xfdesktop can set a property on the real root window to let other 
apps know the window id of the virtual root window.  xfdesktop does this 
in a property called XFCE_DESKTOP_WINDOW, but obviously this isn't a 
standard that everyone uses.

a final note: this obviously won't be integrated until we branch for 
4.2, as we're in the beta/RC cycle for 4.2 and nothing new is going in 
until HEAD becomes 4.3.

    -brian



More information about the Xfce mailing list