Browse Source

Use XAllocNamedColor to translate string color

Martin Duquesnoy 12 years ago
parent
commit
980832b474
2 changed files with 11 additions and 4 deletions
  1. 5 2
      src/util.h
  2. 6 2
      src/wmfs.c

+ 5 - 2
src/util.h

@@ -49,9 +49,12 @@
 static inline Color
 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

+ 6 - 2
src/wmfs.c

@@ -319,10 +319,14 @@ wmfs_scan(void)
 
                          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);
+                         /* In a removed tag */
                          else
-                              layout_split_integrate(c, NULL);
+                         {
+                              c->geo = g;
+                              layout_client(c);
+                         }
 
                          client_get_name(c);
                     }