Subject: Re: FVWM: FvwmForm doesn't do color

From: "Trebor A. Rude" <[email-masked]>
Date: Sat, 17 Aug 96 22:18:12

--- On Sat, 17 Aug 1996 20:51:55 -0400 (EDT)  Joey Hess 
<[email-masked]> wrote:

>> FvwmForm seems to ignore colors.  I tried both lines of the form 
>> "*QuitVerifyBack blue" and "*QuitVerifyBack #0000ff" and neither 
>> work.  Ditto for the foreground color and item colors.  I use 
>> the line "Module FvwmForm QuitVerify" to launch it.  I'm using
>> fvwm-2.0.43 and X11R6-3.1.2E.  Any suggestions?
>
>Are you running X at >256 colors? When I run at 256 colors, it displays
>stuff in color. At 16bpp, it displays all in black and white.
>
>-- 
>#!/usr/bin/perl -i\$q='$q',\$p='$p';eval\$q.\$\^I#\n"#    [email-masked]
>$q='print"$p$^I\n',$p='#!/usr/bin/perl -i';eval$q.$^I#        Joey Hess
>      "How appropriate, you fight like a cow." - - Guybrush Threepwood
>

Yes, I am running more than 256 colors.  After all, that's the only way I can 
display my big, beautiful, 256 color .gif of Babylon 5 in the root window and 
still have enough colormap entries for everything else. :)

Does the author of FvwmForm read this list?  I assume this bug report will get 
back to him one way or another...

-------------------------------------
Name: Trebor A. Rude
E-mail: [email-masked]
Date: 8/17/96
Time: 10:18:12 PM
-------------------------------------

--
Visit the official FVWM web page at <URL:http://www.hpc.uh.edu/fvwm/>.
To unsubscribe from the list, send "unsubscribe fvwm" in the body of a
message to [email-masked].
To report problems, send mail to [email-masked].

---

From: "Charles Hines" <[email-masked]>
Date: Mon, 19 Aug 1996 11:23:02 -0400

>>>>> "Trebor" == Trebor A Rude <[email-masked]> writes:

>>> fvwm-2.0.43 and X11R6-3.1.2E.  Any suggestions?

Joey> Are you running X at >256 colors? When I run at 256 colors, it displays
Joey> stuff in color. At 16bpp, it displays all in black and white.

Trebor> Yes, I am running more than 256 colors.  After all, that's the
Trebor> only way I can display my big, beautiful, 256 color .gif of
Trebor> Babylon 5 in the root window and still have enough colormap
Trebor> entries for everything else. :)

Trebor> Does the author of FvwmForm read this list?  I assume this bug
Trebor> report will get back to him one way or another...

I don't know if the original author of FvwmForm is around any more or
not, but another user did contribute a patch to fix this problem to
me, and it'll be in 2.1.0 (soon).

I've included the patch to FvwmForm.c below if you'd like to try it
now (no lines, no waiting).

Chuck

----------------------------------------------------------------------
--- FvwmForm.c.orig    Thu Jun 27 11:06:05 1996
+++ FvwmForm.c        Tue Jul 23 09:01:25 1996
@@ -604,14 +604,74 @@
 /* allocate color cells */
 void GetColors ()
 {
+  Visual* visual = DefaultVisual(dpy, screen);
   XColor xc_item;
   int red, green, blue, tmp1, tmp2 ;
   if (scr_depth < 8) {
     colors[c_back] = colors[c_itemback] = WhitePixel(dpy, screen);
     colors[c_fore] = colors[c_itemfore] = colors[c_itemlo] = colors[c_itemhi]
       = BlackPixel(dpy, screen);
-  } else if (!XAllocColorCells(dpy, d_cmap, 0,
-                              NULL, 0, colors, 6)) {
+  } else if (visual->class == TrueColor ||
+                        visual->class == StaticColor ||
+                        visual->class == StaticGray) {
+    if (XParseColor(dpy, d_cmap, color_names[c_fore], &xc_item) &&
+               XAllocColor(dpy, d_cmap, &xc_item))
+         colors[c_fore] = xc_item.pixel;
+       else
+         colors[c_fore] = BlackPixel(dpy, screen);
+
+    if (XParseColor(dpy, d_cmap, color_names[c_back], &xc_item) &&
+               XAllocColor(dpy, d_cmap, &xc_item))
+         colors[c_back] = xc_item.pixel;
+       else
+         colors[c_back] = WhitePixel(dpy, screen);
+
+    if (XParseColor(dpy, d_cmap, color_names[c_itemfore], &xc_item) &&
+               XAllocColor(dpy, d_cmap, &xc_item))
+         colors[c_itemfore] = xc_item.pixel;
+       else
+         colors[c_itemfore] = BlackPixel(dpy, screen);
+
+    if (XParseColor(dpy, d_cmap, color_names[c_itemback], &xc_item) &&
+               XAllocColor(dpy, d_cmap, &xc_item))
+         colors[c_itemback] = xc_item.pixel;
+       else
+         colors[c_itemback] = WhitePixel(dpy, screen);
+
+    if (XParseColor(dpy, d_cmap, color_names[c_itemback], &xc_item)) {
+         red = (int) xc_item.red ;
+         green = (int) xc_item.green ;
+         blue = (int) xc_item.blue ;
+         xc_item.red = (60 * red) / 100 ;
+         xc_item.green = (60 * green) / 100 ;
+         xc_item.blue = (60 * blue) / 100 ;
+         if (XAllocColor(dpy, d_cmap, &xc_item))
+               colors[c_itemlo] = xc_item.pixel;
+         else
+               colors[c_itemlo] = BlackPixel(dpy, screen);
+       } else
+         colors[c_itemlo] = BlackPixel(dpy, screen);
+
+    if (XParseColor(dpy, d_cmap, color_names[c_itemback], &xc_item)) {
+         tmp1 = (14 * red) / 10 ;
+         if (tmp1 > MAX_INTENSITY) tmp1 = MAX_INTENSITY ;
+         tmp2 = (MAX_INTENSITY + red) / 2 ;
+         xc_item.red = (tmp1 > tmp2) ? tmp1 : tmp2 ;
+         tmp1 = (14 * green) / 10 ;
+         if (tmp1 > MAX_INTENSITY) tmp1 = MAX_INTENSITY ;
+         tmp2 = (MAX_INTENSITY + green) / 2 ;
+         xc_item.green = (tmp1 > tmp2) ? tmp1 : tmp2 ;
+         tmp1 = (14 * blue) / 10 ;
+         if (tmp1 > MAX_INTENSITY) tmp1 = MAX_INTENSITY ;
+         tmp2 = (MAX_INTENSITY + blue) / 2 ;
+         xc_item.blue = (tmp1 > tmp2) ? tmp1 : tmp2 ;
+         if (XAllocColor(dpy, d_cmap, &xc_item))
+               colors[c_itemhi] = xc_item.pixel;
+         else
+               colors[c_itemhi] = BlackPixel(dpy, screen);
+       } else
+         colors[c_itemhi] = BlackPixel(dpy, screen);
+  } else if (!XAllocColorCells(dpy, d_cmap, 0, NULL, 0, colors, 6)) {
     colors[c_back] = colors[c_itemback] = WhitePixel(dpy, screen);
     colors[c_fore] = colors[c_itemfore] = colors[c_itemlo] = colors[c_itemhi]
       = BlackPixel(dpy, screen);
--
Visit the official FVWM web page at <URL:http://www.hpc.uh.edu/fvwm/>.
To unsubscribe from the list, send "unsubscribe fvwm" in the body of a
message to [email-masked].
To report problems, send mail to [email-masked].