changeset 30039:07f23448b6e5

(add_window_to_list): Add parameter LIST. (window_list): Order list so that, for each frame, windows are in canonical order, and so that frames appear in the list in the order given by Vframe_list. (next_window): Reverse the handling of NEXT_P.
author Gerd Moellmann <gerd@gnu.org>
date Wed, 05 Jul 2000 11:38:42 +0000
parents 9a141c819d48
children 7249274abdec
files src/window.c
diffstat 1 files changed, 20 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/src/window.c	Tue Jul 04 19:01:01 2000 +0000
+++ b/src/window.c	Wed Jul 05 11:38:42 2000 +0000
@@ -68,7 +68,7 @@
 static int window_fixed_size_p P_ ((struct window *, int, int));
 static void enlarge_window P_ ((Lisp_Object, int, int));
 static Lisp_Object window_list P_ ((void));
-static int add_window_to_list P_ ((struct window *));
+static int add_window_to_list P_ ((struct window *, Lisp_Object *));
 static int candidate_window_p P_ ((Lisp_Object, Lisp_Object, Lisp_Object));
 static Lisp_Object next_window P_ ((Lisp_Object, Lisp_Object,
 				    Lisp_Object, int));
@@ -1180,16 +1180,17 @@
 			     Window List
  ***********************************************************************/
 
-/* Add window W to Vwindow_list.  This is a callback function for
-   foreach_window, used from window_list.  */
+/* Add window W to *LIST.  This is a callback function for
+   foreach_window, used in function window_list.  */
 
 static int
-add_window_to_list (w)
+add_window_to_list (w, list)
      struct window *w;
+     Lisp_Object *list;
 {
   Lisp_Object window;
   XSETWINDOW (window, w);
-  Vwindow_list = Fcons (window, Vwindow_list);
+  *list = Fcons (window, *list);
   return 1;
 }
 
@@ -1204,9 +1205,21 @@
   if (!CONSP (Vwindow_list))
     {
       Lisp_Object tail;
+
       Vwindow_list = Qnil;
       for (tail = Vframe_list; CONSP (tail); tail = XCDR (tail))
-	foreach_window (XFRAME (XCAR (tail)), add_window_to_list);
+	{
+	  Lisp_Object args[2];
+
+	  /* We are visiting windows in canonical order, and add
+	     new windows at the front of args[1], which means we
+	     have to reverse this list at the end.  */
+	  args[1] = Qnil;
+	  foreach_window (XFRAME (XCAR (tail)), add_window_to_list, &args[1]);
+	  args[0] = Vwindow_list;
+	  args[1] = Fnreverse (args[1]);
+	  Vwindow_list = Fnconc (2, args);
+	}
     }
   
   return Vwindow_list;
@@ -1333,7 +1346,7 @@
       && !EQ (all_frames, XWINDOW (window)->frame))
     return Fframe_first_window (all_frames);
   
-  if (!next_p)
+  if (next_p)
     {
       Lisp_Object list;