C color code: Ignore alpha component (FS#966)

The only place where we silently have to ignore alpha components are window
borders and systray background. However, because these color strings could be
coming from the beautiful theme, we shouldn't error out when an alpha component
is present.

With this commit, we silently ignore this alpha component.

Signed-off-by: Uli Schlachter <psychon@znc.in>
This commit is contained in:
Uli Schlachter 2012-04-07 22:03:38 +02:00
parent 5c7a3501d0
commit 00059d2d73
1 changed files with 7 additions and 0 deletions

View File

@ -46,6 +46,13 @@ color_parse(const char *colstr, ssize_t len,
char *p;
colnum = strtoul(colstr + 1, &p, 16);
if(len == 9 && (p - colstr) == 9)
{
/* We ignore the alpha component */
colnum >>= 8;
len -= 2;
p -= 2;
}
if(len != 7 || colstr[0] != '#' || (p - colstr) != 7)
{
warn("awesome: error, invalid color '%s'", colstr);