Subject: windowlist patch

From: Jochen Klenner <[email-masked]>
Date: Tue, 26 Mar 2002 02:08:05 +0100 (MET)

Hi,

when you open the WindowList, the currently focused window is always at
the top. This means at least one additional keystroke is necessary to
focus another window, even when you use SelectOnRelease. (You rarely bring
up the windowlist just to select the already focused window.) Not a big
thing, but I like it as efficient as possible. This issue also came up on
the fvwm mailing list.

So I introduced the CurrentAtEnd option for the WindowList command. Its
effect is, well, to put the currently focused window to the end of the
windowlist. The order of the other windows is not altered. It only affects
the displayed windowlist, the internal ordering of the windows isn't
touched.

Now it's possible to hit M-Tab (or whatever key combination you prefer)
once to switch to the next window, just like in [that other OS]. I love to
save a keystroke :-).

Please have a look at the attached patch for windowlist.c. Any comments
are welcome.

Best regards

Jochen
--- ../fvwm-2.4.6/fvwm/windowlist.c	Fri Feb 22 23:07:48 2002
+++ fvwm/windowlist.c	Tue Mar 12 01:06:48 2002
@@ -121,6 +121,7 @@
   /* Condition vars. */
   Bool use_condition = False;
   Bool do_reverse_sort_order = False;
+  Bool current_at_end = False;
   WindowConditionMask mask;
   char *cond_flags;
 
@@ -183,6 +184,8 @@
         flags |= SHOW_ALPHABETIC;
       else if (StrEquals(tok,"ReverseOrder"))
         do_reverse_sort_order = True;
+      else if (StrEquals(tok,"CurrentAtEnd"))
+	current_at_end = True;
       else if (StrEquals(tok,"NoDeskSort"))
         flags |= NO_DESK_SORT;
       else if (StrEquals(tok,"UseIconName"))
@@ -313,8 +316,15 @@
     return;
   }
   /* get the windowlist starting from the current window (if any)*/
-  if ((t = get_focus_window()) == NULL)
+  t = get_focus_window();
+  if (t == NULL)
     t = Scr.FvwmRoot.next;
+  else if (current_at_end) {
+    if (t->next)
+      t = t->next;
+    else
+      t = Scr.FvwmRoot.next;
+  }
   for (ii = 0; ii < numWindows; ii++)
   {
     if (do_reverse_sort_order)