Use XAllocNamedColor to translate string color

This commit is contained in:
Martin Duquesnoy 2012-02-21 07:01:35 +01:00
parent 04c3b9362e
commit 980832b474
2 changed files with 11 additions and 4 deletions

View File

@ -49,9 +49,12 @@
static inline Color static inline Color
color_atoh(const char *col) color_atoh(const char *col)
{ {
int shift = (col[0] == '#'); XColor xcolor;
return (Color)strtol(col + shift, NULL, 16); if(!XAllocNamedColor(W->dpy, DefaultColormap(W->dpy, W->xscreen), col, &xcolor, &xcolor))
warnl("Error: cannot allocate color \"%s\".", col);
return xcolor.pixel;
} }
static inline void static inline void

View File

@ -319,10 +319,14 @@ wmfs_scan(void)
tag_client(tag_gb_id(c->screen, tag), c); tag_client(tag_gb_id(c->screen, tag), c);
if(getg && tag <= TAILQ_LAST(&c->screen->tags, tsub)->id) if(getg && tag <= TAILQ_LAST(&c->screen->tags, tsub)->id - 1)
client_moveresize(c, &g); client_moveresize(c, &g);
/* In a removed tag */
else else
layout_split_integrate(c, NULL); {
c->geo = g;
layout_client(c);
}
client_get_name(c); client_get_name(c);
} }