diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/window.c | 43 |
1 files changed, 34 insertions, 9 deletions
diff --git a/src/window.c b/src/window.c index edb6571c263..6da269e24cb 100644 --- a/src/window.c +++ b/src/window.c | |||
| @@ -429,10 +429,12 @@ column 0.") | |||
| 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 | ||
| @@ -1001,9 +1003,10 @@ window_loop (type, obj, mini, frames) | |||
| 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. */ |
| @@ -1013,18 +1016,36 @@ window_loop (type, obj, mini, 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); |
| 1030 | |||
| 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); | ||
| 1024 | 1046 | ||
| 1025 | w = first_window; | ||
| 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. */ |
| @@ -1032,7 +1053,7 @@ window_loop (type, obj, mini, frames) | |||
| 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); |
| @@ -1133,9 +1154,12 @@ window_loop (type, obj, mini, frames) | |||
| 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 | } |
| @@ -2642,11 +2666,12 @@ init_window_once () | |||
| 2642 | #else /* not MULTI_FRAME */ | 2666 | #else /* not MULTI_FRAME */ |
| 2643 | extern Lisp_Object get_minibuffer (); | 2667 | extern Lisp_Object get_minibuffer (); |
| 2644 | 2668 | ||
| 2645 | FRAME_ROOT_WINDOW (selected_frame) = make_window (); | ||
| 2646 | minibuf_window = make_window (); | 2669 | minibuf_window = make_window (); |
| 2670 | FRAME_ROOT_WINDOW (selected_frame) = 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." |