At 1259268098 time_t, lukash wrote:
> Thats great! You just set the background pixmap to a pixmap of what's
> drawn under it, right? I've been thinking for the whole day how it
> sucks that this wasn't possible, because the solution suggested before
> would not even allow for a textbox and an imagebox class in Lua, there
> would only be the wibox with both properties...

Well, windows are stacked
root window -> wibox1 -> {wibox2, wibox3}

wibox1 set its background as root window pixmap, and then draw on top of
it. wibox2 copy the content of wibox1, and draw on top of it. wibox3
does the same.

Of course wibox2 and wibox3 are on the same layer in term of parenting,
they have a common parent, so they can overlap, but the transparency
won't work (you may see that on the video, but it's poor quality).

So it's not *real* transparency, but it works at least if no wibox with
the same parent are on top of each other... which should be the common
use case!

> Is it feasible to have this on every out of 40 wiboxes though? no
> performance impact?

Performance impact is very low:

218     if(bg.alpha != 0xff) 
219     { 
220         if(wibox->parent->pixmap) 
221             xcb_copy_area(_G_connection, wibox->parent->pixmap, 
222                           wibox->pixmap, _G_gc, 
223                           wibox->geometry.x + wibox->border_width, 
224                           wibox->geometry.y + wibox->border_width, 
225                           0, 0, 
226                           wibox->geometry.width, wibox->geometry.height); 
227         else 
228             /* no background :-( draw background color without alpha */ 
229             bg.alpha = 0xff; 
230     } 

So if wibox has a parent with a pixmap, we just copy its content on its pixmap
and then we continue drawing...

> Also, on the video, I can't see the red box through the green one, is
> it unfinished/bug or some limitation?

Some limitation, as said earlier in this mail: red and green have the
same parent, and that fails in that case.

Note that it's in theory possible to make this works, but it will be
very very much more code to determine what wibox is under, etc... Not
something I'd like to do. A composite manager will do that more
efficiently.

> Excellent job though! This could maybe work as a fallback to real
> compositing later?

Probably. We may remove alpha in color and use this trick only if we do
not detect a composite manager. Sounds like an idea, no?

-- 
Julien Danjou
// ᐰ <[email protected]>   http://julien.danjou.info
// 9A0D 5FD9 EB42 22F6 8974  C95C A462 B51E C2FE E5CD
// This is the end of my signature.

Attachment: signature.asc
Description: Digital signature

Reply via email to