Index: fvwm/fvwm.c
===================================================================
RCS file: /home/cvs/fvwm/fvwm/fvwm/fvwm.c,v
retrieving revision 1.402
diff -u -r1.402 fvwm.c
--- fvwm/fvwm.c	12 Feb 2008 14:13:15 -0000	1.402
+++ fvwm/fvwm.c	12 Feb 2008 14:14:50 -0000
@@ -101,6 +101,9 @@
 #define s_g_width 4
 #define s_g_height 4
 
+/* Experimental ARGB stuff, enable with care ;) */
+#define EXPERIMENTAL_ARGB
+
 /* ---------------------------- local macros ------------------------------- */
 
 /* ---------------------------- imports ------------------------------------ */
@@ -1232,6 +1235,9 @@
 {
 	fprintf(stderr, "usage: %s", g_argv[0]);
 	fprintf(stderr,
+#ifdef EXPERIMENTAL_ARGB
+		" [-a]"
+#endif
 		" [-d display]"
 		" [-f cfgfile]"
 		" [-c cmd]"
@@ -1251,6 +1257,9 @@
 	}
 	fprintf(stderr,
 		" -A:           allocate palette\n"
+#ifdef EXPERIMENTAL_ARGB
+		" -a:           enable support for argb colorsets\n"
+#endif
 		" -c cmd:       preprocess configuration file with <cmd>\n"
 		" -C vis-class: use visual class <vis-class>\n"
 		" -d display:   run fvwm on <display>\n"
@@ -1750,6 +1759,9 @@
 	Bool replace_wm = False;
 	int visualClass = -1;
 	int visualId = -1;
+#ifdef EXPERIMENTAL_ARGB
+	Bool argb = False;
+#endif
 	PictureColorLimitOption colorLimitop = {-1, -1, -1, -1, -1};
 	const exec_context_t *exc;
 	exec_context_changes_t ecc;
@@ -2066,6 +2078,15 @@
 			       Fvwm_SupportInfo, Fvwm_LicenseInfo);
 			exit(0);
 		}
+#ifdef EXPERIMENTAL_ARGB
+		else if (strcmp(argv[i], "-a") == 0 ||
+			 strcmp(argv[i], "-argb") == 0 ||
+			 strcmp(argv[i], "--argb") == 0)
+		{
+			argb = True;
+			fprintf(stderr,"Enabling argb colorset support\n");
+		}
+#endif
 		else
 		{
 			usage(0);
@@ -2246,11 +2267,15 @@
 	{
 		XVisualInfo template, *vinfo = NULL;
 		int total, i;
+#ifdef EXPERIMENTAL_ARGB
+		XRenderPictFormat *format;
+#endif
 
 		Pdepth = 0;
 		Pdefault = False;
 		total = 0;
 		template.screen = Scr.screen;
+
 		if (visualClass != -1)
 		{
 			template.class = visualClass;
@@ -2277,11 +2302,40 @@
 					visualId);
 			}
 		}
+#ifdef EXPERIMENTAL_ARGB
+		else if (argb)
+		{
+			template.class = TrueColor;
+			template.depth = 32;
+			vinfo = XGetVisualInfo(dpy,
+					VisualScreenMask|VisualClassMask|
+					VisualDepthMask,
+					&template, &total);
+			if (!total)
+			{
+				fvwm_msg(ERR, "main",
+					"Couldn't find an argb visual");
+			}
+		}
+#endif
 
 		/* visualID's are unique so there will only be one.
 		   Select the visualClass with the biggest depth */
 		for (i = 0; i < total; i++)
 		{
+#ifdef EXPERIMENTAL_ARGB
+			/* test if the visual has an alpha channel */
+			if (argb)
+			{
+				format=XRenderFindVisualFormat(
+						dpy,vinfo[i].visual);
+				if (!(format->type==PictTypeDirect &&
+					format->direct.alphaMask))
+				{
+					continue;
+				}
+			}
+#endif
 			if (vinfo[i].depth > Pdepth)
 			{
 				Pvisual = vinfo[i].visual;
