more bling

It turns out that Mirco “MacSlow” Mueller beat me to it, with his awesome Cairo Clock demos!

It’s nice to see that somebody else is producing demos of how to do this stuff – I found the code I needed by asking the GTK+ people, who pointed me towards the “testgtk.c” testcase file in CVS. A bit hard to find on your own! I wish I’d know about Mircos work before. Get your work on the Cairo examples page dude!

He has also done it far better than I did, with even a spiffy video to go with the code. That said, the code to set input area along with the drawing is quite complicated, so hopefully GTK+ will soon be supporting all this natively so we don’t have to write the boilerplate screen/cm handling code over and over (as pointed out by desrt in the comments, I got this slightly wrong).

Ray Strode says that Metacity already marks its presence in a detectable way, and I know the XFCE compositor does as well. The protocol these programs are using needs to be documented somewhere (EWMH spec?), or maybe the Composite extension home page on

A few questions remain:

  • Is it possible to get a pixmap containing whatever is underneath your window? Right now we can draw an alpha channel and get translucency, which is great. But how would you make a window that blurs whatever is underneath it (to give a thick-sheet-of-glass effect?).
  • The window tears when resizing on my computer and in MacSlows demo. Is this fixed by the new compiz/metacity compositors?
About these ads

4 Responses to “more bling”

  1. MacSlow Says:

    Regarding that “thick-sheet-of-glass” effect… this would only be easily possible with GLSL fragment-shader I think… and for those to work in a composited environment (e.g. Xgl/compiz) we would need to get rid of those software-based Mesa-hacks for getting the GL_EXT_texture_from_pixmap extension. I’m hoping everyday to read something like “nvidia releases new linux-driver with GL_EXT_texture_from_pixmap support” :)

    I’m not 100% sure if – once we have Xgl & Co running on a fully hw-accelerated OpenGL 2.0 stack – the “thick-sheet-of-glass” effect would then need to be implemented at the compositing-manager level or if an application could do this directly. for such a fragment-shader to work one would have to be able to read the contents of the framebuffer (or have general “knowledge” of the desktop-contents).

    Best regards…


  2. Mike Says:

    Yeah. What I really want is an API that lets me get a pixmap of what’s under the window, that we can then transform in some arbitrary way and draw …. probably some combination of XComposite and XDamage APIs can do it? The way the actual blur is implemented would be up the app.

  3. Max Says:

    I really don’t know much about that kind of stuff but i think that’s just the way transperency used to work with old gnometerminals etc. I think the problem with this approach is that it is terribly slow and difficult to use windows below. If you get a pixmap and move the window the pixmap would have to change while moving the window or it looks like you move away parts of the underlying windows.
    AFAIK (and that’s not very far ;-) ) image content now is a pixmap that is converted into a texture and then drawn by an openGL engine. For your idea you’d have to…
    start with the background
    loop over the windows going from lowest to highest
    render all windows dealt with so far into background pixmap
    change pixmap
    put pixmap onto surface as texture

    I think if you want to be able to smoothly move your glass window infront of another window you’d need an opengl way of doing it – and i don’t know if there is one but i don’t think there is. i think that would need ray-tracing.

  4. Mike Says:

    It doesn’t need raytracing, a simple blur effect would work fine and can be implemented in software or GLSL just fine.

    The hard part is:

    a) Convincing the X server to puke out a pixmap of what’s underneath your window. It can do this, it’s what XCOMPOSITE is all about, but I have no clue what the code would look like

    b) Making sure that it’s all smoothly updated when the contents underneath the window changes or the window is moved (XDAMAGE)

Leave a Reply

Please log in using one of these methods to post your comment: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


Get every new post delivered to your Inbox.

%d bloggers like this: