Mercurial > emacs
comparison src/window.c @ 16051:ccf489f8596e
Removed support for !MULTI_FRAME.
author | Karl Heuer <kwzh@gnu.org> |
---|---|
date | Sun, 01 Sep 1996 21:04:32 +0000 |
parents | 855c8d8ba0f0 |
children | b19129a8c644 |
comparison
equal
deleted
inserted
replaced
16050:c2805a244171 | 16051:ccf489f8596e |
---|---|
174 If the optional argument FRAME is specified, return the minibuffer window\n\ | 174 If the optional argument FRAME is specified, return the minibuffer window\n\ |
175 used by that frame.") | 175 used by that frame.") |
176 (frame) | 176 (frame) |
177 Lisp_Object frame; | 177 Lisp_Object frame; |
178 { | 178 { |
179 #ifdef MULTI_FRAME | |
180 if (NILP (frame)) | 179 if (NILP (frame)) |
181 XSETFRAME (frame, selected_frame); | 180 XSETFRAME (frame, selected_frame); |
182 else | 181 else |
183 CHECK_LIVE_FRAME (frame, 0); | 182 CHECK_LIVE_FRAME (frame, 0); |
184 #endif | |
185 | 183 |
186 return FRAME_MINIBUF_WINDOW (XFRAME (frame)); | 184 return FRAME_MINIBUF_WINDOW (XFRAME (frame)); |
187 } | 185 } |
188 | 186 |
189 DEFUN ("window-minibuffer-p", Fwindow_minibuffer_p, Swindow_minibuffer_p, 0, 1, 0, | 187 DEFUN ("window-minibuffer-p", Fwindow_minibuffer_p, Swindow_minibuffer_p, 0, 1, 0, |
485 (x, y, frame) | 483 (x, y, frame) |
486 Lisp_Object x, y, frame; | 484 Lisp_Object x, y, frame; |
487 { | 485 { |
488 int part; | 486 int part; |
489 | 487 |
490 #ifdef MULTI_FRAME | |
491 if (NILP (frame)) | 488 if (NILP (frame)) |
492 XSETFRAME (frame, selected_frame); | 489 XSETFRAME (frame, selected_frame); |
493 else | 490 else |
494 CHECK_LIVE_FRAME (frame, 2); | 491 CHECK_LIVE_FRAME (frame, 2); |
495 #endif | |
496 CHECK_NUMBER (x, 0); | 492 CHECK_NUMBER (x, 0); |
497 CHECK_NUMBER (y, 1); | 493 CHECK_NUMBER (y, 1); |
498 | 494 |
499 return window_from_coordinates (XFRAME (frame), | 495 return window_from_coordinates (XFRAME (frame), |
500 XINT (x), XINT (y), | 496 XINT (x), XINT (y), |
953 minibuf = Qlambda; | 949 minibuf = Qlambda; |
954 /* Now minibuf can be t => count all minibuffer windows, | 950 /* Now minibuf can be t => count all minibuffer windows, |
955 lambda => count none of them, | 951 lambda => count none of them, |
956 or a specific minibuffer window (the active one) to count. */ | 952 or a specific minibuffer window (the active one) to count. */ |
957 | 953 |
958 #ifdef MULTI_FRAME | |
959 /* all_frames == nil doesn't specify which frames to include. */ | 954 /* all_frames == nil doesn't specify which frames to include. */ |
960 if (NILP (all_frames)) | 955 if (NILP (all_frames)) |
961 all_frames = (! EQ (minibuf, Qlambda) | 956 all_frames = (! EQ (minibuf, Qlambda) |
962 ? (FRAME_MINIBUF_WINDOW | 957 ? (FRAME_MINIBUF_WINDOW |
963 (XFRAME | 958 (XFRAME |
977 /* Now all_frames is t meaning search all frames, | 972 /* Now all_frames is t meaning search all frames, |
978 nil meaning search just current frame, | 973 nil meaning search just current frame, |
979 visible meaning search just visible frames, | 974 visible meaning search just visible frames, |
980 0 meaning search visible and iconified frames, | 975 0 meaning search visible and iconified frames, |
981 or a window, meaning search the frame that window belongs to. */ | 976 or a window, meaning search the frame that window belongs to. */ |
982 #endif | |
983 | 977 |
984 /* Do this loop at least once, to get the next window, and perhaps | 978 /* Do this loop at least once, to get the next window, and perhaps |
985 again, if we hit the minibuffer and that is not acceptable. */ | 979 again, if we hit the minibuffer and that is not acceptable. */ |
986 do | 980 do |
987 { | 981 { |
993 else | 987 else |
994 { | 988 { |
995 /* We've reached the end of this frame. | 989 /* We've reached the end of this frame. |
996 Which other frames are acceptable? */ | 990 Which other frames are acceptable? */ |
997 tem = WINDOW_FRAME (XWINDOW (window)); | 991 tem = WINDOW_FRAME (XWINDOW (window)); |
998 #ifdef MULTI_FRAME | |
999 if (! NILP (all_frames)) | 992 if (! NILP (all_frames)) |
1000 { | 993 { |
1001 Lisp_Object tem1; | 994 Lisp_Object tem1; |
1002 | 995 |
1003 tem1 = tem; | 996 tem1 = tem; |
1008 If that happens, go back to the selected frame | 1001 If that happens, go back to the selected frame |
1009 so we can complete the cycle. */ | 1002 so we can complete the cycle. */ |
1010 if (EQ (tem, tem1)) | 1003 if (EQ (tem, tem1)) |
1011 XSETFRAME (tem, selected_frame); | 1004 XSETFRAME (tem, selected_frame); |
1012 } | 1005 } |
1013 #endif | |
1014 tem = FRAME_ROOT_WINDOW (XFRAME (tem)); | 1006 tem = FRAME_ROOT_WINDOW (XFRAME (tem)); |
1015 | 1007 |
1016 break; | 1008 break; |
1017 } | 1009 } |
1018 | 1010 |
1099 minibuf = Qlambda; | 1091 minibuf = Qlambda; |
1100 /* Now minibuf can be t => count all minibuffer windows, | 1092 /* Now minibuf can be t => count all minibuffer windows, |
1101 lambda => count none of them, | 1093 lambda => count none of them, |
1102 or a specific minibuffer window (the active one) to count. */ | 1094 or a specific minibuffer window (the active one) to count. */ |
1103 | 1095 |
1104 #ifdef MULTI_FRAME | |
1105 /* all_frames == nil doesn't specify which frames to include. | 1096 /* all_frames == nil doesn't specify which frames to include. |
1106 Decide which frames it includes. */ | 1097 Decide which frames it includes. */ |
1107 if (NILP (all_frames)) | 1098 if (NILP (all_frames)) |
1108 all_frames = (! EQ (minibuf, Qlambda) | 1099 all_frames = (! EQ (minibuf, Qlambda) |
1109 ? (FRAME_MINIBUF_WINDOW | 1100 ? (FRAME_MINIBUF_WINDOW |
1124 /* Now all_frames is t meaning search all frames, | 1115 /* Now all_frames is t meaning search all frames, |
1125 nil meaning search just current frame, | 1116 nil meaning search just current frame, |
1126 visible meaning search just visible frames, | 1117 visible meaning search just visible frames, |
1127 0 meaning search visible and iconified frames, | 1118 0 meaning search visible and iconified frames, |
1128 or a window, meaning search the frame that window belongs to. */ | 1119 or a window, meaning search the frame that window belongs to. */ |
1129 #endif | |
1130 | 1120 |
1131 /* Do this loop at least once, to get the previous window, and perhaps | 1121 /* Do this loop at least once, to get the previous window, and perhaps |
1132 again, if we hit the minibuffer and that is not acceptable. */ | 1122 again, if we hit the minibuffer and that is not acceptable. */ |
1133 do | 1123 do |
1134 { | 1124 { |
1140 else | 1130 else |
1141 { | 1131 { |
1142 /* We have found the top window on the frame. | 1132 /* We have found the top window on the frame. |
1143 Which frames are acceptable? */ | 1133 Which frames are acceptable? */ |
1144 tem = WINDOW_FRAME (XWINDOW (window)); | 1134 tem = WINDOW_FRAME (XWINDOW (window)); |
1145 #ifdef MULTI_FRAME | |
1146 if (! NILP (all_frames)) | 1135 if (! NILP (all_frames)) |
1147 /* It's actually important that we use prev_frame here, | 1136 /* It's actually important that we use prev_frame here, |
1148 rather than next_frame. All the windows acceptable | 1137 rather than next_frame. All the windows acceptable |
1149 according to the given parameters should form a ring; | 1138 according to the given parameters should form a ring; |
1150 Fnext_window and Fprevious_window should go back and | 1139 Fnext_window and Fprevious_window should go back and |
1164 If that happens, go back to the selected frame | 1153 If that happens, go back to the selected frame |
1165 so we can complete the cycle. */ | 1154 so we can complete the cycle. */ |
1166 if (EQ (tem, tem1)) | 1155 if (EQ (tem, tem1)) |
1167 XSETFRAME (tem, selected_frame); | 1156 XSETFRAME (tem, selected_frame); |
1168 } | 1157 } |
1169 #endif | |
1170 /* If this frame has a minibuffer, find that window first, | 1158 /* If this frame has a minibuffer, find that window first, |
1171 because it is conceptually the last window in that frame. */ | 1159 because it is conceptually the last window in that frame. */ |
1172 if (FRAME_HAS_MINIBUF_P (XFRAME (tem))) | 1160 if (FRAME_HAS_MINIBUF_P (XFRAME (tem))) |
1173 tem = FRAME_MINIBUF_WINDOW (XFRAME (tem)); | 1161 tem = FRAME_MINIBUF_WINDOW (XFRAME (tem)); |
1174 else | 1162 else |
1267 register Lisp_Object last_window; | 1255 register Lisp_Object last_window; |
1268 FRAME_PTR frame; | 1256 FRAME_PTR frame; |
1269 Lisp_Object frame_arg; | 1257 Lisp_Object frame_arg; |
1270 frame_arg = Qt; | 1258 frame_arg = Qt; |
1271 | 1259 |
1272 #ifdef MULTI_FRAME | |
1273 /* If we're only looping through windows on a particular frame, | 1260 /* If we're only looping through windows on a particular frame, |
1274 frame points to that frame. If we're looping through windows | 1261 frame points to that frame. If we're looping through windows |
1275 on all frames, frame is 0. */ | 1262 on all frames, frame is 0. */ |
1276 if (FRAMEP (frames)) | 1263 if (FRAMEP (frames)) |
1277 frame = XFRAME (frames); | 1264 frame = XFRAME (frames); |
1283 frame_arg = Qlambda; | 1270 frame_arg = Qlambda; |
1284 else if (XFASTINT (frames) == 0) | 1271 else if (XFASTINT (frames) == 0) |
1285 frame_arg = frames; | 1272 frame_arg = frames; |
1286 else if (EQ (frames, Qvisible)) | 1273 else if (EQ (frames, Qvisible)) |
1287 frame_arg = frames; | 1274 frame_arg = frames; |
1288 #else | |
1289 frame = 0; | |
1290 #endif | |
1291 | 1275 |
1292 /* frame_arg is Qlambda to stick to one frame, | 1276 /* frame_arg is Qlambda to stick to one frame, |
1293 Qvisible to consider all visible frames, | 1277 Qvisible to consider all visible frames, |
1294 or Qt otherwise. */ | 1278 or Qt otherwise. */ |
1295 | 1279 |
1352 break; | 1336 break; |
1353 | 1337 |
1354 case DELETE_BUFFER_WINDOWS: | 1338 case DELETE_BUFFER_WINDOWS: |
1355 if (EQ (XWINDOW (w)->buffer, obj)) | 1339 if (EQ (XWINDOW (w)->buffer, obj)) |
1356 { | 1340 { |
1357 #ifdef MULTI_FRAME | |
1358 FRAME_PTR f = XFRAME (WINDOW_FRAME (XWINDOW (w))); | 1341 FRAME_PTR f = XFRAME (WINDOW_FRAME (XWINDOW (w))); |
1359 | 1342 |
1360 /* If this window is dedicated, and in a frame of its own, | 1343 /* If this window is dedicated, and in a frame of its own, |
1361 kill the frame. */ | 1344 kill the frame. */ |
1362 if (EQ (w, FRAME_ROOT_WINDOW (f)) | 1345 if (EQ (w, FRAME_ROOT_WINDOW (f)) |
1381 } | 1364 } |
1382 /* Now we can safely delete the frame. */ | 1365 /* Now we can safely delete the frame. */ |
1383 Fdelete_frame (WINDOW_FRAME (XWINDOW (w)), Qnil); | 1366 Fdelete_frame (WINDOW_FRAME (XWINDOW (w)), Qnil); |
1384 } | 1367 } |
1385 else | 1368 else |
1386 #endif | |
1387 /* If we're deleting the buffer displayed in the only window | 1369 /* If we're deleting the buffer displayed in the only window |
1388 on the frame, find a new buffer to display there. */ | 1370 on the frame, find a new buffer to display there. */ |
1389 if (NILP (XWINDOW (w)->parent)) | 1371 if (NILP (XWINDOW (w)->parent)) |
1390 { | 1372 { |
1391 Lisp_Object new_buffer; | 1373 Lisp_Object new_buffer; |
1426 FRAME_PTR f = XFRAME (WINDOW_FRAME (XWINDOW (w))); | 1408 FRAME_PTR f = XFRAME (WINDOW_FRAME (XWINDOW (w))); |
1427 another_buffer = Fother_buffer (obj, Qnil); | 1409 another_buffer = Fother_buffer (obj, Qnil); |
1428 if (NILP (another_buffer)) | 1410 if (NILP (another_buffer)) |
1429 another_buffer | 1411 another_buffer |
1430 = Fget_buffer_create (build_string ("*scratch*")); | 1412 = Fget_buffer_create (build_string ("*scratch*")); |
1431 #ifdef MULTI_FRAME | |
1432 /* If this window is dedicated, and in a frame of its own, | 1413 /* If this window is dedicated, and in a frame of its own, |
1433 kill the frame. */ | 1414 kill the frame. */ |
1434 if (EQ (w, FRAME_ROOT_WINDOW (f)) | 1415 if (EQ (w, FRAME_ROOT_WINDOW (f)) |
1435 && !NILP (XWINDOW (w)->dedicated) | 1416 && !NILP (XWINDOW (w)->dedicated) |
1436 && other_visible_frames (f)) | 1417 && other_visible_frames (f)) |
1453 } | 1434 } |
1454 /* Now we can safely delete the frame. */ | 1435 /* Now we can safely delete the frame. */ |
1455 Fdelete_frame (WINDOW_FRAME (XWINDOW (w)), Qnil); | 1436 Fdelete_frame (WINDOW_FRAME (XWINDOW (w)), Qnil); |
1456 } | 1437 } |
1457 else | 1438 else |
1458 #endif | |
1459 { | 1439 { |
1460 /* Otherwise show a different buffer in the window. */ | 1440 /* Otherwise show a different buffer in the window. */ |
1461 XWINDOW (w)->dedicated = Qnil; | 1441 XWINDOW (w)->dedicated = Qnil; |
1462 Fset_window_buffer (w, another_buffer); | 1442 Fset_window_buffer (w, another_buffer); |
1463 if (EQ (w, selected_window)) | 1443 if (EQ (w, selected_window)) |
1595 If `visible', delete all windows showing BUFFER in any visible frame.\n\ | 1575 If `visible', delete all windows showing BUFFER in any visible frame.\n\ |
1596 If a frame, delete only windows showing BUFFER in that frame.") | 1576 If a frame, delete only windows showing BUFFER in that frame.") |
1597 (buffer, frame) | 1577 (buffer, frame) |
1598 Lisp_Object buffer, frame; | 1578 Lisp_Object buffer, frame; |
1599 { | 1579 { |
1600 #ifdef MULTI_FRAME | |
1601 /* FRAME uses t and nil to mean the opposite of what window_loop | 1580 /* FRAME uses t and nil to mean the opposite of what window_loop |
1602 expects. */ | 1581 expects. */ |
1603 if (! FRAMEP (frame)) | 1582 if (! FRAMEP (frame)) |
1604 frame = NILP (frame) ? Qt : Qnil; | 1583 frame = NILP (frame) ? Qt : Qnil; |
1605 #else | |
1606 frame = Qt; | |
1607 #endif | |
1608 | 1584 |
1609 if (!NILP (buffer)) | 1585 if (!NILP (buffer)) |
1610 { | 1586 { |
1611 buffer = Fget_buffer (buffer); | 1587 buffer = Fget_buffer (buffer); |
1612 CHECK_BUFFER (buffer, 0); | 1588 CHECK_BUFFER (buffer, 0); |
1925 | 1901 |
1926 Fset_marker (ow->pointm, make_number (BUF_PT (XBUFFER (ow->buffer))), | 1902 Fset_marker (ow->pointm, make_number (BUF_PT (XBUFFER (ow->buffer))), |
1927 ow->buffer); | 1903 ow->buffer); |
1928 | 1904 |
1929 selected_window = window; | 1905 selected_window = window; |
1930 #ifdef MULTI_FRAME | |
1931 if (XFRAME (WINDOW_FRAME (w)) != selected_frame) | 1906 if (XFRAME (WINDOW_FRAME (w)) != selected_frame) |
1932 { | 1907 { |
1933 XFRAME (WINDOW_FRAME (w))->selected_window = window; | 1908 XFRAME (WINDOW_FRAME (w))->selected_window = window; |
1934 /* Use this rather than Fhandle_switch_frame | 1909 /* Use this rather than Fhandle_switch_frame |
1935 so that FRAME_FOCUS_FRAME is moved appropriately as we | 1910 so that FRAME_FOCUS_FRAME is moved appropriately as we |
1937 frame is active. */ | 1912 frame is active. */ |
1938 Fselect_frame (WINDOW_FRAME (w), Qnil); | 1913 Fselect_frame (WINDOW_FRAME (w), Qnil); |
1939 } | 1914 } |
1940 else | 1915 else |
1941 selected_frame->selected_window = window; | 1916 selected_frame->selected_window = window; |
1942 #endif | |
1943 | 1917 |
1944 record_buffer (w->buffer); | 1918 record_buffer (w->buffer); |
1945 Fset_buffer (w->buffer); | 1919 Fset_buffer (w->buffer); |
1946 | 1920 |
1947 /* Go to the point recorded in the window. | 1921 /* Go to the point recorded in the window. |
1975 | 1949 |
1976 static Lisp_Object | 1950 static Lisp_Object |
1977 display_buffer_1 (window) | 1951 display_buffer_1 (window) |
1978 Lisp_Object window; | 1952 Lisp_Object window; |
1979 { | 1953 { |
1980 #ifdef MULTI_FRAME | |
1981 FRAME_PTR f = XFRAME (WINDOW_FRAME (XWINDOW (window))); | 1954 FRAME_PTR f = XFRAME (WINDOW_FRAME (XWINDOW (window))); |
1982 FRAME_SAMPLE_VISIBILITY (f); | 1955 FRAME_SAMPLE_VISIBILITY (f); |
1983 if (f != selected_frame) | 1956 if (f != selected_frame) |
1984 { | 1957 { |
1985 if (FRAME_ICONIFIED_P (f)) | 1958 if (FRAME_ICONIFIED_P (f)) |
1986 Fmake_frame_visible (WINDOW_FRAME (XWINDOW (window))); | 1959 Fmake_frame_visible (WINDOW_FRAME (XWINDOW (window))); |
1987 else if (FRAME_VISIBLE_P (f)) | 1960 else if (FRAME_VISIBLE_P (f)) |
1988 Fraise_frame (WINDOW_FRAME (XWINDOW (window))); | 1961 Fraise_frame (WINDOW_FRAME (XWINDOW (window))); |
1989 } | 1962 } |
1990 #endif | |
1991 return window; | 1963 return window; |
1992 } | 1964 } |
1993 | 1965 |
1994 DEFUN ("display-buffer", Fdisplay_buffer, Sdisplay_buffer, 1, 2, | 1966 DEFUN ("display-buffer", Fdisplay_buffer, Sdisplay_buffer, 1, 2, |
1995 "bDisplay buffer: \nP", | 1967 "bDisplay buffer: \nP", |
2055 return display_buffer_1 (selected_window); | 2027 return display_buffer_1 (selected_window); |
2056 } | 2028 } |
2057 } | 2029 } |
2058 } | 2030 } |
2059 | 2031 |
2060 #ifdef MULTI_FRAME | |
2061 /* If pop_up_frames, | 2032 /* If pop_up_frames, |
2062 look for a window showing BUFFER on any visible or iconified frame. | 2033 look for a window showing BUFFER on any visible or iconified frame. |
2063 Otherwise search only the current frame. */ | 2034 Otherwise search only the current frame. */ |
2064 if (pop_up_frames || last_nonminibuf_frame == 0) | 2035 if (pop_up_frames || last_nonminibuf_frame == 0) |
2065 XSETFASTINT (tem, 0); | 2036 XSETFASTINT (tem, 0); |
2066 else | 2037 else |
2067 #endif | |
2068 XSETFRAME (tem, last_nonminibuf_frame); | 2038 XSETFRAME (tem, last_nonminibuf_frame); |
2069 window = Fget_buffer_window (buffer, tem); | 2039 window = Fget_buffer_window (buffer, tem); |
2070 if (!NILP (window) | 2040 if (!NILP (window) |
2071 && (NILP (not_this_window) || !EQ (window, selected_window))) | 2041 && (NILP (not_this_window) || !EQ (window, selected_window))) |
2072 { | 2042 { |
2098 buffer, | 2068 buffer, |
2099 XCONS (car)->cdr); | 2069 XCONS (car)->cdr); |
2100 } | 2070 } |
2101 } | 2071 } |
2102 | 2072 |
2103 #ifdef MULTI_FRAME | |
2104 /* If there are no frames open that have more than a minibuffer, | 2073 /* If there are no frames open that have more than a minibuffer, |
2105 we need to create a new frame. */ | 2074 we need to create a new frame. */ |
2106 if (pop_up_frames || last_nonminibuf_frame == 0) | 2075 if (pop_up_frames || last_nonminibuf_frame == 0) |
2107 { | 2076 { |
2108 window = Fframe_selected_window (call0 (Vpop_up_frame_function)); | 2077 window = Fframe_selected_window (call0 (Vpop_up_frame_function)); |
2109 Fset_window_buffer (window, buffer); | 2078 Fset_window_buffer (window, buffer); |
2110 return display_buffer_1 (window); | 2079 return display_buffer_1 (window); |
2111 } | 2080 } |
2112 #endif /* MULTI_FRAME */ | |
2113 | 2081 |
2114 if (pop_up_windows | 2082 if (pop_up_windows |
2115 #ifdef MULTI_FRAME | |
2116 || FRAME_MINIBUF_ONLY_P (selected_frame) | 2083 || FRAME_MINIBUF_ONLY_P (selected_frame) |
2117 /* If the current frame is a special display frame, | 2084 /* If the current frame is a special display frame, |
2118 don't try to reuse its windows. */ | 2085 don't try to reuse its windows. */ |
2119 || !NILP (XWINDOW (FRAME_ROOT_WINDOW (selected_frame))->dedicated) | 2086 || !NILP (XWINDOW (FRAME_ROOT_WINDOW (selected_frame))->dedicated) |
2120 #endif | |
2121 ) | 2087 ) |
2122 { | 2088 { |
2123 Lisp_Object frames; | 2089 Lisp_Object frames; |
2124 | 2090 |
2125 frames = Qnil; | 2091 frames = Qnil; |
2126 #ifdef MULTI_FRAME | |
2127 if (FRAME_MINIBUF_ONLY_P (selected_frame)) | 2092 if (FRAME_MINIBUF_ONLY_P (selected_frame)) |
2128 XSETFRAME (frames, last_nonminibuf_frame); | 2093 XSETFRAME (frames, last_nonminibuf_frame); |
2129 #endif | |
2130 /* Don't try to create a window if would get an error */ | 2094 /* Don't try to create a window if would get an error */ |
2131 if (split_height_threshold < window_min_height << 1) | 2095 if (split_height_threshold < window_min_height << 1) |
2132 split_height_threshold = window_min_height << 1; | 2096 split_height_threshold = window_min_height << 1; |
2133 | 2097 |
2134 /* Note that both Fget_largest_window and Fget_lru_window | 2098 /* Note that both Fget_largest_window and Fget_lru_window |
2135 ignore minibuffers and dedicated windows. | 2099 ignore minibuffers and dedicated windows. |
2136 This means they can return nil. */ | 2100 This means they can return nil. */ |
2137 | 2101 |
2138 #ifdef MULTI_FRAME | |
2139 /* If the frame we would try to split cannot be split, | 2102 /* If the frame we would try to split cannot be split, |
2140 try other frames. */ | 2103 try other frames. */ |
2141 if (FRAME_NO_SPLIT_P (NILP (frames) ? selected_frame | 2104 if (FRAME_NO_SPLIT_P (NILP (frames) ? selected_frame |
2142 : last_nonminibuf_frame)) | 2105 : last_nonminibuf_frame)) |
2143 { | 2106 { |
2148 window = Fget_largest_window (make_number (0)); | 2111 window = Fget_largest_window (make_number (0)); |
2149 if (NILP (window)) | 2112 if (NILP (window)) |
2150 window = Fget_largest_window (Qt); | 2113 window = Fget_largest_window (Qt); |
2151 } | 2114 } |
2152 else | 2115 else |
2153 #endif | |
2154 window = Fget_largest_window (frames); | 2116 window = Fget_largest_window (frames); |
2155 | 2117 |
2156 /* If we got a tall enough full-width window that can be split, | 2118 /* If we got a tall enough full-width window that can be split, |
2157 split it. */ | 2119 split it. */ |
2158 if (!NILP (window) | 2120 if (!NILP (window) |
2172 && ! FRAME_NO_SPLIT_P (XFRAME (XWINDOW (window)->frame)) | 2134 && ! FRAME_NO_SPLIT_P (XFRAME (XWINDOW (window)->frame)) |
2173 && (EQ (window, selected_window) | 2135 && (EQ (window, selected_window) |
2174 || EQ (XWINDOW (window)->parent, Qnil)) | 2136 || EQ (XWINDOW (window)->parent, Qnil)) |
2175 && window_height (window) >= window_min_height << 1) | 2137 && window_height (window) >= window_min_height << 1) |
2176 window = Fsplit_window (window, Qnil, Qnil); | 2138 window = Fsplit_window (window, Qnil, Qnil); |
2177 #ifdef MULTI_FRAME | |
2178 /* If Fget_lru_window returned nil, try other approaches. */ | 2139 /* If Fget_lru_window returned nil, try other approaches. */ |
2179 /* Try visible frames first. */ | 2140 /* Try visible frames first. */ |
2180 if (NILP (window)) | 2141 if (NILP (window)) |
2181 window = Fget_largest_window (Qvisible); | 2142 window = Fget_largest_window (Qvisible); |
2182 /* If that didn't work, try iconified frames. */ | 2143 /* If that didn't work, try iconified frames. */ |
2186 if (NILP (window)) | 2147 if (NILP (window)) |
2187 window = Fget_largest_window (Qt); | 2148 window = Fget_largest_window (Qt); |
2188 /* As a last resort, make a new frame. */ | 2149 /* As a last resort, make a new frame. */ |
2189 if (NILP (window)) | 2150 if (NILP (window)) |
2190 window = Fframe_selected_window (call0 (Vpop_up_frame_function)); | 2151 window = Fframe_selected_window (call0 (Vpop_up_frame_function)); |
2191 #else | |
2192 /* As a last resort, use a non minibuffer window. */ | |
2193 if (NILP (window)) | |
2194 window = Fframe_first_window (Fselected_frame ()); | |
2195 #endif | |
2196 /* If window appears above or below another, | 2152 /* If window appears above or below another, |
2197 even out their heights. */ | 2153 even out their heights. */ |
2198 other = upper = lower = Qnil; | 2154 other = upper = lower = Qnil; |
2199 if (!NILP (XWINDOW (window)->prev)) | 2155 if (!NILP (XWINDOW (window)->prev)) |
2200 other = upper = XWINDOW (window)->prev, lower = window; | 2156 other = upper = XWINDOW (window)->prev, lower = window; |
2242 call1 (Vtemp_buffer_show_function, buf); | 2198 call1 (Vtemp_buffer_show_function, buf); |
2243 else | 2199 else |
2244 { | 2200 { |
2245 window = Fdisplay_buffer (buf, Qnil); | 2201 window = Fdisplay_buffer (buf, Qnil); |
2246 | 2202 |
2247 #ifdef MULTI_FRAME | |
2248 if (XFRAME (XWINDOW (window)->frame) != selected_frame) | 2203 if (XFRAME (XWINDOW (window)->frame) != selected_frame) |
2249 Fmake_frame_visible (WINDOW_FRAME (XWINDOW (window))); | 2204 Fmake_frame_visible (WINDOW_FRAME (XWINDOW (window))); |
2250 #endif /* MULTI_FRAME */ | |
2251 Vminibuf_scroll_window = window; | 2205 Vminibuf_scroll_window = window; |
2252 w = XWINDOW (window); | 2206 w = XWINDOW (window); |
2253 XSETFASTINT (w->hscroll, 0); | 2207 XSETFASTINT (w->hscroll, 0); |
2254 set_marker_restricted (w->start, make_number (1), buf); | 2208 set_marker_restricted (w->start, make_number (1), buf); |
2255 set_marker_restricted (w->pointm, make_number (1), buf); | 2209 set_marker_restricted (w->pointm, make_number (1), buf); |
3079 int previous_frame_menu_bar_lines = FRAME_MENU_BAR_LINES (f); | 3033 int previous_frame_menu_bar_lines = FRAME_MENU_BAR_LINES (f); |
3080 | 3034 |
3081 if (XFASTINT (data->frame_height) != previous_frame_height | 3035 if (XFASTINT (data->frame_height) != previous_frame_height |
3082 || XFASTINT (data->frame_width) != previous_frame_width) | 3036 || XFASTINT (data->frame_width) != previous_frame_width) |
3083 change_frame_size (f, data->frame_height, data->frame_width, 0, 0); | 3037 change_frame_size (f, data->frame_height, data->frame_width, 0, 0); |
3084 #if defined (HAVE_WINDOW_SYSTEM) || (defined (MSDOS) && defined (MULTI_FRAME)) | 3038 #if defined (HAVE_WINDOW_SYSTEM) || defined (MSDOS) |
3085 if (XFASTINT (data->frame_menu_bar_lines) | 3039 if (XFASTINT (data->frame_menu_bar_lines) |
3086 != previous_frame_menu_bar_lines) | 3040 != previous_frame_menu_bar_lines) |
3087 x_set_menu_bar_lines (f, data->frame_menu_bar_lines, 0); | 3041 x_set_menu_bar_lines (f, data->frame_menu_bar_lines, 0); |
3088 #endif | 3042 #endif |
3089 | 3043 |
3207 } | 3161 } |
3208 | 3162 |
3209 FRAME_ROOT_WINDOW (f) = data->root_window; | 3163 FRAME_ROOT_WINDOW (f) = data->root_window; |
3210 Fselect_window (data->current_window); | 3164 Fselect_window (data->current_window); |
3211 | 3165 |
3212 #ifdef MULTI_FRAME | |
3213 if (NILP (data->focus_frame) | 3166 if (NILP (data->focus_frame) |
3214 || (FRAMEP (data->focus_frame) | 3167 || (FRAMEP (data->focus_frame) |
3215 && FRAME_LIVE_P (XFRAME (data->focus_frame)))) | 3168 && FRAME_LIVE_P (XFRAME (data->focus_frame)))) |
3216 Fredirect_frame_focus (frame, data->focus_frame); | 3169 Fredirect_frame_focus (frame, data->focus_frame); |
3217 #endif | |
3218 | 3170 |
3219 #if 0 /* I don't understand why this is needed, and it causes problems | 3171 #if 0 /* I don't understand why this is needed, and it causes problems |
3220 when the frame's old selected window has been deleted. */ | 3172 when the frame's old selected window has been deleted. */ |
3221 #ifdef MULTI_FRAME | |
3222 if (f != selected_frame && FRAME_WINDOW_P (f)) | 3173 if (f != selected_frame && FRAME_WINDOW_P (f)) |
3223 do_switch_frame (WINDOW_FRAME (XWINDOW (data->root_window)), | 3174 do_switch_frame (WINDOW_FRAME (XWINDOW (data->root_window)), |
3224 Qnil, 0); | 3175 Qnil, 0); |
3225 #endif | |
3226 #endif | 3176 #endif |
3227 | 3177 |
3228 /* Set the screen height to the value it had before this function. */ | 3178 /* Set the screen height to the value it had before this function. */ |
3229 if (previous_frame_height != FRAME_HEIGHT (f) | 3179 if (previous_frame_height != FRAME_HEIGHT (f) |
3230 || previous_frame_width != FRAME_WIDTH (f)) | 3180 || previous_frame_width != FRAME_WIDTH (f)) |
3231 change_frame_size (f, previous_frame_height, previous_frame_width, | 3181 change_frame_size (f, previous_frame_height, previous_frame_width, |
3232 0, 0); | 3182 0, 0); |
3233 #if defined (HAVE_WINDOW_SYSTEM) || (defined (MSDOS) && defined (MULTI_FRAME)) | 3183 #if defined (HAVE_WINDOW_SYSTEM) || defined (MSDOS) |
3234 if (previous_frame_menu_bar_lines != FRAME_MENU_BAR_LINES (f)) | 3184 if (previous_frame_menu_bar_lines != FRAME_MENU_BAR_LINES (f)) |
3235 x_set_menu_bar_lines (f, previous_frame_menu_bar_lines, 0); | 3185 x_set_menu_bar_lines (f, previous_frame_menu_bar_lines, 0); |
3236 #endif | 3186 #endif |
3237 } | 3187 } |
3238 | 3188 |
3239 /* Restore the minimum heights recorded in the configuration. */ | 3189 /* Restore the minimum heights recorded in the configuration. */ |
3240 window_min_height = XINT (data->min_height); | 3190 window_min_height = XINT (data->min_height); |
3241 window_min_width = XINT (data->min_width); | 3191 window_min_width = XINT (data->min_width); |
3242 | 3192 |
3243 #ifdef MULTI_FRAME | |
3244 /* Fselect_window will have made f the selected frame, so we | 3193 /* Fselect_window will have made f the selected frame, so we |
3245 reselect the proper frame here. Fhandle_switch_frame will change the | 3194 reselect the proper frame here. Fhandle_switch_frame will change the |
3246 selected window too, but that doesn't make the call to | 3195 selected window too, but that doesn't make the call to |
3247 Fselect_window above totally superfluous; it still sets f's | 3196 Fselect_window above totally superfluous; it still sets f's |
3248 selected window. */ | 3197 selected window. */ |
3249 if (FRAME_LIVE_P (XFRAME (data->selected_frame))) | 3198 if (FRAME_LIVE_P (XFRAME (data->selected_frame))) |
3250 do_switch_frame (data->selected_frame, Qnil, 0); | 3199 do_switch_frame (data->selected_frame, Qnil, 0); |
3251 #endif | |
3252 | 3200 |
3253 if (!NILP (new_current_buffer)) | 3201 if (!NILP (new_current_buffer)) |
3254 Fset_buffer (new_current_buffer); | 3202 Fset_buffer (new_current_buffer); |
3255 | 3203 |
3256 Vminibuf_scroll_window = data->minibuf_scroll_window; | 3204 Vminibuf_scroll_window = data->minibuf_scroll_window; |
3403 data = (struct save_window_data *)vec; | 3351 data = (struct save_window_data *)vec; |
3404 | 3352 |
3405 XSETFASTINT (data->frame_width, FRAME_WIDTH (f)); | 3353 XSETFASTINT (data->frame_width, FRAME_WIDTH (f)); |
3406 XSETFASTINT (data->frame_height, FRAME_HEIGHT (f)); | 3354 XSETFASTINT (data->frame_height, FRAME_HEIGHT (f)); |
3407 XSETFASTINT (data->frame_menu_bar_lines, FRAME_MENU_BAR_LINES (f)); | 3355 XSETFASTINT (data->frame_menu_bar_lines, FRAME_MENU_BAR_LINES (f)); |
3408 #ifdef MULTI_FRAME | |
3409 XSETFRAME (data->selected_frame, selected_frame); | 3356 XSETFRAME (data->selected_frame, selected_frame); |
3410 #endif | |
3411 data->current_window = FRAME_SELECTED_WINDOW (f); | 3357 data->current_window = FRAME_SELECTED_WINDOW (f); |
3412 XSETBUFFER (data->current_buffer, current_buffer); | 3358 XSETBUFFER (data->current_buffer, current_buffer); |
3413 data->minibuf_scroll_window = Vminibuf_scroll_window; | 3359 data->minibuf_scroll_window = Vminibuf_scroll_window; |
3414 data->root_window = FRAME_ROOT_WINDOW (f); | 3360 data->root_window = FRAME_ROOT_WINDOW (f); |
3415 data->focus_frame = FRAME_FOCUS_FRAME (f); | 3361 data->focus_frame = FRAME_FOCUS_FRAME (f); |
3446 return unbind_to (count, val); | 3392 return unbind_to (count, val); |
3447 } | 3393 } |
3448 | 3394 |
3449 init_window_once () | 3395 init_window_once () |
3450 { | 3396 { |
3451 #ifdef MULTI_FRAME | |
3452 selected_frame = make_terminal_frame (); | 3397 selected_frame = make_terminal_frame (); |
3453 XSETFRAME (Vterminal_frame, selected_frame); | 3398 XSETFRAME (Vterminal_frame, selected_frame); |
3454 minibuf_window = selected_frame->minibuffer_window; | 3399 minibuf_window = selected_frame->minibuffer_window; |
3455 selected_window = selected_frame->selected_window; | 3400 selected_window = selected_frame->selected_window; |
3456 last_nonminibuf_frame = selected_frame; | 3401 last_nonminibuf_frame = selected_frame; |
3457 #else /* not MULTI_FRAME */ | |
3458 extern Lisp_Object get_minibuffer (); | |
3459 | |
3460 selected_frame = last_nonminibuf_frame = &the_only_frame; | |
3461 | |
3462 minibuf_window = make_window (); | |
3463 FRAME_ROOT_WINDOW (selected_frame) = make_window (); | |
3464 | |
3465 XWINDOW (FRAME_ROOT_WINDOW (selected_frame))->next = minibuf_window; | |
3466 XWINDOW (minibuf_window)->prev = FRAME_ROOT_WINDOW (selected_frame); | |
3467 XWINDOW (minibuf_window)->mini_p = Qt; | |
3468 | |
3469 /* These values 9 and 10 are arbitrary, | |
3470 just so that there is "something there." | |
3471 Correct values are put in in init_xdisp */ | |
3472 | |
3473 XSETFASTINT (XWINDOW (FRAME_ROOT_WINDOW (selected_frame))->width, 10); | |
3474 XSETFASTINT (XWINDOW (minibuf_window)->width, 10); | |
3475 | |
3476 XSETFASTINT (XWINDOW (FRAME_ROOT_WINDOW (selected_frame))->height, 9); | |
3477 XSETFASTINT (XWINDOW (minibuf_window)->top, 9); | |
3478 XSETFASTINT (XWINDOW (minibuf_window)->height, 1); | |
3479 | |
3480 /* Prevent error in Fset_window_buffer. */ | |
3481 XWINDOW (FRAME_ROOT_WINDOW (selected_frame))->buffer = Qt; | |
3482 XWINDOW (minibuf_window)->buffer = Qt; | |
3483 | |
3484 /* Now set them up for real. */ | |
3485 Fset_window_buffer (FRAME_ROOT_WINDOW (selected_frame), | |
3486 Fcurrent_buffer ()); | |
3487 Fset_window_buffer (minibuf_window, get_minibuffer (0)); | |
3488 | |
3489 selected_window = FRAME_ROOT_WINDOW (selected_frame); | |
3490 /* Make sure this window seems more recently used than | |
3491 a newly-created, never-selected window. Increment | |
3492 window_select_count so the first selection ever will get | |
3493 something newer than this. */ | |
3494 XSETFASTINT (XWINDOW (selected_window)->use_time, ++window_select_count); | |
3495 #endif /* not MULTI_FRAME */ | |
3496 | 3402 |
3497 window_initialized = 1; | 3403 window_initialized = 1; |
3498 } | 3404 } |
3499 | 3405 |
3500 syms_of_window () | 3406 syms_of_window () |
3505 Qwindow_live_p = intern ("window-live-p"); | 3411 Qwindow_live_p = intern ("window-live-p"); |
3506 staticpro (&Qwindow_live_p); | 3412 staticpro (&Qwindow_live_p); |
3507 | 3413 |
3508 Qtemp_buffer_show_hook = intern ("temp-buffer-show-hook"); | 3414 Qtemp_buffer_show_hook = intern ("temp-buffer-show-hook"); |
3509 staticpro (&Qtemp_buffer_show_hook); | 3415 staticpro (&Qtemp_buffer_show_hook); |
3510 | |
3511 #ifndef MULTI_FRAME | |
3512 /* Make sure all windows get marked */ | |
3513 staticpro (&minibuf_window); | |
3514 #endif | |
3515 | 3416 |
3516 DEFVAR_LISP ("temp-buffer-show-function", &Vtemp_buffer_show_function, | 3417 DEFVAR_LISP ("temp-buffer-show-function", &Vtemp_buffer_show_function, |
3517 "Non-nil means call as function to display a help buffer.\n\ | 3418 "Non-nil means call as function to display a help buffer.\n\ |
3518 The function is called with one argument, the buffer to be displayed.\n\ | 3419 The function is called with one argument, the buffer to be displayed.\n\ |
3519 Used by `with-output-to-temp-buffer'.\n\ | 3420 Used by `with-output-to-temp-buffer'.\n\ |