Fixed problem w/ gcolorsel



I've previously noted that gcolorsel has difficulties w/ my custom
rgb.txt entries. Today, I was able to determine which part of the code
was involved.

The problem stems from my use of hyphens in my custom entries, e.g.
BaP-LtGold, while gcolorsel expects all color names to consist solely of
alphanumerics and spaces.

If hyphen is an illegal character in an X color name, then I've stumbled
onto a major loophole, since no other X program that I've tried to date has 
had difficulty with my custom entries. Although gcolorsel will include my
custom entries in its list, the colors aren't parsed correctly because the
name doesn't match the regex used in parsing the rgb database.

At any rate, this one character patch solves the problem for me. As to
whether other characters should be included in the regex or the parsing logic
changed, I'll leave that to the developers.

8<begin gcolorsel.c.diff>8
--- gcolorsel.c.ori     Tue Feb 16 17:56:22 1999
+++ gcolorsel.c Fri Apr 21 10:26:54 2000
@@ -268,7 +268,7 @@
            break;
 
        color = g_new(RGBColor, 1);
-       t = sscanf(tmp, "%d %d %d\t\t%[a-zA-Z0-9 ]\n", &color->r,
+       t = sscanf(tmp, "%d %d %d\t\t%[a-zA-Z0-9 -]\n", &color->r,
                   &color->g,
                   &color->b,
                   color->name);
8<end gcolorsel.c.diff>8

Regards,

Barthel
-- 
   ld_barthel@yahoo.com | http://geocities.com/Area51/Shire/4063
       Organization: The Pennswald Group -- Linux powered!!
gpg fingerprint: 8D3F 4BFF D36B BFCC FEE5  86A0 2AAF D3DA C395 641E

640K ought to be enough for anybody. - Bill Gates, 1981





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]