Fade in/Fade out of a window with XRender and Xcomposite

Pierre Nicolas-Nicolaz dnanar at gmail.com
Sat Feb 16 07:27:54 PST 2008


2008/2/16, Bin Chen <binary.chen at gmail.com>:
> http://ktown.kde.org/~fredrik/composite_howto.html, this is a good one.
> And you can also refer to the sample code wrote by Keith, named xcompmgr.c


Thanks for the tutorial, now i think i have understood what the X
Composite extension can do. But in the link they are talking about
scaling/rotating with XTransform, but they are not talking about
fading/translucency, even if they say how to know if the window has an
alpha channel or not (bool alpha =  ( XRenderFindVisualFormat( dpy,
attr.visual )->type == PictTypeDirect && XRenderFindVisualFormat( dpy,
attr.visual )>direct.alphaMask );), they don't say how to use it. Have
you also got any link about this please ?


And, i looked for xcompmgr.c (version 1.40, i downloaded it from
experimental debian repository), and that' is exactly what i want to
do. The interesting part seems to only be in set_fade function, which
seems to "map a window with fading" (so, a call to this function
should do all that i want ?) . But i do not understand some parts of
the function :

1) What is the goal of find_fade ? It finds the corresponding fade of
the window that we want to appear ? so, it means that to each window
corresponds a fade which is shown or not (so set_fade only shows the
fade ?) ? If yes, why enqueue_fade needs to call
get_time_in_milliseconds ?

2) What does  " void (*callback) (Display *dpy, win *w, Bool gone)"
(the function which calls set_fade sets to "0" this pointer...) ?

3) If i have good understood, set_fade modify opacity, and then calls
determine_mode to draw the windows, which draw with XRender the
Picture w->alphaPict . But : where this picture is modified in
accordance with w->opacity (in the paint_all function ?!) , and why
determine_mode in not called multiple time (each time with a different
opacity) ?


Thanks a lot,
Nanar Duff.



More information about the xorg mailing list