On Fri, Jan 27, 2006 at 11:33:47PM +0100, Thomas Tretzmüller wrote:
> I tried the szs4th tool, and noticed, that when there are more than
> nine lables/meters on the bar, they are drawn in a wrong order. Label
> 10 appers, where 2 should be, 11 instead of 3, and so on. This is the
> same ordering, "wmiir read /bar" prints out:
> 
> 1/
> 10/
> 11/
> 2/
> ...
> 
> In this case, the 11th label appears expanded, although "wmiir read
> /bar/expandable" still reports 3, which is the setting in my wmiirc.
> 
> Is there a way to get the labels in the right place?

I pushed a partial fix to wmii-2.5 repo which can also be found
attached, it can be applied to wmii-2.5.2.

Regards,
-- 
 Anselm R. Garbe  ><><  www.ebrag.de  ><><  GPG key: 0D73F361
diff -r d9ca12e42fc6 cmd/wmiibar.c
--- a/cmd/wmiibar.c     Fri Jan 27 21:08:12 2006
+++ b/cmd/wmiibar.c     Sat Jan 28 13:28:59 2006
@@ -195,12 +195,6 @@
        init_draw_label(path, &i->d);
 }
 
-static int
-comp_str(const void *s1, const void *s2)
-{
-       return strcmp(*(char **) s1, *(char **) s2);
-}
-
 static void
 draw()
 {
@@ -260,9 +254,9 @@
 static void
 draw_bar(void *obj, char *arg)
 {
-       File           *label = 0;
-       unsigned int    i = 0, n = 0;
+       File           *f, *label = 0;
        Item           *item;
+       size_t                  i;
        char            buf[512];
 
        if (!displayed)
@@ -288,28 +282,13 @@
                d.border = blitz_loadcolor(dpy, screen_num, 
files[B_BORDER_COLOR]->content);
                blitz_drawlabelnoborder(dpy, &d);
        } else {
-               File           *f;
-               char          **paths = 0;
-               /*
-                * take order into account, directory names are used in
-                * alphabetical order
-                */
-               n = 0;
-               for (f = label; f; f = f->next)
-                       n++;
-               paths = emalloc(sizeof(char *) * n);
-               i = 0;
-               for (f = label; f; f = f->next)
-                       paths[i++] = f->name;
-               qsort(paths, n, sizeof(char *), comp_str);
-               for (i = 0; i < n; i++) {
-                       snprintf(buf, sizeof(buf), "/%s", paths[i]);
+               for (f = label; f; f = f->next) {
+                       snprintf(buf, sizeof(buf), "/%s", f->name);
                        item = emalloc(sizeof(Item));
                        items = (Item **) attach_item_end((void **) items, 
item, sizeof(Item *));
                        init_item(buf, item);
                }
                draw();
-               free(paths);
        }
 }
 
_______________________________________________
[email protected] mailing list
http://wmii.de/cgi-bin/mailman/listinfo/wmii

Reply via email to