Hello --

2009/9/9 Leeman Strout <m...@mooluv.com>:
> I believe that I am experiencing a bug in the weighted sorting for
> FvwmIconMan.
>
> pertinent Iconman config:
> *FvwmIconMan: Sort       weighted
>
> *FvwmIconMan: SortWeight 5  class=Firefox
> *FvwmIconMan: SortWeight 15 class=gvim
> *FvwmIconMan: SortWeight 15 name=jEdit*
> *FvwmIconMan: SortWeight 20 class=Terminal
> *FvwmIconMan: SortWeight 30 class=pidgin
>
> *FvwmIconMan: SortWeight 40
>
> Actual results in IconMan:
> Firefox / gcalc / gvim / pidgin / gftp / jEdit / Thunar / Terminal
>
> Expected results:
> Firefox / gvim / jEdit / Terminal / pidgin / (gftp / Thunar / gcalc)

Sorry it's taken me so long to get back to -- I've been busy.  I think
I've found the bug you're referring to -- patch attached, so if you
could apply it to the latest CVS HEAD, that'd be grand.

But first -- I really hope the above config snippet is in error -- I
mean, you *do* realise that the window Class, like everything else is
case-sensitive, right?   For me pidgin's class is really "Pidgin", and
gvim's class is really "Gvim".  You'll want to correct that first, and
I suspect when you do you'll get your expected result -- because at
the moment, the windows are being treated as though they had a
weighting of 40 in your example.

However, there is an edge-case in the comparisons for working out when
the slots for the windows are meant to happen, and it's that which
this patch tries to address.  I really haven't tested it, so I would
appreciate you do thoroughly before I even consider adding it to CVS.

-- Thomas Adam
Index: modules/FvwmIconMan/xmanager.c
===================================================================
RCS file: /home/cvs/fvwm/fvwm/modules/FvwmIconMan/xmanager.c,v
retrieving revision 1.95
diff -u -r1.95 xmanager.c
--- modules/FvwmIconMan/xmanager.c      28 Jan 2007 15:29:26 -0000      1.95
+++ modules/FvwmIconMan/xmanager.c      21 Sep 2009 20:07:36 -0000
@@ -2153,7 +2153,15 @@
                wb = compute_weight(b);
                if (wa != wb)
                {
-                       return wa - wb;
+                       /* TA:  (2009-09-21):  If the weightings of the window
+                        * don't match, only take the difference for list
+                        * insertion if the difference is less than the
+                        * weighting on the window -- and if not, use the
+                        * original weighting.  This takes into account those
+                        * windows using a default weighting matched against
+                        * those windows which have specific weightings.
+                        */
+                       return (wa - wb) < wa ? (wa - wb) : wa;
                }
                return strcmp((a->display_string)? a->display_string:"",
                              (b->display_string)? b->display_string:"");

Reply via email to