Subject: possible new features

From: Tim Toolan <[email-masked]>
Date: Thu, 29 Nov 2001 13:58:31 -0500 (EST)

Hi,

I have included a few new features for the WindowList, which I have
been manually adding myself for years now.  They do not change any
current functionality, and are just additional options which can be used.

The first option is "IndicateIconic", which if specified, will put
parentheses around the name displayed in the list if the application
is currently iconized state.

The second option is "ForceDeskSep", which will place separators
between desks in the list, even if NoGeometry is specified.

The third option is "DeskNames", which is similar to the functionality
of the FvwmPager's Label command.  It takes a colon separated list of
arguments which are used instead of numbers on the title line of the
list.

To illustrate how they are used, my WindowList function is used as follows:

Mouse  3  R  A  WindowList 
Icons,Alphabetic,IndicateIconic,ForceDeskSep,NoGeometry,DeskNames 
Default:Admin:Project:Thesis

Additionally, there are two additional functions that I use in FvwmPager,
which if you feel they are useful, I can send patches for.

The first is "AutoRaiseLower", which raises the pager window to the
top when the mouse enters it, and lowers it below all other windows
when the mouse exits.  I find it useful, when there is only a corner
of the pager showing.

The second is "WarpToWindow", which warps the mouse into the window,
when it is clicked on in the pager.

Sincerely,

Tim Toolan

--- windowlist.c.orig	Thu Nov 29 13:26:32 2001
+++ windowlist.c	Thu Nov 29 13:26:32 2001
@@ -57,6 +57,8 @@
 #define SHOW_ICONNAME (1<<7)
 #define SHOW_ALPHABETIC (1<<8)
 #define SHOW_INFONOTGEO (1<<9)
+#define INDICATE_ICONIC (1<<10)
+#define FORCE_DESK_SEP  (1<<11)
 #define SHOW_EVERYTHING (SHOW_GEOMETRY | SHOW_ALLDESKS | SHOW_NORMAL | SHOW_ICONIC | SHOW_STICKY)
 
 /* Function to compare window title names
@@ -94,7 +96,7 @@
   char *name=NULL;
   int dwidth;
   int dheight;
-  char tlabel[50]="";
+  char *tlabel=NULL;
   int last_desk_done = INT_MIN;
   int last_desk_displayed = INT_MIN;
   int next_desk = 0;
@@ -123,6 +125,8 @@
   Bool do_reverse_sort_order = False;
   WindowConditionMask mask;
   char *cond_flags;
+  char *desk_names = NULL,*desk_name = NULL;
+  int desk_name_len=0;
 
   memset(&mops, 0, sizeof(mops));
   memset(&mret, 0, sizeof(MenuReturn));
@@ -178,6 +182,14 @@
         desk = Scr.CurrentDesk;
         flags &= ~SHOW_ALLDESKS;
       }
+      else if (StrEquals(tok,"DeskNames"))
+      {
+        opts = GetNextSimpleOption(opts, &desk_names);
+      }
+      else if (StrEquals(tok,"IndicateIconic"))
+        flags |= INDICATE_ICONIC;
+      else if (StrEquals(tok,"ForceDeskSep"))
+        flags |= FORCE_DESK_SEP;
       else if (StrEquals(tok,"NotAlphabetic"))
         flags &= ~SHOW_ALPHABETIC;
       else if (StrEquals(tok,"Alphabetic"))
@@ -292,16 +304,37 @@
   }
 
   globalFlags = flags;
-  if (flags & SHOW_GEOMETRY)
+  if (desk_names)
   {
-    sprintf(tlabel,"Desk: %d\tGeometry",desk);
+    int labelCount=0;
+    char *desk_names_ptr=desk_names;
+    while (labelCount < desk && *desk_names_ptr)
+    {
+      if (*desk_names_ptr == ':')
+        labelCount++;
+      desk_names_ptr++;
+    }
+    if (*desk_names_ptr)
+      desk_name=desk_names_ptr;
+    while (*desk_names_ptr && *desk_names_ptr != ':')
+    {
+      desk_names_ptr++;
+      desk_name_len++;
+    }
+    *desk_names_ptr='\0';
   }
+  tlabel = safemalloc(50 + desk_name_len);
+  if (desk_name)
+    sprintf(tlabel,"Desk: %s",desk_name);
   else
-  {
     sprintf(tlabel,"Desk: %d",desk);
-  }
+  if (desk_names)
+    free(desk_names);
+  if (flags & SHOW_GEOMETRY)
+    strcat(tlabel,"\tGeometry");
   mr = NewMenuRoot(tlabel);
   AddToMenu(mr, tlabel, "TITLE", FALSE, FALSE);
+  free(tlabel);
 
   numWindows = 0;
   for (t = Scr.FvwmRoot.next; t != NULL; t = t->next)
@@ -395,7 +428,8 @@
         if (t->Desk != last_desk_displayed)
         {
           if (last_desk_displayed != INT_MIN)
-            if ((flags & SHOW_GEOMETRY) || (flags & SHOW_INFONOTGEO))
+            if ((flags & SHOW_GEOMETRY) || (flags & SHOW_INFONOTGEO) ||
+                (flags & FORCE_DESK_SEP))
             AddToMenu(mr, NULL, NULL, FALSE, FALSE);
           last_desk_displayed = t->Desk;
         }
@@ -408,13 +442,19 @@
         if (!name)
           name = "NULL_NAME";
 
-        t_hot = safemalloc(strlen(name) + 48);
+        t_hot = safemalloc(strlen(name) + 48 + 2);
 	if (use_hotkey)
           sprintf(t_hot, "&%c. ", scut);         /* Generate label */
 	else
 	  *t_hot = 0;
         if(!(flags & SHOW_INFONOTGEO))
+        {
+          if(IS_ICONIFIED(t) && flags & INDICATE_ICONIC)
+            strcat(t_hot, "(");
 	  strcat(t_hot, name);
+          if(IS_ICONIFIED(t) && flags & INDICATE_ICONIC)
+            strcat(t_hot, ")");
+        }
 	if (*t_hot == 0)
 	  strcpy(t_hot, " ");