Saturday 29 July 2006
RGBA Windows
Today we had a sort of mini-hackfest at the office. Earlier in the week Larry Ewing had shown how to use Xgl+compiz's support for RGBA windows to implement window translucency in F-Spot in a very nice way, so I thought I'd extend Mozilla's translucent window support to use this mechanism. Up till now, on X we've only used the Shape extension, which only provides 1-bit transparency.
In a cairo build, it is almost no effort to implement. Basically you just need to call gdk_screen_get_rgba_colormap and make that the colormap for the toplevel GTK widget. A general patch for Mozilla will be a little more complicated because we need to set the colormap before "realizing" the widget, at which point we don't actually know whether the window will need translucency or not. I'm not quite sure what to do about this, but it might be OK to just always use RGBA windows all the time when Xgl and compiz are active (which we can detect).
Obligatory eye candy follows. The example is a standalone HTML document with a transparent background, containing HTML form widgets, script, and SVG.
In a cairo build, it is almost no effort to implement. Basically you just need to call gdk_screen_get_rgba_colormap and make that the colormap for the toplevel GTK widget. A general patch for Mozilla will be a little more complicated because we need to set the colormap before "realizing" the widget, at which point we don't actually know whether the window will need translucency or not. I'm not quite sure what to do about this, but it might be OK to just always use RGBA windows all the time when Xgl and compiz are active (which we can detect).
Obligatory eye candy follows. The example is a standalone HTML document with a transparent background, containing HTML form widgets, script, and SVG.
Comments
db48x: This example is a bit over the top, but I have seen examples that make sense. For example F-Spot has a magnification lens window that floats over your photo and is an odd shape, part of which is a translucent overlay over the photo. It's hard to describe but I can't find a screenshot. Also people apparently like to use this stuff for OSX Dashboard widgets and the like, for shadow effects etc.
I just read that translucent window support made it into "Bon Echo 2" but i can't find any code on how to use/set it (newbie here ^_^).
Cheers,
Jens
I'm trying to achieve something similar with mozilla and GTK2. How did you manage to get the window translucent exactly? Any pointers or diffs to original code would be greatly appreciated. Thanks.
BR,
PV
You were using thebes gfx? In this version that I'm hacking gtk gfx is used, i.e. no cairo_push_group used. And mozilla is used via libgtkmozembed...