On Feb 5, 2008 7:02 PM, Dominik Vogt <[EMAIL PROTECTED]> wrote:
>
> On Tue, Feb 05, 2008 at 04:48:05PM +0000, seventh guardian wrote:
> > On Feb 5, 2008 4:35 PM, Dominik Vogt <[EMAIL PROTECTED]> wrote:
> > >
> > > On Tue, Feb 05, 2008 at 03:51:09PM +0000, seventh guardian wrote:
> > (...)
> > > > I believe the first part of the work would be to make fvwm support
> > > > ARGB visuals. Then, having a proper composite manager module would be
> > > > good. As for the effects, it's all in the composite manager code..
> > >
> > > Note that I have an ARGB patch lying on my disk that is more or
> > > less an Xorg specific hack.  I wasn't able to find out how to
> > > properly detect ARGB visuals.  The patch looks like this:
> > >
> > >   /* We assume that a truecolour visual of depth 32 is
> > >    * actually an ARGB visual (hard to detect otherwise)
> > >    * in this case, clone the window visual/cmap etc. */
> > >   if (
> > >     fw->attr_backup.visual->class == TrueColor &&
> > >     fw->attr_backup.depth == 32)
> > >   {
> > >     /* ARGB visual */
> > >     ...
> > >   }
> > >
> > > Since it's such a blatant hack I refused to apply the patch yet.
> >
> > I've asked on #xorg-devel and there is a non-hackish way of doing it.
> > I'll try to update the patch accordingly.
>
> Have you any written piece of information on this topic?

Only some scattered pieces, and the procedure "fredrikh" at
#xorg-devel described.

XGetVisualInfo returns a filtered list of supported visuals:
http://tronche.com/gui/x/xlib/utilities/XGetVisualInfo.html
http://tronche.com/gui/x/xlib/utilities/visual.html

We should filter the list for 32 bit visuals, and then iterate over
the list for visuals which have a nonzero alpha mask (which means they
have an alpha channel). The checking is done by calling
XRenderFindVisualFormat with the appropriate "visual id", and checking
the returning struct for the appropriate values.

On annex is the "standalone" code I used for testing.

Cheers,
  Renato
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/extensions/Xrender.h>
#include <stdio.h>

int main()
{
	Display *dpy;

	XVisualInfo *vinfo;
	XVisualInfo vinfo_template;
	int vinfo_n, i;
	XRenderPictFormat *format;

	dpy = XOpenDisplay(0);

	/* change the target depth here to test */
	vinfo_template.depth=32;
	vinfo = XGetVisualInfo(dpy, VisualDepthMask, &vinfo_template, &vinfo_n);

	for (i=0; i<vinfo_n; i++)
	{
		format=XRenderFindVisualFormat(dpy, vinfo[i].visual);
		if (format->type==PictTypeDirect &&
			format->direct.alphaMask > 0)
		{
			printf("has alpha!\n");
		}
	}

	XFree(vinfo);

	printf("%d visual(s) found\n", vinfo_n);
	return 0;
}

Reply via email to