Преглед на файлове

Use XAllocNamedColor to translate string color

Martin Duquesnoy преди 12 години
родител
ревизия
980832b474
променени са 2 файла, в които са добавени 11 реда и са изтрити 4 реда
  1. 5 2
      src/util.h
  2. 6 2
      src/wmfs.c

+ 5 - 2
src/util.h

@@ -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

+ 6 - 2
src/wmfs.c

@@ -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);
                     }
                     }