Ok, here's the patch for the weighted sorting feature (renamed from
custom, following Larry Gensch's suggestion). This is against the
latest code in CVS.
- Derek
? FvwmIconMan.patch
Index: modules/FvwmIconMan/FvwmIconMan.1
===
RCS file: /home/cvs/fvwm/fvwm/modules/FvwmIconMan/FvwmIconMan.1,v
retrieving revision 1.21
diff -u -r1.21 FvwmIconMan.1
--- modules/FvwmIconMan/FvwmIconMan.1 2002/04/07 00:35:34 1.21
+++ modules/FvwmIconMan/FvwmIconMan.1 2002/04/25 07:25:18
@@ -113,6 +113,7 @@
showlist of windows to show
showonlyicons only icons visible false
sortkeep managers sorted name
+sortweight weight for sorting
title manager title FvwmIconMan
titlebutton style for title button raisededge black grey
titlecolorset
@@ -285,8 +286,30 @@
If \fIname\fP, then the manager list is sorted by name. If \fInamewithcase\fP,
then it is sorted by name sensitive to case. If \fIid\fP, then
the manager list is sorted by the window id, which never changes after the
-window is created. Or it can be set to \fInone\fP, which results in no sorting.
-Default is \fIname\fP.
+window is created. If \fIweighted\fP, then the manager list is sorted by
+weight (see the description of \fIsortweight\fP below). Or it can be set to
+\fInone\fP, which results in no sorting. Default is \fIname\fP.
+
+.IP *FvwmIconMan: [id ]sortweight \fIweight\fP \fIpattern-list\fP
+Assigns the specified \fIweight\fP to windows that match \fIpattern-list\fP.
+The list is made up of patterns of the form \fItype=pattern\fP, where type
+is one of \fIclass\fP, \fIresource\fP, \fItitle\fP, or \fIicon\fP, and pattern
+is an expression of the same format used in the fvwm style command
+(minimalistic shell pattern matching). Multiple sort weights can be given.
+Each window is matched against the list of sort weights, in order, and is
+given the weight from the first match. Lower-weighted windows are placed
+first in the manager list. For example:
+.EX
+*FvwmIconMan*sort weighted
+*FvwmIconMan*sortweight 1 class=XTerm title=special*
+*FvwmIconMan*sortweight 10 class=XTerm
+*FvwmIconMan*sortweight 5
+.EE
+In this example, xterm windows whose titles start with special (weight 1)
+are listed first, followed by everything but other xterms (weight 5), and the
+other xterms (weight 10) are listed last. If no default weight (empty pattern
+list) is given, the default weight is 0. Only relevant if the sort type is
+set to \fIweighted\fP.
.IP *FvwmIconMan: [id ]title \fItitlestring\fP
Specifies the window title string for that manager window. \fITitlestring\fP
Index: modules/FvwmIconMan/FvwmIconMan.h
===
RCS file: /home/cvs/fvwm/fvwm/modules/FvwmIconMan/FvwmIconMan.h,v
retrieving revision 1.39
diff -u -r1.39 FvwmIconMan.h
--- modules/FvwmIconMan/FvwmIconMan.h 2002/04/22 08:06:15 1.39
+++ modules/FvwmIconMan/FvwmIconMan.h 2002/04/25 07:25:19
@@ -266,9 +266,18 @@
SortNone, /* no sorting */
SortId,/* sort by window id */
SortName, /* case insensitive name sorting */
- SortNameCase /* case sensitive name sorting */
+ SortNameCase, /* case sensitive name sorting */
+ SortWeighted /* custom sort order */
} SortType;
+typedef struct {
+ char *resname;
+ char *classname;
+ char *titlename;
+ char *iconname;
+ int weight;
+} WeightedSort;
+
typedef struct win_manager {
unsigned int magic;
int index;
@@ -300,6 +309,8 @@
Uchar followFocus;
Uchar usewinlist;
SortType sort;
+ WeightedSort *weighted_sorts;
+ int weighted_sorts_len, weighted_sorts_size;
char *AnimCommand;
Uchar showonlyiconic;
rectangle managed_g;/* dimensions of managed screen portion */
@@ -370,6 +381,7 @@
extern void init_globals (void);
extern int allocate_managers (int num);
+extern int expand_weighted_sorts (void);
extern WinData *new_windata (void);
extern void free_windata (WinData *p);
Index: modules/FvwmIconMan/globals.c
===
RCS file: /home/cvs/fvwm/fvwm/modules/FvwmIconMan/globals.c,v
retrieving revision 1.19
diff -u -r1.19 globals.c
--- modules/FvwmIconMan/globals.c 2002/04/23 01:26:54 1.19
+++ modules/FvwmIconMan/globals.c 2002/04/25 07:25:19
@@ -72,6 +72,9 @@
globals.managers[id].dontshow.mask = ALL_NAME;
globals.managers[id].usewinlist = 1;
globals.managers[id].sort = SortName;
+ globals.managers[id].weighted_sorts = NULL;
+ globals.managers[id].weighted_sorts_len = 0;
+ globals.managers[id].weighted_sorts_size = 0;
globals.managers[id].bindings[MOUSE] = ParseMouseEntry (DEFAULT_MOUSE);
globals.managers[id].we_are_drawing = 1;
globals.managers[id].showonlyiconic = 0;
Index: modules/FvwmIconMan/readconfig.c
===