Previous Entry Share Next Entry
(By the way, there's now a movie up at the Ghosd home page.)

It turns out my computer at work has the fancy nVidia card necessary to run X + the compositing extension, so now all of my windows have gratuitous drop shadows. (It's no XGL/Compiz, though...)

I had originally intended for Ghosd to use this extension when it was available, for it allows hardware acceleration of "real" transparent windows. But now that I have hacked it up (surprisingly easy, by the way: XChangeProperty with _NET_WM_WINDOW_OPACITY), I realize it's not enough, for two reasons:
  1. The current Ghosd drawing model is that if you draw any shape with alpha < 1, the screen shows through. It's as if you're drawing to the screen directly. This is hard to rectify with a window-level alpha.
    This is fixable; it's not hard to change the API to have a window-level alpha in addition to the existing alpha support.
  2. But, even with that, when you do draw to the window with alpha < 1, Cairo wants to merge that color with whatever is underneath, so you need some color underneath. So I need to copy the screen anyway.
Another way of saying that is that this "transparent windows" feature gives me per-window alpha, while what I need is per-pixel alpha on the window. For the antialiased rounded edge of a font, the alpha varies all along, and so what I really need to draw into the window is RGBA, not RGB with a window-level A.

But now that I've written all that, it may be worth special-casing window-level alpha anyway, as it's likely I can fade the alpha much more quickly using the hardware than what I'm doing right now (rapidly redrawing/combining with different levels of alpha). This would allow rapid fade-ins and fade-outs.