comparison src/window.c @ 983:eb19dfaec9c4

* window.c (window_loop): This used to keep track of the first window processed and wait until we came back around to it. Sadly, this doesn't work if that window gets deleted. So instead, use Fprevious_window to find the last window to process, and loop until we've done that one. * window.c [not MULTI_FRAME] (init_window_once): Don't forget to set the `mini_p' flag on the new minibuffer window to t. * window.c (Fwindow_at): Don't check the type of the frame argument. * window.c [not MULTI_FRAME] (window_loop): Set frame to zero, instead of trying to decode it. * window.c (init_window_once): Initialize minibuf_window before FRAME_ROOT_WINDOW, so the latter actually points to something.
author Jim Blandy <jimb@redhat.com>
date Fri, 14 Aug 1992 02:27:26 +0000
parents f47d221cbfe6
children 817b0ce337d7
comparison
equal deleted inserted replaced
982:595f9517f205 983:eb19dfaec9c4
427 (row, column, frame) 427 (row, column, frame)
428 Lisp_Object row, column, frame; 428 Lisp_Object row, column, frame;
429 { 429 {
430 int part; 430 int part;
431 431
432 #ifdef MULTI_FRAME
432 if (NILP (frame)) 433 if (NILP (frame))
433 XSET (frame, Lisp_Frame, selected_frame); 434 XSET (frame, Lisp_Frame, selected_frame);
434 else 435 else
435 CHECK_LIVE_FRAME (frame, 2); 436 CHECK_LIVE_FRAME (frame, 2);
437 #endif
436 CHECK_NUMBER (row, 0); 438 CHECK_NUMBER (row, 0);
437 CHECK_NUMBER (column, 1); 439 CHECK_NUMBER (column, 1);
438 440
439 return window_from_coordinates (XFRAME (frame), 441 return window_from_coordinates (XFRAME (frame),
440 XINT (row), XINT (column), 442 XINT (row), XINT (column),
999 int mini; 1001 int mini;
1000 { 1002 {
1001 register Lisp_Object w; 1003 register Lisp_Object w;
1002 register Lisp_Object best_window; 1004 register Lisp_Object best_window;
1003 register Lisp_Object next_window; 1005 register Lisp_Object next_window;
1004 register Lisp_Object first_window; 1006 register Lisp_Object last_window;
1005 FRAME_PTR frame; 1007 FRAME_PTR frame;
1006 1008
1009 #ifdef MULTI_FRAME
1007 /* If we're only looping through windows on a particular frame, 1010 /* If we're only looping through windows on a particular frame,
1008 frame points to that frame. If we're looping through windows 1011 frame points to that frame. If we're looping through windows
1009 on all frames, frame is 0. */ 1012 on all frames, frame is 0. */
1010 if (FRAMEP (frames)) 1013 if (FRAMEP (frames))
1011 frame = XFRAME (frames); 1014 frame = XFRAME (frames);
1012 else if (NILP (frames)) 1015 else if (NILP (frames))
1013 frame = selected_frame; 1016 frame = selected_frame;
1014 else 1017 else
1015 frame = 0; 1018 frame = 0;
1019 #else
1020 frame = 0;
1021 #endif
1016 1022
1017 /* Pick a window to start with. */ 1023 /* Pick a window to start with. */
1018 if (XTYPE (obj) == Lisp_Window) 1024 if (XTYPE (obj) == Lisp_Window)
1019 first_window = obj; 1025 w = obj;
1020 else if (frame) 1026 else if (frame)
1021 first_window = FRAME_SELECTED_WINDOW (frame); 1027 w = FRAME_SELECTED_WINDOW (frame);
1022 else 1028 else
1023 first_window = FRAME_SELECTED_WINDOW (selected_frame); 1029 w = FRAME_SELECTED_WINDOW (selected_frame);
1024 1030
1025 w = first_window; 1031 /* Figure out the last window we're going to mess with. Since
1032 Fnext_window, given the same options, is guaranteed to go in a
1033 ring, we can just use Fprevious_window to find the last one.
1034
1035 We can't just wait until we hit the first window again, because
1036 it might be deleted. */
1037
1038 #ifdef MULTI_FRAME
1039 if (frame)
1040 last_window = Fprevious_window (w, (mini ? Qt : Qnil), Qlambda);
1041 else
1042 #endif /* MULTI_FRAME */
1043 /* We know frame is 0, so we're looping through all frames.
1044 Or we know this isn't a MULTI_FRAME Emacs, so who cares? */
1045 last_window = Fprevious_window (w, mini ? Qt : Qnil, Qt);
1046
1026 best_window = Qnil; 1047 best_window = Qnil;
1027 do 1048 for (;;)
1028 { 1049 {
1029 /* Pick the next window now, since some operations will delete 1050 /* Pick the next window now, since some operations will delete
1030 the current window. */ 1051 the current window. */
1031 #ifdef MULTI_FRAME 1052 #ifdef MULTI_FRAME
1032 if (frame) 1053 if (frame)
1033 next_window = Fnext_window (w, (mini ? Qt : Qnil), Qlambda); 1054 next_window = Fnext_window (w, (mini ? Qt : Qnil), Qlambda);
1034 else 1055 else
1035 #endif /* MULTI_FRAME */ 1056 #endif /* MULTI_FRAME */
1036 /* We know frame is 0, so we're looping through all frames. 1057 /* We know frame is 0, so we're looping through all frames.
1037 Or we know this isn't a MULTI_FRAME Emacs, so who cares? */ 1058 Or we know this isn't a MULTI_FRAME Emacs, so who cares? */
1038 next_window = Fnext_window (w, mini ? Qt : Qnil, Qt); 1059 next_window = Fnext_window (w, mini ? Qt : Qnil, Qt);
1039 1060
1040 if (!MINI_WINDOW_P (XWINDOW (w)) 1061 if (!MINI_WINDOW_P (XWINDOW (w))
1131 if (EQ (w, selected_window)) 1152 if (EQ (w, selected_window))
1132 Fset_buffer (XWINDOW (w)->buffer); 1153 Fset_buffer (XWINDOW (w)->buffer);
1133 } 1154 }
1134 break; 1155 break;
1135 } 1156 }
1157
1158 if (EQ (w, last_window))
1159 break;
1160
1136 w = next_window; 1161 w = next_window;
1137 } 1162 }
1138 while (! EQ (w, first_window));
1139 1163
1140 return best_window; 1164 return best_window;
1141 } 1165 }
1142 1166
1143 DEFUN ("get-lru-window", Fget_lru_window, Sget_lru_window, 0, 1, 0, 1167 DEFUN ("get-lru-window", Fget_lru_window, Sget_lru_window, 0, 1, 0,
2640 selected_window = selected_frame->selected_window; 2664 selected_window = selected_frame->selected_window;
2641 last_nonminibuf_frame = selected_frame; 2665 last_nonminibuf_frame = selected_frame;
2642 #else /* not MULTI_FRAME */ 2666 #else /* not MULTI_FRAME */
2643 extern Lisp_Object get_minibuffer (); 2667 extern Lisp_Object get_minibuffer ();
2644 2668
2669 minibuf_window = make_window ();
2645 FRAME_ROOT_WINDOW (selected_frame) = make_window (); 2670 FRAME_ROOT_WINDOW (selected_frame) = make_window ();
2646 minibuf_window = make_window ();
2647 2671
2648 XWINDOW (FRAME_ROOT_WINDOW (selected_frame))->next = minibuf_window; 2672 XWINDOW (FRAME_ROOT_WINDOW (selected_frame))->next = minibuf_window;
2649 XWINDOW (minibuf_window)->prev = FRAME_ROOT_WINDOW (selected_frame); 2673 XWINDOW (minibuf_window)->prev = FRAME_ROOT_WINDOW (selected_frame);
2674 XWINDOW (minibuf_window)->mini_p = Qt;
2650 2675
2651 /* These values 9 and 10 are arbitrary, 2676 /* These values 9 and 10 are arbitrary,
2652 just so that there is "something there." 2677 just so that there is "something there."
2653 Correct values are put in in init_xdisp */ 2678 Correct values are put in in init_xdisp */
2654 2679