Mercurial > emacs
comparison src/window.c @ 769:1f320a0729f8
*** empty log message ***
author | Jim Blandy <jimb@redhat.com> |
---|---|
date | Tue, 14 Jul 1992 15:21:18 +0000 |
parents | ea0823fe7df5 |
children | b3b1e7d8b8aa |
comparison
equal
deleted
inserted
replaced
768:4abf65b235d9 | 769:1f320a0729f8 |
---|---|
19 the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ | 19 the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ |
20 | 20 |
21 #include "config.h" | 21 #include "config.h" |
22 #include "lisp.h" | 22 #include "lisp.h" |
23 #include "buffer.h" | 23 #include "buffer.h" |
24 #include "screen.h" | 24 #include "frame.h" |
25 #include "window.h" | 25 #include "window.h" |
26 #include "commands.h" | 26 #include "commands.h" |
27 #include "indent.h" | 27 #include "indent.h" |
28 #include "termchar.h" | 28 #include "termchar.h" |
29 #include "disptab.h" | 29 #include "disptab.h" |
41 be left when nothing is being done with it. This must | 41 be left when nothing is being done with it. This must |
42 always be a leaf window, and its buffer is selected by | 42 always be a leaf window, and its buffer is selected by |
43 the top level editing loop at the end of each command. | 43 the top level editing loop at the end of each command. |
44 | 44 |
45 This value is always the same as | 45 This value is always the same as |
46 SCREEN_SELECTED_WINDOW (selected_screen). */ | 46 FRAME_SELECTED_WINDOW (selected_frame). */ |
47 | 47 |
48 Lisp_Object selected_window; | 48 Lisp_Object selected_window; |
49 | 49 |
50 /* The minibuffer window of the selected screen. | 50 /* The minibuffer window of the selected frame. |
51 Note that you cannot test for minibufferness of an arbitrary window | 51 Note that you cannot test for minibufferness of an arbitrary window |
52 by comparing against this; but you can test for minibufferness of | 52 by comparing against this; but you can test for minibufferness of |
53 the selected window. */ | 53 the selected window. */ |
54 Lisp_Object minibuf_window; | 54 Lisp_Object minibuf_window; |
55 | 55 |
74 int window_min_width; | 74 int window_min_width; |
75 | 75 |
76 /* Nonzero implies Fdisplay_buffer should create windows. */ | 76 /* Nonzero implies Fdisplay_buffer should create windows. */ |
77 int pop_up_windows; | 77 int pop_up_windows; |
78 | 78 |
79 /* Nonzero implies make new X screens for Fdisplay_buffer. */ | 79 /* Nonzero implies make new frames for Fdisplay_buffer. */ |
80 int pop_up_screens; | 80 int pop_up_frames; |
81 | 81 |
82 /* Non-nil means use this function instead of default */ | 82 /* Non-nil means use this function instead of default */ |
83 Lisp_Object Vpop_up_screen_function; | 83 Lisp_Object Vpop_up_frame_function; |
84 | 84 |
85 /* Function to call to handle Fdisplay_buffer. */ | 85 /* Function to call to handle Fdisplay_buffer. */ |
86 Lisp_Object Vdisplay_buffer_function; | 86 Lisp_Object Vdisplay_buffer_function; |
87 | 87 |
88 /* Fdisplay_buffer always splits the largest window | 88 /* Fdisplay_buffer always splits the largest window |
126 = XFASTINT (p->hscroll) = 0; | 126 = XFASTINT (p->hscroll) = 0; |
127 XFASTINT (p->last_point_x) = XFASTINT (p->last_point_y) = 0; | 127 XFASTINT (p->last_point_x) = XFASTINT (p->last_point_y) = 0; |
128 p->start = Fmake_marker (); | 128 p->start = Fmake_marker (); |
129 p->pointm = Fmake_marker (); | 129 p->pointm = Fmake_marker (); |
130 XFASTINT (p->use_time) = 0; | 130 XFASTINT (p->use_time) = 0; |
131 p->screen = Qnil; | 131 p->frame = Qnil; |
132 p->display_table = Qnil; | 132 p->display_table = Qnil; |
133 p->dedicated = Qnil; | 133 p->dedicated = Qnil; |
134 return val; | 134 return val; |
135 } | 135 } |
136 | 136 |
143 | 143 |
144 DEFUN ("minibuffer-window", Fminibuffer_window, Sminibuffer_window, 0, 0, 0, | 144 DEFUN ("minibuffer-window", Fminibuffer_window, Sminibuffer_window, 0, 0, 0, |
145 "Return the window used now for minibuffers.") | 145 "Return the window used now for minibuffers.") |
146 () | 146 () |
147 { | 147 { |
148 #ifdef MULTI_SCREEN | 148 #ifdef MULTI_FRAME |
149 choose_minibuf_screen (); | 149 choose_minibuf_frame (); |
150 #endif /* MULTI_SCREEN */ | 150 #endif /* MULTI_FRAME */ |
151 return minibuf_window; | 151 return minibuf_window; |
152 } | 152 } |
153 | 153 |
154 DEFUN ("window-minibuffer-p", Fwindow_minibuffer_p, Swindow_minibuffer_p, 1, 1, 0, | 154 DEFUN ("window-minibuffer-p", Fwindow_minibuffer_p, Swindow_minibuffer_p, 1, 1, 0, |
155 "Returns non-nil if WINDOW is a minibuffer window.") | 155 "Returns non-nil if WINDOW is a minibuffer window.") |
160 return (MINI_WINDOW_P (w) ? Qt : Qnil); | 160 return (MINI_WINDOW_P (w) ? Qt : Qnil); |
161 } | 161 } |
162 | 162 |
163 DEFUN ("pos-visible-in-window-p", Fpos_visible_in_window_p, | 163 DEFUN ("pos-visible-in-window-p", Fpos_visible_in_window_p, |
164 Spos_visible_in_window_p, 0, 2, 0, | 164 Spos_visible_in_window_p, 0, 2, 0, |
165 "Return t if position POS is currently on the screen in WINDOW.\n\ | 165 "Return t if position POS is currently on the frame in WINDOW.\n\ |
166 Returns nil if that position is scrolled vertically out of view.\n\ | 166 Returns nil if that position is scrolled vertically out of view.\n\ |
167 POS defaults to point; WINDOW, to the selected window.") | 167 POS defaults to point; WINDOW, to the selected window.") |
168 (pos, window) | 168 (pos, window) |
169 Lisp_Object pos, window; | 169 Lisp_Object pos, window; |
170 { | 170 { |
196 height = XFASTINT (w->height) - ! MINI_WINDOW_P (w); | 196 height = XFASTINT (w->height) - ! MINI_WINDOW_P (w); |
197 | 197 |
198 buf = XBUFFER (w->buffer); | 198 buf = XBUFFER (w->buffer); |
199 if (XFASTINT (w->last_modified) >= BUF_MODIFF (buf)) | 199 if (XFASTINT (w->last_modified) >= BUF_MODIFF (buf)) |
200 { | 200 { |
201 /* If screen is up to date, | 201 /* If frame is up to date, |
202 use the info recorded about how much text fit on it. */ | 202 use the info recorded about how much text fit on it. */ |
203 if (posint < BUF_Z (buf) - XFASTINT (w->window_end_pos) | 203 if (posint < BUF_Z (buf) - XFASTINT (w->window_end_pos) |
204 || (XFASTINT (w->window_end_vpos) < height)) | 204 || (XFASTINT (w->window_end_vpos) < height)) |
205 return Qt; | 205 return Qt; |
206 return Qnil; | 206 return Qnil; |
212 | 212 |
213 /* If that info is not correct, calculate afresh */ | 213 /* If that info is not correct, calculate afresh */ |
214 posval = *compute_motion (top, 0, 0, posint, height, 0, | 214 posval = *compute_motion (top, 0, 0, posint, height, 0, |
215 XFASTINT (w->width) - 1 | 215 XFASTINT (w->width) - 1 |
216 - (XFASTINT (w->width) + XFASTINT (w->left) | 216 - (XFASTINT (w->width) + XFASTINT (w->left) |
217 != SCREEN_WIDTH (XSCREEN (w->screen))), | 217 != FRAME_WIDTH (XFRAME (w->frame))), |
218 XINT (w->hscroll), 0); | 218 XINT (w->hscroll), 0); |
219 | 219 |
220 return posval.vpos < height ? Qt : Qnil; | 220 return posval.vpos < height ? Qt : Qnil; |
221 } | 221 } |
222 } | 222 } |
256 register struct window *w = decode_window (window); | 256 register struct window *w = decode_window (window); |
257 register int width = w->width; | 257 register int width = w->width; |
258 | 258 |
259 /* If this window does not end at the right margin, | 259 /* If this window does not end at the right margin, |
260 must deduct one column for the border */ | 260 must deduct one column for the border */ |
261 if ((width + w->left) == SCREEN_WIDTH (XSCREEN (WINDOW_SCREEN (w)))) | 261 if ((width + w->left) == FRAME_WIDTH (XFRAME (WINDOW_FRAME (w)))) |
262 return width; | 262 return width; |
263 return width - 1; | 263 return width - 1; |
264 } | 264 } |
265 | 265 |
266 DEFUN ("window-hscroll", Fwindow_hscroll, Swindow_hscroll, 0, 1, 0, | 266 DEFUN ("window-hscroll", Fwindow_hscroll, Swindow_hscroll, 0, 1, 0, |
290 return ncol; | 290 return ncol; |
291 } | 291 } |
292 | 292 |
293 DEFUN ("window-edges", Fwindow_edges, Swindow_edges, 0, 1, 0, | 293 DEFUN ("window-edges", Fwindow_edges, Swindow_edges, 0, 1, 0, |
294 "Return a list of the edge coordinates of WINDOW.\n\ | 294 "Return a list of the edge coordinates of WINDOW.\n\ |
295 \(LEFT TOP RIGHT BOTTOM), all relative to 0, 0 at top left corner of screen.\n\ | 295 \(LEFT TOP RIGHT BOTTOM), all relative to 0, 0 at top left corner of frame.\n\ |
296 RIGHT is one more than the rightmost column used by WINDOW,\n\ | 296 RIGHT is one more than the rightmost column used by WINDOW,\n\ |
297 and BOTTOM is one more than the bottommost row used by WINDOW\n\ | 297 and BOTTOM is one more than the bottommost row used by WINDOW\n\ |
298 and its mode-line.") | 298 and its mode-line.") |
299 (window) | 299 (window) |
300 Lisp_Object window; | 300 Lisp_Object window; |
336 && window_height > 1) /* 1 line => minibuffer */ | 336 && window_height > 1) /* 1 line => minibuffer */ |
337 return 2; | 337 return 2; |
338 | 338 |
339 /* Is the character in the right border? */ | 339 /* Is the character in the right border? */ |
340 if (*x == left + width - 1 | 340 if (*x == left + width - 1 |
341 && left + width != SCREEN_WIDTH (XSCREEN (w->screen))) | 341 && left + width != FRAME_WIDTH (XFRAME (w->frame))) |
342 return 3; | 342 return 3; |
343 | 343 |
344 *x -= left; | 344 *x -= left; |
345 *y -= top; | 345 *y -= top; |
346 return 1; | 346 return 1; |
348 | 348 |
349 DEFUN ("coordinates-in-window-p", Fcoordinates_in_window_p, | 349 DEFUN ("coordinates-in-window-p", Fcoordinates_in_window_p, |
350 Scoordinates_in_window_p, 2, 2, 0, | 350 Scoordinates_in_window_p, 2, 2, 0, |
351 "Return non-nil if COORDINATES are in WINDOW.\n\ | 351 "Return non-nil if COORDINATES are in WINDOW.\n\ |
352 COORDINATES is a cons of the form (X . Y), X and Y being distances\n\ | 352 COORDINATES is a cons of the form (X . Y), X and Y being distances\n\ |
353 measured in characters from the upper-left corner of the screen.\n\ | 353 measured in characters from the upper-left corner of the frame.\n\ |
354 (0 . 0) denotes the character in the upper left corner of the\n\ | 354 (0 . 0) denotes the character in the upper left corner of the\n\ |
355 screen.\n\ | 355 frame.\n\ |
356 If COORDINATES are in the text portion of WINDOW,\n\ | 356 If COORDINATES are in the text portion of WINDOW,\n\ |
357 the coordinates relative to the window are returned.\n\ | 357 the coordinates relative to the window are returned.\n\ |
358 If they are in the mode line of WINDOW, `mode-line' is returned.\n\ | 358 If they are in the mode line of WINDOW, `mode-line' is returned.\n\ |
359 If they are on the border between WINDOW and its right sibling,\n\ | 359 If they are on the border between WINDOW and its right sibling,\n\ |
360 `vertical-line' is returned.") | 360 `vertical-line' is returned.") |
391 Lisp_Object. If x, y is on the window's modeline, set *part | 391 Lisp_Object. If x, y is on the window's modeline, set *part |
392 to 1; if it is on the separating line between the window and its | 392 to 1; if it is on the separating line between the window and its |
393 right sibling, set it to 2; otherwise set it to 0. If there is no | 393 right sibling, set it to 2; otherwise set it to 0. If there is no |
394 window under x, y return nil and leave *part unmodified. */ | 394 window under x, y return nil and leave *part unmodified. */ |
395 Lisp_Object | 395 Lisp_Object |
396 window_from_coordinates (screen, x, y, part) | 396 window_from_coordinates (frame, x, y, part) |
397 SCREEN_PTR screen; | 397 FRAME_PTR frame; |
398 int x, y; | 398 int x, y; |
399 int *part; | 399 int *part; |
400 { | 400 { |
401 register Lisp_Object tem, first; | 401 register Lisp_Object tem, first; |
402 | 402 |
403 tem = first = SCREEN_SELECTED_WINDOW (screen); | 403 tem = first = FRAME_SELECTED_WINDOW (frame); |
404 | 404 |
405 do | 405 do |
406 { | 406 { |
407 int found = coordinates_in_window (XWINDOW (tem), &x, &y); | 407 int found = coordinates_in_window (XWINDOW (tem), &x, &y); |
408 | 408 |
418 | 418 |
419 return Qnil; | 419 return Qnil; |
420 } | 420 } |
421 | 421 |
422 DEFUN ("window-at", Fwindow_at, Swindow_at, 2, 3, 0, | 422 DEFUN ("window-at", Fwindow_at, Swindow_at, 2, 3, 0, |
423 "Return window containing row ROW, column COLUMN on SCREEN.\n\ | 423 "Return window containing row ROW, column COLUMN on FRAME.\n\ |
424 If omitted, SCREEN defaults to the currently selected screen.\n\ | 424 If omitted, FRAME defaults to the currently selected frame.\n\ |
425 The top left corner of the screen is considered to be row 0,\n\ | 425 The top left corner of the frame is considered to be row 0,\n\ |
426 column 0.") | 426 column 0.") |
427 (row, column, screen) | 427 (row, column, frame) |
428 Lisp_Object row, column, screen; | 428 Lisp_Object row, column, frame; |
429 { | 429 { |
430 int part; | 430 int part; |
431 | 431 |
432 if (NILP (screen)) | 432 if (NILP (frame)) |
433 XSET (screen, Lisp_Screen, selected_screen); | 433 XSET (frame, Lisp_Frame, selected_frame); |
434 else | 434 else |
435 CHECK_LIVE_SCREEN (screen, 2); | 435 CHECK_LIVE_FRAME (frame, 2); |
436 CHECK_NUMBER (row, 0); | 436 CHECK_NUMBER (row, 0); |
437 CHECK_NUMBER (column, 1); | 437 CHECK_NUMBER (column, 1); |
438 | 438 |
439 return window_from_coordinates (XSCREEN (screen), | 439 return window_from_coordinates (XFRAME (frame), |
440 XINT (row), XINT (column), | 440 XINT (row), XINT (column), |
441 &part); | 441 &part); |
442 } | 442 } |
443 | 443 |
444 DEFUN ("window-point", Fwindow_point, Swindow_point, 0, 1, 0, | 444 DEFUN ("window-point", Fwindow_point, Swindow_point, 0, 1, 0, |
629 Lisp_Object old, replacement; | 629 Lisp_Object old, replacement; |
630 { | 630 { |
631 register Lisp_Object tem; | 631 register Lisp_Object tem; |
632 register struct window *o = XWINDOW (old), *p = XWINDOW (replacement); | 632 register struct window *o = XWINDOW (old), *p = XWINDOW (replacement); |
633 | 633 |
634 /* If OLD is its screen's root_window, then replacement is the new | 634 /* If OLD is its frame's root_window, then replacement is the new |
635 root_window for that screen. */ | 635 root_window for that frame. */ |
636 | 636 |
637 if (old == SCREEN_ROOT_WINDOW (XSCREEN (o->screen))) | 637 if (old == FRAME_ROOT_WINDOW (XFRAME (o->frame))) |
638 SCREEN_ROOT_WINDOW (XSCREEN (o->screen)) = replacement; | 638 FRAME_ROOT_WINDOW (XFRAME (o->frame)) = replacement; |
639 | 639 |
640 p->left = o->left; | 640 p->left = o->left; |
641 p->top = o->top; | 641 p->top = o->top; |
642 p->width = o->width; | 642 p->width = o->width; |
643 p->height = o->height; | 643 p->height = o->height; |
746 replace_window (parent, tem); | 746 replace_window (parent, tem); |
747 return Qnil; | 747 return Qnil; |
748 } | 748 } |
749 | 749 |
750 | 750 |
751 extern Lisp_Object next_screen (), prev_screen (); | 751 extern Lisp_Object next_frame (), prev_frame (); |
752 | 752 |
753 DEFUN ("next-window", Fnext_window, Snext_window, 0, 3, 0, | 753 DEFUN ("next-window", Fnext_window, Snext_window, 0, 3, 0, |
754 "Return next window after WINDOW in canonical ordering of windows.\n\ | 754 "Return next window after WINDOW in canonical ordering of windows.\n\ |
755 If omitted, WINDOW defaults to the selected window.\n\ | 755 If omitted, WINDOW defaults to the selected window.\n\ |
756 \n\ | 756 \n\ |
757 Optional second arg MINIBUF t means count the minibuffer window even\n\ | 757 Optional second arg MINIBUF t means count the minibuffer window even\n\ |
758 if not active. MINIBUF nil or omitted means count the minibuffer iff\n\ | 758 if not active. MINIBUF nil or omitted means count the minibuffer iff\n\ |
759 it is active. MINIBUF neither t nor nil means not to count the\n\ | 759 it is active. MINIBUF neither t nor nil means not to count the\n\ |
760 minibuffer even if it is active.\n\ | 760 minibuffer even if it is active.\n\ |
761 \n\ | 761 \n\ |
762 Several screens may share a single minibuffer; if the minibuffer\n\ | 762 Several frames may share a single minibuffer; if the minibuffer\n\ |
763 counts, all windows on all screens that share that minibuffer count\n\ | 763 counts, all windows on all frames that share that minibuffer count\n\ |
764 too. This means that next-window may be used to iterate through the\n\ | 764 too. This means that next-window may be used to iterate through the\n\ |
765 set of windows even when the minibuffer is on another screen. If the\n\ | 765 set of windows even when the minibuffer is on another frame. If the\n\ |
766 minibuffer does not count, only windows from WINDOW's screen count.\n\ | 766 minibuffer does not count, only windows from WINDOW's frame count.\n\ |
767 \n\ | 767 \n\ |
768 Optional third arg ALL-SCREENS t means include windows on all screens.\n\ | 768 Optional third arg ALL-FRAMES t means include windows on all frames.\n\ |
769 ALL-SCREENS nil or omitted means cycle within the screens as specified\n\ | 769 ALL-FRAMES nil or omitted means cycle within the frames as specified\n\ |
770 above. If neither nil nor t, restrict to WINDOW's screen.") | 770 above. If neither nil nor t, restrict to WINDOW's frame.") |
771 (window, minibuf, all_screens) | 771 (window, minibuf, all_frames) |
772 register Lisp_Object window, minibuf, all_screens; | 772 register Lisp_Object window, minibuf, all_frames; |
773 { | 773 { |
774 register Lisp_Object tem; | 774 register Lisp_Object tem; |
775 Lisp_Object start_window; | 775 Lisp_Object start_window; |
776 | 776 |
777 if (NILP (window)) | 777 if (NILP (window)) |
784 /* minibuf == nil may or may not include minibuffers. | 784 /* minibuf == nil may or may not include minibuffers. |
785 Decide if it does. */ | 785 Decide if it does. */ |
786 if (NILP (minibuf)) | 786 if (NILP (minibuf)) |
787 minibuf = (minibuf_level ? Qt : Qlambda); | 787 minibuf = (minibuf_level ? Qt : Qlambda); |
788 | 788 |
789 /* all_screens == nil doesn't specify which screens to include. | 789 /* all_frames == nil doesn't specify which frames to include. |
790 Decide which screens it includes. */ | 790 Decide which frames it includes. */ |
791 if (NILP (all_screens)) | 791 if (NILP (all_frames)) |
792 all_screens = (EQ (minibuf, Qt) | 792 all_frames = (EQ (minibuf, Qt) |
793 ? (SCREEN_MINIBUF_WINDOW | 793 ? (FRAME_MINIBUF_WINDOW |
794 (XSCREEN | 794 (XFRAME |
795 (WINDOW_SCREEN | 795 (WINDOW_FRAME |
796 (XWINDOW (window))))) | 796 (XWINDOW (window))))) |
797 : Qnil); | 797 : Qnil); |
798 else if (! EQ (all_screens, Qt)) | 798 else if (! EQ (all_frames, Qt)) |
799 all_screens = Qnil; | 799 all_frames = Qnil; |
800 | 800 |
801 /* Do this loop at least once, to get the next window, and perhaps | 801 /* Do this loop at least once, to get the next window, and perhaps |
802 again, if we hit the minibuffer and that is not acceptable. */ | 802 again, if we hit the minibuffer and that is not acceptable. */ |
803 do | 803 do |
804 { | 804 { |
807 while (tem = XWINDOW (window)->next, NILP (tem)) | 807 while (tem = XWINDOW (window)->next, NILP (tem)) |
808 if (tem = XWINDOW (window)->parent, !NILP (tem)) | 808 if (tem = XWINDOW (window)->parent, !NILP (tem)) |
809 window = tem; | 809 window = tem; |
810 else | 810 else |
811 { | 811 { |
812 /* We've reached the end of this screen. | 812 /* We've reached the end of this frame. |
813 Which other screens are acceptable? */ | 813 Which other frames are acceptable? */ |
814 tem = WINDOW_SCREEN (XWINDOW (window)); | 814 tem = WINDOW_FRAME (XWINDOW (window)); |
815 #ifdef MULTI_SCREEN | 815 #ifdef MULTI_FRAME |
816 if (! NILP (all_screens)) | 816 if (! NILP (all_frames)) |
817 tem = next_screen (tem, all_screens); | 817 tem = next_frame (tem, all_frames); |
818 #endif | 818 #endif |
819 tem = SCREEN_ROOT_WINDOW (XSCREEN (tem)); | 819 tem = FRAME_ROOT_WINDOW (XFRAME (tem)); |
820 | 820 |
821 break; | 821 break; |
822 } | 822 } |
823 | 823 |
824 window = tem; | 824 window = tem; |
853 Optional second arg MINIBUF t means count the minibuffer window even\n\ | 853 Optional second arg MINIBUF t means count the minibuffer window even\n\ |
854 if not active. MINIBUF nil or omitted means count the minibuffer iff\n\ | 854 if not active. MINIBUF nil or omitted means count the minibuffer iff\n\ |
855 it is active. MINIBUF neither t nor nil means not to count the\n\ | 855 it is active. MINIBUF neither t nor nil means not to count the\n\ |
856 minibuffer even if it is active.\n\ | 856 minibuffer even if it is active.\n\ |
857 \n\ | 857 \n\ |
858 Several screens may share a single minibuffer; if the minibuffer\n\ | 858 Several frames may share a single minibuffer; if the minibuffer\n\ |
859 counts, all windows on all screens that share that minibuffer count\n\ | 859 counts, all windows on all frames that share that minibuffer count\n\ |
860 too. This means that previous-window may be used to iterate through\n\ | 860 too. This means that previous-window may be used to iterate through\n\ |
861 the set of windows even when the minibuffer is on another screen. If\n\ | 861 the set of windows even when the minibuffer is on another frame. If\n\ |
862 the minibuffer does not count, only windows from WINDOW's screen\n\ | 862 the minibuffer does not count, only windows from WINDOW's frame\n\ |
863 count.\n\ | 863 count.\n\ |
864 \n\ | 864 \n\ |
865 Optional third arg ALL-SCREENS t means include windows on all screens.\n\ | 865 Optional third arg ALL-FRAMES t means include windows on all frames.\n\ |
866 ALL-SCREENS nil or omitted means cycle within the screens as specified\n\ | 866 ALL-FRAMES nil or omitted means cycle within the frames as specified\n\ |
867 above. If neither nil nor t, restrict to WINDOW's screen.") | 867 above. If neither nil nor t, restrict to WINDOW's frame.") |
868 (window, minibuf, all_screens) | 868 (window, minibuf, all_frames) |
869 register Lisp_Object window, minibuf, all_screens; | 869 register Lisp_Object window, minibuf, all_frames; |
870 { | 870 { |
871 register Lisp_Object tem; | 871 register Lisp_Object tem; |
872 Lisp_Object start_window; | 872 Lisp_Object start_window; |
873 | 873 |
874 if (NILP (window)) | 874 if (NILP (window)) |
881 /* minibuf == nil may or may not include minibuffers. | 881 /* minibuf == nil may or may not include minibuffers. |
882 Decide if it does. */ | 882 Decide if it does. */ |
883 if (NILP (minibuf)) | 883 if (NILP (minibuf)) |
884 minibuf = (minibuf_level ? Qt : Qlambda); | 884 minibuf = (minibuf_level ? Qt : Qlambda); |
885 | 885 |
886 /* all_screens == nil doesn't specify which screens to include. | 886 /* all_frames == nil doesn't specify which frames to include. |
887 Decide which screens it includes. */ | 887 Decide which frames it includes. */ |
888 if (NILP (all_screens)) | 888 if (NILP (all_frames)) |
889 all_screens = (EQ (minibuf, Qt) | 889 all_frames = (EQ (minibuf, Qt) |
890 ? (SCREEN_MINIBUF_WINDOW | 890 ? (FRAME_MINIBUF_WINDOW |
891 (XSCREEN | 891 (XFRAME |
892 (WINDOW_SCREEN | 892 (WINDOW_FRAME |
893 (XWINDOW (window))))) | 893 (XWINDOW (window))))) |
894 : Qnil); | 894 : Qnil); |
895 else if (! EQ (all_screens, Qt)) | 895 else if (! EQ (all_frames, Qt)) |
896 all_screens = Qnil; | 896 all_frames = Qnil; |
897 | 897 |
898 /* Do this loop at least once, to get the previous window, and perhaps | 898 /* Do this loop at least once, to get the previous window, and perhaps |
899 again, if we hit the minibuffer and that is not acceptable. */ | 899 again, if we hit the minibuffer and that is not acceptable. */ |
900 do | 900 do |
901 { | 901 { |
904 while (tem = XWINDOW (window)->prev, NILP (tem)) | 904 while (tem = XWINDOW (window)->prev, NILP (tem)) |
905 if (tem = XWINDOW (window)->parent, !NILP (tem)) | 905 if (tem = XWINDOW (window)->parent, !NILP (tem)) |
906 window = tem; | 906 window = tem; |
907 else | 907 else |
908 { | 908 { |
909 /* We have found the top window on the screen. | 909 /* We have found the top window on the frame. |
910 Which screens are acceptable? */ | 910 Which frames are acceptable? */ |
911 tem = WINDOW_SCREEN (XWINDOW (window)); | 911 tem = WINDOW_FRAME (XWINDOW (window)); |
912 #ifdef MULTI_SCREEN | 912 #ifdef MULTI_FRAME |
913 if (! NILP (all_screens)) | 913 if (! NILP (all_frames)) |
914 tem = next_screen (tem, all_screens); | 914 tem = next_frame (tem, all_frames); |
915 #endif | 915 #endif |
916 tem = SCREEN_ROOT_WINDOW (XSCREEN (tem)); | 916 tem = FRAME_ROOT_WINDOW (XFRAME (tem)); |
917 | 917 |
918 break; | 918 break; |
919 } | 919 } |
920 | 920 |
921 window = tem; | 921 window = tem; |
943 | 943 |
944 return window; | 944 return window; |
945 } | 945 } |
946 | 946 |
947 DEFUN ("other-window", Fother_window, Sother_window, 1, 2, "p", | 947 DEFUN ("other-window", Fother_window, Sother_window, 1, 2, "p", |
948 "Select the ARG'th different window on this screen.\n\ | 948 "Select the ARG'th different window on this frame.\n\ |
949 All windows on current screen are arranged in a cyclic order.\n\ | 949 All windows on current frame are arranged in a cyclic order.\n\ |
950 This command selects the window ARG steps away in that order.\n\ | 950 This command selects the window ARG steps away in that order.\n\ |
951 A negative ARG moves in the opposite order. If the optional second\n\ | 951 A negative ARG moves in the opposite order. If the optional second\n\ |
952 argument ALL_SCREENS is non-nil, cycle through all screens.") | 952 argument ALL_FRAMES is non-nil, cycle through all frames.") |
953 (n, all_screens) | 953 (n, all_frames) |
954 register Lisp_Object n, all_screens; | 954 register Lisp_Object n, all_frames; |
955 { | 955 { |
956 register int i; | 956 register int i; |
957 register Lisp_Object w; | 957 register Lisp_Object w; |
958 | 958 |
959 CHECK_NUMBER (n, 0); | 959 CHECK_NUMBER (n, 0); |
960 w = selected_window; | 960 w = selected_window; |
961 i = XINT (n); | 961 i = XINT (n); |
962 | 962 |
963 while (i > 0) | 963 while (i > 0) |
964 { | 964 { |
965 w = Fnext_window (w, Qnil, all_screens); | 965 w = Fnext_window (w, Qnil, all_frames); |
966 i--; | 966 i--; |
967 } | 967 } |
968 while (i < 0) | 968 while (i < 0) |
969 { | 969 { |
970 w = Fprevious_window (w, Qnil, all_screens); | 970 w = Fprevious_window (w, Qnil, all_frames); |
971 i++; | 971 i++; |
972 } | 972 } |
973 Fselect_window (w); | 973 Fselect_window (w); |
974 return Qnil; | 974 return Qnil; |
975 } | 975 } |
976 | 976 |
977 /* Look at all windows, performing an operation specified by TYPE | 977 /* Look at all windows, performing an operation specified by TYPE |
978 with argument OBJ. | 978 with argument OBJ. |
979 If SCREENS is Qt, look at all screens, if Qnil, look at just the selected | 979 If FRAMES is Qt, look at all frames, if Qnil, look at just the selected |
980 screen. If SCREENS is a screen, just look at windows on that screen. | 980 frame. If FRAMES is a frame, just look at windows on that frame. |
981 If MINI is non-zero, perform the operation on minibuffer windows too. | 981 If MINI is non-zero, perform the operation on minibuffer windows too. |
982 */ | 982 */ |
983 | 983 |
984 enum window_loop | 984 enum window_loop |
985 { | 985 { |
991 GET_LARGEST_WINDOW, | 991 GET_LARGEST_WINDOW, |
992 UNSHOW_BUFFER, /* Arg is buffer */ | 992 UNSHOW_BUFFER, /* Arg is buffer */ |
993 }; | 993 }; |
994 | 994 |
995 static Lisp_Object | 995 static Lisp_Object |
996 window_loop (type, obj, mini, screens) | 996 window_loop (type, obj, mini, frames) |
997 enum window_loop type; | 997 enum window_loop type; |
998 register Lisp_Object obj, screens; | 998 register Lisp_Object obj, frames; |
999 int mini; | 999 int mini; |
1000 { | 1000 { |
1001 register Lisp_Object w; | 1001 register Lisp_Object w; |
1002 register Lisp_Object best_window; | 1002 register Lisp_Object best_window; |
1003 register Lisp_Object next_window; | 1003 register Lisp_Object next_window; |
1004 register Lisp_Object first_window; | 1004 register Lisp_Object first_window; |
1005 SCREEN_PTR screen; | 1005 FRAME_PTR frame; |
1006 | 1006 |
1007 /* If we're only looping through windows on a particular screen, | 1007 /* If we're only looping through windows on a particular frame, |
1008 screen points to that screen. If we're looping through windows | 1008 frame points to that frame. If we're looping through windows |
1009 on all screens, screen is 0. */ | 1009 on all frames, frame is 0. */ |
1010 if (SCREENP (screens)) | 1010 if (FRAMEP (frames)) |
1011 screen = XSCREEN (screens); | 1011 frame = XFRAME (frames); |
1012 else if (NILP (screens)) | 1012 else if (NILP (frames)) |
1013 screen = selected_screen; | 1013 frame = selected_frame; |
1014 else | 1014 else |
1015 screen = 0; | 1015 frame = 0; |
1016 | 1016 |
1017 /* Pick a window to start with. */ | 1017 /* Pick a window to start with. */ |
1018 if (XTYPE (obj) == Lisp_Window) | 1018 if (XTYPE (obj) == Lisp_Window) |
1019 first_window = obj; | 1019 first_window = obj; |
1020 else if (screen) | 1020 else if (frame) |
1021 first_window = SCREEN_SELECTED_WINDOW (screen); | 1021 first_window = FRAME_SELECTED_WINDOW (frame); |
1022 else | 1022 else |
1023 first_window = SCREEN_SELECTED_WINDOW (selected_screen); | 1023 first_window = FRAME_SELECTED_WINDOW (selected_frame); |
1024 | 1024 |
1025 w = first_window; | 1025 w = first_window; |
1026 best_window = Qnil; | 1026 best_window = Qnil; |
1027 do | 1027 do |
1028 { | 1028 { |
1029 /* Pick the next window now, since some operations will delete | 1029 /* Pick the next window now, since some operations will delete |
1030 the current window. */ | 1030 the current window. */ |
1031 #ifdef MULTI_SCREEN | 1031 #ifdef MULTI_FRAME |
1032 if (screen) | 1032 if (frame) |
1033 next_window = Fnext_window (w, (mini ? Qt : Qnil), Qlambda); | 1033 next_window = Fnext_window (w, (mini ? Qt : Qnil), Qlambda); |
1034 else | 1034 else |
1035 #endif /* MULTI_SCREEN */ | 1035 #endif /* MULTI_FRAME */ |
1036 /* We know screen is 0, so we're looping through all screens. | 1036 /* We know frame is 0, so we're looping through all frames. |
1037 Or we know this isn't a MULTI_SCREEN Emacs, so who cares? */ | 1037 Or we know this isn't a MULTI_FRAME Emacs, so who cares? */ |
1038 next_window = Fnext_window (w, mini ? Qt : Qnil, Qt); | 1038 next_window = Fnext_window (w, mini ? Qt : Qnil, Qt); |
1039 | 1039 |
1040 if (!MINI_WINDOW_P (XWINDOW (w)) | 1040 if (!MINI_WINDOW_P (XWINDOW (w)) |
1041 || (mini && minibuf_level > 0)) | 1041 || (mini && minibuf_level > 0)) |
1042 switch (type) | 1042 switch (type) |
1043 { | 1043 { |
1044 case GET_BUFFER_WINDOW: | 1044 case GET_BUFFER_WINDOW: |
1045 #if 0 | 1045 #if 0 |
1046 /* Ignore invisible and iconified screens. */ | 1046 /* Ignore invisible and iconified frames. */ |
1047 if (! SCREEN_VISIBLE_P (XSCREEN (WINDOW_SCREEN (XWINDOW (w)))) | 1047 if (! FRAME_VISIBLE_P (XFRAME (WINDOW_FRAME (XWINDOW (w)))) |
1048 || SCREEN_ICONIFIED_P (XSCREEN (WINDOW_SCREEN (XWINDOW (w))))) | 1048 || FRAME_ICONIFIED_P (XFRAME (WINDOW_FRAME (XWINDOW (w))))) |
1049 break; | 1049 break; |
1050 #endif | 1050 #endif |
1051 if (XBUFFER (XWINDOW (w)->buffer) == XBUFFER (obj)) | 1051 if (XBUFFER (XWINDOW (w)->buffer) == XBUFFER (obj)) |
1052 return w; | 1052 return w; |
1053 break; | 1053 break; |
1054 | 1054 |
1055 case GET_LRU_WINDOW: | 1055 case GET_LRU_WINDOW: |
1056 /* t as arg means consider only full-width windows */ | 1056 /* t as arg means consider only full-width windows */ |
1057 if (!NILP (obj) && XFASTINT (XWINDOW (w)->width) | 1057 if (!NILP (obj) && XFASTINT (XWINDOW (w)->width) |
1058 != SCREEN_WIDTH (screen)) | 1058 != FRAME_WIDTH (frame)) |
1059 break; | 1059 break; |
1060 #if 0 | 1060 #if 0 |
1061 /* Ignore invisible and iconified screens. */ | 1061 /* Ignore invisible and iconified frames. */ |
1062 if (! SCREEN_VISIBLE_P (XSCREEN (WINDOW_SCREEN (XWINDOW (w)))) | 1062 if (! FRAME_VISIBLE_P (XFRAME (WINDOW_FRAME (XWINDOW (w)))) |
1063 || SCREEN_ICONIFIED_P (XSCREEN (WINDOW_SCREEN (XWINDOW (w))))) | 1063 || FRAME_ICONIFIED_P (XFRAME (WINDOW_FRAME (XWINDOW (w))))) |
1064 break; | 1064 break; |
1065 #endif | 1065 #endif |
1066 /* Ignore dedicated windows and minibuffers. */ | 1066 /* Ignore dedicated windows and minibuffers. */ |
1067 if (MINI_WINDOW_P (XWINDOW (w)) | 1067 if (MINI_WINDOW_P (XWINDOW (w)) |
1068 || !NILP (XWINDOW (w)->dedicated)) | 1068 || !NILP (XWINDOW (w)->dedicated)) |
1080 | 1080 |
1081 case DELETE_BUFFER_WINDOWS: | 1081 case DELETE_BUFFER_WINDOWS: |
1082 if (EQ (XWINDOW (w)->buffer, obj)) | 1082 if (EQ (XWINDOW (w)->buffer, obj)) |
1083 { | 1083 { |
1084 /* If we're deleting the buffer displayed in the only window | 1084 /* If we're deleting the buffer displayed in the only window |
1085 on the screen, find a new buffer to display there. */ | 1085 on the frame, find a new buffer to display there. */ |
1086 if (NILP (XWINDOW (w)->parent)) | 1086 if (NILP (XWINDOW (w)->parent)) |
1087 { | 1087 { |
1088 Lisp_Object new_buffer = Fother_buffer (obj); | 1088 Lisp_Object new_buffer = Fother_buffer (obj); |
1089 if (NILP (new_buffer)) | 1089 if (NILP (new_buffer)) |
1090 new_buffer | 1090 new_buffer |
1097 } | 1097 } |
1098 break; | 1098 break; |
1099 | 1099 |
1100 case GET_LARGEST_WINDOW: | 1100 case GET_LARGEST_WINDOW: |
1101 #if 0 | 1101 #if 0 |
1102 /* Ignore invisible and iconified screens. */ | 1102 /* Ignore invisible and iconified frames. */ |
1103 if (! SCREEN_VISIBLE_P (XSCREEN (WINDOW_SCREEN (XWINDOW (w)))) | 1103 if (! FRAME_VISIBLE_P (XFRAME (WINDOW_FRAME (XWINDOW (w)))) |
1104 || SCREEN_ICONIFIED_P (XSCREEN (WINDOW_SCREEN (XWINDOW (w))))) | 1104 || FRAME_ICONIFIED_P (XFRAME (WINDOW_FRAME (XWINDOW (w))))) |
1105 break; | 1105 break; |
1106 #endif | 1106 #endif |
1107 /* Ignore dedicated windows and minibuffers. */ | 1107 /* Ignore dedicated windows and minibuffers. */ |
1108 if (MINI_WINDOW_P (XWINDOW (w)) | 1108 if (MINI_WINDOW_P (XWINDOW (w)) |
1109 || !NILP (XWINDOW (w)->dedicated)) | 1109 || !NILP (XWINDOW (w)->dedicated)) |
1140 return best_window; | 1140 return best_window; |
1141 } | 1141 } |
1142 | 1142 |
1143 DEFUN ("get-lru-window", Fget_lru_window, Sget_lru_window, 0, 1, 0, | 1143 DEFUN ("get-lru-window", Fget_lru_window, Sget_lru_window, 0, 1, 0, |
1144 "Return the window least recently selected or used for display.\n\ | 1144 "Return the window least recently selected or used for display.\n\ |
1145 If optional argument SCREENS is t, search all screens. If SCREEN is a\n\ | 1145 If optional argument FRAMES is t, search all frames. If FRAME is a\n\ |
1146 screen, search only that screen.\n") | 1146 frame, search only that frame.\n") |
1147 (screens) | 1147 (frames) |
1148 Lisp_Object screens; | 1148 Lisp_Object frames; |
1149 { | 1149 { |
1150 register Lisp_Object w; | 1150 register Lisp_Object w; |
1151 /* First try for a window that is full-width */ | 1151 /* First try for a window that is full-width */ |
1152 w = window_loop (GET_LRU_WINDOW, Qt, 0, screens); | 1152 w = window_loop (GET_LRU_WINDOW, Qt, 0, frames); |
1153 if (!NILP (w) && !EQ (w, selected_window)) | 1153 if (!NILP (w) && !EQ (w, selected_window)) |
1154 return w; | 1154 return w; |
1155 /* If none of them, try the rest */ | 1155 /* If none of them, try the rest */ |
1156 return window_loop (GET_LRU_WINDOW, Qnil, 0, screens); | 1156 return window_loop (GET_LRU_WINDOW, Qnil, 0, frames); |
1157 } | 1157 } |
1158 | 1158 |
1159 DEFUN ("get-largest-window", Fget_largest_window, Sget_largest_window, 0, 1, 0, | 1159 DEFUN ("get-largest-window", Fget_largest_window, Sget_largest_window, 0, 1, 0, |
1160 "Return the largest window in area.\n\ | 1160 "Return the largest window in area.\n\ |
1161 If optional argument SCREENS is t, search all screens. If SCREEN is a\n\ | 1161 If optional argument FRAMES is t, search all frames. If FRAME is a\n\ |
1162 screen, search only that screen.\n") | 1162 frame, search only that frame.\n") |
1163 (screen) | 1163 (frame) |
1164 Lisp_Object screen; | 1164 Lisp_Object frame; |
1165 { | 1165 { |
1166 return window_loop (GET_LARGEST_WINDOW, Qnil, 0, | 1166 return window_loop (GET_LARGEST_WINDOW, Qnil, 0, |
1167 screen); | 1167 frame); |
1168 } | 1168 } |
1169 | 1169 |
1170 DEFUN ("get-buffer-window", Fget_buffer_window, Sget_buffer_window, 1, 2, 0, | 1170 DEFUN ("get-buffer-window", Fget_buffer_window, Sget_buffer_window, 1, 2, 0, |
1171 "Return a window currently displaying BUFFER, or nil if none.\n\ | 1171 "Return a window currently displaying BUFFER, or nil if none.\n\ |
1172 If optional argument SCREENS is t, search all screens. If SCREEN is a\n\ | 1172 If optional argument FRAMES is t, search all frames. If FRAME is a\n\ |
1173 screen, search only that screen.\n") | 1173 frame, search only that frame.\n") |
1174 (buffer, screen) | 1174 (buffer, frame) |
1175 Lisp_Object buffer, screen; | 1175 Lisp_Object buffer, frame; |
1176 { | 1176 { |
1177 buffer = Fget_buffer (buffer); | 1177 buffer = Fget_buffer (buffer); |
1178 if (XTYPE (buffer) == Lisp_Buffer) | 1178 if (XTYPE (buffer) == Lisp_Buffer) |
1179 return window_loop (GET_BUFFER_WINDOW, buffer, 1, screen); | 1179 return window_loop (GET_BUFFER_WINDOW, buffer, 1, frame); |
1180 else | 1180 else |
1181 return Qnil; | 1181 return Qnil; |
1182 } | 1182 } |
1183 | 1183 |
1184 DEFUN ("delete-other-windows", Fdelete_other_windows, Sdelete_other_windows, | 1184 DEFUN ("delete-other-windows", Fdelete_other_windows, Sdelete_other_windows, |
1185 0, 1, "", | 1185 0, 1, "", |
1186 "Make WINDOW (or the selected window) fill its screen.\n\ | 1186 "Make WINDOW (or the selected window) fill its frame.\n\ |
1187 Only the screen WINDOW is on is affected.") | 1187 Only the frame WINDOW is on is affected.") |
1188 (window) | 1188 (window) |
1189 Lisp_Object window; | 1189 Lisp_Object window; |
1190 { | 1190 { |
1191 struct window *w; | 1191 struct window *w; |
1192 int opoint = point; | 1192 int opoint = point; |
1199 CHECK_WINDOW (window, 0); | 1199 CHECK_WINDOW (window, 0); |
1200 | 1200 |
1201 w = XWINDOW (window); | 1201 w = XWINDOW (window); |
1202 top = XFASTINT (w->top); | 1202 top = XFASTINT (w->top); |
1203 | 1203 |
1204 window_loop (DELETE_OTHER_WINDOWS, window, 0, WINDOW_SCREEN(w)); | 1204 window_loop (DELETE_OTHER_WINDOWS, window, 0, WINDOW_FRAME(w)); |
1205 | 1205 |
1206 Fset_buffer (w->buffer); | 1206 Fset_buffer (w->buffer); |
1207 SET_PT (marker_position (w->start)); | 1207 SET_PT (marker_position (w->start)); |
1208 Frecenter (make_number (top)); | 1208 Frecenter (make_number (top)); |
1209 | 1209 |
1437 | 1437 |
1438 Fset_marker (ow->pointm, make_number (BUF_PT (XBUFFER (ow->buffer))), | 1438 Fset_marker (ow->pointm, make_number (BUF_PT (XBUFFER (ow->buffer))), |
1439 ow->buffer); | 1439 ow->buffer); |
1440 | 1440 |
1441 selected_window = window; | 1441 selected_window = window; |
1442 #ifdef MULTI_SCREEN | 1442 #ifdef MULTI_FRAME |
1443 if (XSCREEN (WINDOW_SCREEN (w)) != selected_screen) | 1443 if (XFRAME (WINDOW_FRAME (w)) != selected_frame) |
1444 { | 1444 { |
1445 XSCREEN (WINDOW_SCREEN (w))->selected_window = window; | 1445 XFRAME (WINDOW_FRAME (w))->selected_window = window; |
1446 Fselect_screen (WINDOW_SCREEN (w), Qnil); | 1446 Fselect_frame (WINDOW_FRAME (w), Qnil); |
1447 } | 1447 } |
1448 else | 1448 else |
1449 selected_screen->selected_window = window; | 1449 selected_frame->selected_window = window; |
1450 #endif | 1450 #endif |
1451 | 1451 |
1452 record_buffer (w->buffer); | 1452 record_buffer (w->buffer); |
1453 Fset_buffer (w->buffer); | 1453 Fset_buffer (w->buffer); |
1454 | 1454 |
1497 window = Fget_buffer_window (buffer, Qnil); | 1497 window = Fget_buffer_window (buffer, Qnil); |
1498 if (!NILP (window) | 1498 if (!NILP (window) |
1499 && (NILP (not_this_window) || !EQ (window, selected_window))) | 1499 && (NILP (not_this_window) || !EQ (window, selected_window))) |
1500 return window; | 1500 return window; |
1501 | 1501 |
1502 #ifdef MULTI_SCREEN | 1502 #ifdef MULTI_FRAME |
1503 /* If there are no screens open that have more than a minibuffer, | 1503 /* If there are no frames open that have more than a minibuffer, |
1504 we need to create a new screen. */ | 1504 we need to create a new frame. */ |
1505 if (pop_up_screens || last_nonminibuf_screen == 0) | 1505 if (pop_up_frames || last_nonminibuf_frame == 0) |
1506 { | 1506 { |
1507 window | 1507 window |
1508 = Fscreen_selected_window (call0 (Vpop_up_screen_function)); | 1508 = Fframe_selected_window (call0 (Vpop_up_frame_function)); |
1509 Fset_window_buffer (window, buffer); | 1509 Fset_window_buffer (window, buffer); |
1510 #if 0 | 1510 #if 0 |
1511 Fselect_screen (XWINDOW (window)->screen, Qnil); | 1511 Fselect_frame (XWINDOW (window)->frame, Qnil); |
1512 #endif | 1512 #endif |
1513 return window; | 1513 return window; |
1514 } | 1514 } |
1515 #endif /* MULTI_SCREEN */ | 1515 #endif /* MULTI_FRAME */ |
1516 | 1516 |
1517 if (pop_up_windows | 1517 if (pop_up_windows |
1518 #ifdef MULTI_SCREEN | 1518 #ifdef MULTI_FRAME |
1519 || SCREEN_MINIBUF_ONLY_P (selected_screen) | 1519 || FRAME_MINIBUF_ONLY_P (selected_frame) |
1520 #endif | 1520 #endif |
1521 ) | 1521 ) |
1522 { | 1522 { |
1523 Lisp_Object screens = Qnil; | 1523 Lisp_Object frames = Qnil; |
1524 | 1524 |
1525 #ifdef MULTI_SCREEN | 1525 #ifdef MULTI_FRAME |
1526 if (SCREEN_MINIBUF_ONLY_P (selected_screen)) | 1526 if (FRAME_MINIBUF_ONLY_P (selected_frame)) |
1527 XSET (screens, Lisp_Screen, last_nonminibuf_screen); | 1527 XSET (frames, Lisp_Frame, last_nonminibuf_frame); |
1528 #endif | 1528 #endif |
1529 /* Don't try to create a window if would get an error */ | 1529 /* Don't try to create a window if would get an error */ |
1530 if (split_height_threshold < window_min_height << 1) | 1530 if (split_height_threshold < window_min_height << 1) |
1531 split_height_threshold = window_min_height << 1; | 1531 split_height_threshold = window_min_height << 1; |
1532 | 1532 |
1533 window = Fget_largest_window (screens); | 1533 window = Fget_largest_window (frames); |
1534 | 1534 |
1535 if (!NILP (window) | 1535 if (!NILP (window) |
1536 && window_height (window) >= split_height_threshold | 1536 && window_height (window) >= split_height_threshold |
1537 && | 1537 && |
1538 (XFASTINT (XWINDOW (window)->width) | 1538 (XFASTINT (XWINDOW (window)->width) |
1539 == SCREEN_WIDTH (XSCREEN (WINDOW_SCREEN (XWINDOW (window)))))) | 1539 == FRAME_WIDTH (XFRAME (WINDOW_FRAME (XWINDOW (window)))))) |
1540 window = Fsplit_window (window, Qnil, Qnil); | 1540 window = Fsplit_window (window, Qnil, Qnil); |
1541 else | 1541 else |
1542 { | 1542 { |
1543 window = Fget_lru_window (screens); | 1543 window = Fget_lru_window (frames); |
1544 if ((EQ (window, selected_window) | 1544 if ((EQ (window, selected_window) |
1545 || EQ (XWINDOW (window)->parent, Qnil)) | 1545 || EQ (XWINDOW (window)->parent, Qnil)) |
1546 && window_height (window) >= window_min_height << 1) | 1546 && window_height (window) >= window_min_height << 1) |
1547 window = Fsplit_window (window, Qnil, Qnil); | 1547 window = Fsplit_window (window, Qnil, Qnil); |
1548 } | 1548 } |
1574 call1 (Vtemp_buffer_show_function, buf); | 1574 call1 (Vtemp_buffer_show_function, buf); |
1575 else | 1575 else |
1576 { | 1576 { |
1577 window = Fdisplay_buffer (buf, Qnil); | 1577 window = Fdisplay_buffer (buf, Qnil); |
1578 | 1578 |
1579 #ifdef MULTI_SCREEN | 1579 #ifdef MULTI_FRAME |
1580 if (XSCREEN (XWINDOW (window)->screen) != selected_screen) | 1580 if (XFRAME (XWINDOW (window)->frame) != selected_frame) |
1581 Fmake_screen_visible (XWINDOW (window)->screen); | 1581 Fmake_frame_visible (WINDOW_FRAME (XWINDOW (window))); |
1582 #endif /* MULTI_SCREEN */ | 1582 #endif /* MULTI_FRAME */ |
1583 Vminibuf_scroll_window = window; | 1583 Vminibuf_scroll_window = window; |
1584 w = XWINDOW (window); | 1584 w = XWINDOW (window); |
1585 XFASTINT (w->hscroll) = 0; | 1585 XFASTINT (w->hscroll) = 0; |
1586 set_marker_restricted (w->start, make_number (1), buf); | 1586 set_marker_restricted (w->start, make_number (1), buf); |
1587 set_marker_restricted (w->pointm, make_number (1), buf); | 1587 set_marker_restricted (w->pointm, make_number (1), buf); |
1652 size = XINT (chsize); | 1652 size = XINT (chsize); |
1653 } | 1653 } |
1654 | 1654 |
1655 if (MINI_WINDOW_P (o)) | 1655 if (MINI_WINDOW_P (o)) |
1656 error ("Attempt to split minibuffer window"); | 1656 error ("Attempt to split minibuffer window"); |
1657 else if (SCREEN_NO_SPLIT_P (XSCREEN (WINDOW_SCREEN (o)))) | 1657 else if (FRAME_NO_SPLIT_P (XFRAME (WINDOW_FRAME (o)))) |
1658 error ("Attempt to split unsplittable screen"); | 1658 error ("Attempt to split unsplittable frame"); |
1659 | 1659 |
1660 /* Smaller values might permit a crash. */ | 1660 /* Smaller values might permit a crash. */ |
1661 if (window_min_width < 2) | 1661 if (window_min_width < 2) |
1662 window_min_width = 2; | 1662 window_min_width = 2; |
1663 if (window_min_height < 2) | 1663 if (window_min_height < 2) |
1696 | 1696 |
1697 windows_or_buffers_changed++; | 1697 windows_or_buffers_changed++; |
1698 new = make_window (); | 1698 new = make_window (); |
1699 p = XWINDOW (new); | 1699 p = XWINDOW (new); |
1700 | 1700 |
1701 p->screen = o->screen; | 1701 p->frame = o->frame; |
1702 p->next = o->next; | 1702 p->next = o->next; |
1703 if (!NILP (p->next)) | 1703 if (!NILP (p->next)) |
1704 XWINDOW (p->next)->prev = new; | 1704 XWINDOW (p->next)->prev = new; |
1705 p->prev = window; | 1705 p->prev = window; |
1706 o->next = new; | 1706 o->next = new; |
1707 p->parent = o->parent; | 1707 p->parent = o->parent; |
1708 p->buffer = Qt; | 1708 p->buffer = Qt; |
1709 | 1709 |
1710 Fset_window_buffer (new, o->buffer); | 1710 Fset_window_buffer (new, o->buffer); |
1711 | 1711 |
1712 /* Apportion the available screen space among the two new windows */ | 1712 /* Apportion the available frame space among the two new windows */ |
1713 | 1713 |
1714 if (!NILP (horflag)) | 1714 if (!NILP (horflag)) |
1715 { | 1715 { |
1716 p->height = o->height; | 1716 p->height = o->height; |
1717 p->top = o->top; | 1717 p->top = o->top; |
1831 register int maxdelta; | 1831 register int maxdelta; |
1832 | 1832 |
1833 maxdelta = (!NILP (parent) ? (*sizefun) (parent) - *sizep | 1833 maxdelta = (!NILP (parent) ? (*sizefun) (parent) - *sizep |
1834 : !NILP (p->next) ? (*sizefun) (p->next) - MINSIZE (p->next) | 1834 : !NILP (p->next) ? (*sizefun) (p->next) - MINSIZE (p->next) |
1835 : !NILP (p->prev) ? (*sizefun) (p->prev) - MINSIZE (p->prev) | 1835 : !NILP (p->prev) ? (*sizefun) (p->prev) - MINSIZE (p->prev) |
1836 /* This is a screen with only one window, a minibuffer-only | 1836 /* This is a frame with only one window, a minibuffer-only |
1837 or a minibufferless screen. */ | 1837 or a minibufferless frame. */ |
1838 : (delta = 0)); | 1838 : (delta = 0)); |
1839 | 1839 |
1840 if (delta > maxdelta) | 1840 if (delta > maxdelta) |
1841 /* This case traps trying to make the minibuffer | 1841 /* This case traps trying to make the minibuffer |
1842 the full screen, or make the only window aside from the | 1842 the full frame, or make the only window aside from the |
1843 minibuffer the full screen. */ | 1843 minibuffer the full frame. */ |
1844 delta = maxdelta; | 1844 delta = maxdelta; |
1845 | 1845 |
1846 if (delta == 0) | 1846 if (delta == 0) |
1847 return; | 1847 return; |
1848 } | 1848 } |
1912 if (MINI_WINDOW_P (w)) | 1912 if (MINI_WINDOW_P (w)) |
1913 return ht; | 1913 return ht; |
1914 | 1914 |
1915 if (!NILP (w->parent) || !NILP (w->vchild) || !NILP (w->hchild) | 1915 if (!NILP (w->parent) || !NILP (w->vchild) || !NILP (w->hchild) |
1916 || !NILP (w->next) || !NILP (w->prev) | 1916 || !NILP (w->next) || !NILP (w->prev) |
1917 || SCREEN_WANTS_MODELINE_P (XSCREEN (WINDOW_SCREEN (w)))) | 1917 || FRAME_WANTS_MODELINE_P (XFRAME (WINDOW_FRAME (w)))) |
1918 return ht - 1; | 1918 return ht - 1; |
1919 | 1919 |
1920 return ht; | 1920 return ht; |
1921 } | 1921 } |
1922 | 1922 |
2143 make_number (XINT (XWINDOW (selected_window)->hscroll) | 2143 make_number (XINT (XWINDOW (selected_window)->hscroll) |
2144 - XINT (arg))); | 2144 - XINT (arg))); |
2145 } | 2145 } |
2146 | 2146 |
2147 DEFUN ("recenter", Frecenter, Srecenter, 0, 1, "P", | 2147 DEFUN ("recenter", Frecenter, Srecenter, 0, 1, "P", |
2148 "Center point in window and redisplay screen. With ARG, put point on line ARG.\n\ | 2148 "Center point in window and redisplay frame. With ARG, put point on line ARG.\n\ |
2149 The desired position of point is always relative to the current window.\n\ | 2149 The desired position of point is always relative to the current window.\n\ |
2150 Just C-u as prefix means put point in the center of the screen.\n\ | 2150 Just C-u as prefix means put point in the center of the window.\n\ |
2151 No arg (i.e., it is nil) erases the entire screen and then\n\ | 2151 No arg (i.e., it is nil) erases the entire frame and then\n\ |
2152 redraws with point in the center.") | 2152 redraws with point in the center of the current window.") |
2153 (n) | 2153 (n) |
2154 register Lisp_Object n; | 2154 register Lisp_Object n; |
2155 { | 2155 { |
2156 register struct window *w = XWINDOW (selected_window); | 2156 register struct window *w = XWINDOW (selected_window); |
2157 register int ht = window_internal_height (w); | 2157 register int ht = window_internal_height (w); |
2158 register int opoint = point; | 2158 register int opoint = point; |
2159 | 2159 |
2160 if (NILP (n)) | 2160 if (NILP (n)) |
2161 { | 2161 { |
2162 extern int screen_garbaged; | 2162 extern int frame_garbaged; |
2163 | 2163 |
2164 SET_SCREEN_GARBAGED (XSCREEN (WINDOW_SCREEN (w))); | 2164 SET_FRAME_GARBAGED (XFRAME (WINDOW_FRAME (w))); |
2165 XFASTINT (n) = ht / 2; | 2165 XFASTINT (n) = ht / 2; |
2166 } | 2166 } |
2167 else if (XTYPE (n) == Lisp_Cons) /* Just C-u. */ | 2167 else if (XTYPE (n) == Lisp_Cons) /* Just C-u. */ |
2168 { | 2168 { |
2169 XFASTINT (n) = ht / 2; | 2169 XFASTINT (n) = ht / 2; |
2191 | 2191 |
2192 DEFUN ("move-to-window-line", Fmove_to_window_line, Smove_to_window_line, | 2192 DEFUN ("move-to-window-line", Fmove_to_window_line, Smove_to_window_line, |
2193 1, 1, "P", | 2193 1, 1, "P", |
2194 "Position point relative to window.\n\ | 2194 "Position point relative to window.\n\ |
2195 With no argument, position text at center of window.\n\ | 2195 With no argument, position text at center of window.\n\ |
2196 An argument specifies screen line; zero means top of window,\n\ | 2196 An argument specifies frame line; zero means top of window,\n\ |
2197 negative means relative to bottom of window.") | 2197 negative means relative to bottom of window.") |
2198 (arg) | 2198 (arg) |
2199 register Lisp_Object arg; | 2199 register Lisp_Object arg; |
2200 { | 2200 { |
2201 register struct window *w = XWINDOW (selected_window); | 2201 register struct window *w = XWINDOW (selected_window); |
2227 | 2227 |
2228 struct save_window_data | 2228 struct save_window_data |
2229 { | 2229 { |
2230 int size_from_Lisp_Vector_struct; | 2230 int size_from_Lisp_Vector_struct; |
2231 struct Lisp_Vector *next_from_Lisp_Vector_struct; | 2231 struct Lisp_Vector *next_from_Lisp_Vector_struct; |
2232 Lisp_Object screen_width, screen_height; | 2232 Lisp_Object frame_width, frame_height; |
2233 Lisp_Object current_window; | 2233 Lisp_Object current_window; |
2234 Lisp_Object current_buffer; | 2234 Lisp_Object current_buffer; |
2235 Lisp_Object minibuf_scroll_window; | 2235 Lisp_Object minibuf_scroll_window; |
2236 Lisp_Object root_window; | 2236 Lisp_Object root_window; |
2237 /* A vector, interpreted as a struct saved_window */ | 2237 /* A vector, interpreted as a struct saved_window */ |
2283 struct Lisp_Vector *saved_windows; | 2283 struct Lisp_Vector *saved_windows; |
2284 register struct saved_window *p; | 2284 register struct saved_window *p; |
2285 register Lisp_Object tem; | 2285 register Lisp_Object tem; |
2286 Lisp_Object new_current_buffer; | 2286 Lisp_Object new_current_buffer; |
2287 int k; | 2287 int k; |
2288 SCREEN_PTR s; | 2288 FRAME_PTR f; |
2289 | 2289 |
2290 while (XTYPE (arg) != Lisp_Window_Configuration) | 2290 while (XTYPE (arg) != Lisp_Window_Configuration) |
2291 { | 2291 { |
2292 arg = wrong_type_argument (intern ("window-configuration-p"), arg); | 2292 arg = wrong_type_argument (intern ("window-configuration-p"), arg); |
2293 } | 2293 } |
2294 | 2294 |
2295 data = (struct save_window_data *) XVECTOR (arg); | 2295 data = (struct save_window_data *) XVECTOR (arg); |
2296 saved_windows = XVECTOR (data->saved_windows); | 2296 saved_windows = XVECTOR (data->saved_windows); |
2297 | 2297 |
2298 s = XSCREEN (XWINDOW (SAVED_WINDOW_N (saved_windows, 0)->window)->screen); | 2298 f = XFRAME (XWINDOW (SAVED_WINDOW_N (saved_windows, 0)->window)->frame); |
2299 | 2299 |
2300 if (XFASTINT (data->screen_height) != SCREEN_HEIGHT (s) | 2300 if (XFASTINT (data->frame_height) != FRAME_HEIGHT (f) |
2301 || XFASTINT (data->screen_width) != SCREEN_WIDTH (s)) | 2301 || XFASTINT (data->frame_width) != FRAME_WIDTH (f)) |
2302 { | 2302 { |
2303 /* Presumably something clever could be done. | 2303 /* Presumably something clever could be done. |
2304 However, it doesn't seem worth the effort */ | 2304 However, it doesn't seem worth the effort */ |
2305 error ("Screen size %dx%d in saved window configuration mismatches screen.", | 2305 error ("Frame size %dx%d in saved window configuration mismatches frame.", |
2306 XFASTINT (data->screen_height), | 2306 XFASTINT (data->frame_height), |
2307 XFASTINT (data->screen_width)); | 2307 XFASTINT (data->frame_width)); |
2308 } | 2308 } |
2309 | 2309 |
2310 windows_or_buffers_changed++; | 2310 windows_or_buffers_changed++; |
2311 new_current_buffer = data->current_buffer; | 2311 new_current_buffer = data->current_buffer; |
2312 if (NILP (XBUFFER (new_current_buffer)->name)) | 2312 if (NILP (XBUFFER (new_current_buffer)->name)) |
2313 new_current_buffer = Qnil; | 2313 new_current_buffer = Qnil; |
2314 | 2314 |
2315 /* Mark all windows now on screen as "deleted". | 2315 /* Mark all windows now on frame as "deleted". |
2316 Restoring the new configuration "undeletes" any that are in it. */ | 2316 Restoring the new configuration "undeletes" any that are in it. */ |
2317 | 2317 |
2318 delete_all_subwindows (XWINDOW (SCREEN_ROOT_WINDOW (s))); | 2318 delete_all_subwindows (XWINDOW (FRAME_ROOT_WINDOW (f))); |
2319 #if 0 | 2319 #if 0 |
2320 /* This loses when the minibuf screen is not s. */ | 2320 /* This loses when the minibuf frame is not f. */ |
2321 delete_all_subwindows (XWINDOW (XWINDOW (minibuf_window)->prev)); | 2321 delete_all_subwindows (XWINDOW (XWINDOW (minibuf_window)->prev)); |
2322 #endif | 2322 #endif |
2323 | 2323 |
2324 for (k = 0; k < saved_windows->size; k++) | 2324 for (k = 0; k < saved_windows->size; k++) |
2325 { | 2325 { |
2333 w->parent = Qnil; | 2333 w->parent = Qnil; |
2334 | 2334 |
2335 if (!NILP (p->prev)) | 2335 if (!NILP (p->prev)) |
2336 { | 2336 { |
2337 w->prev = SAVED_WINDOW_N (saved_windows, XFASTINT (p->prev))->window; | 2337 w->prev = SAVED_WINDOW_N (saved_windows, XFASTINT (p->prev))->window; |
2338 #ifdef MULTI_SCREEN | 2338 #ifdef MULTI_FRAME |
2339 /* This is true for a minibuffer-only screen. */ | 2339 /* This is true for a minibuffer-only frame. */ |
2340 if (w->mini_p && EQ (w->prev, p->window)) | 2340 if (w->mini_p && EQ (w->prev, p->window)) |
2341 w->next = Qnil; | 2341 w->next = Qnil; |
2342 else | 2342 else |
2343 #endif /* MULTI_SCREEN */ | 2343 #endif /* MULTI_FRAME */ |
2344 XWINDOW (w->prev)->next = p->window; | 2344 XWINDOW (w->prev)->next = p->window; |
2345 } | 2345 } |
2346 else | 2346 else |
2347 { | 2347 { |
2348 w->prev = Qnil; | 2348 w->prev = Qnil; |
2410 w->start_at_line_beg = Qt; | 2410 w->start_at_line_beg = Qt; |
2411 } | 2411 } |
2412 } | 2412 } |
2413 } | 2413 } |
2414 | 2414 |
2415 SCREEN_ROOT_WINDOW (s) = data->root_window; | 2415 FRAME_ROOT_WINDOW (f) = data->root_window; |
2416 | 2416 |
2417 #ifdef MULTI_SCREEN | 2417 #ifdef MULTI_FRAME |
2418 if (s != selected_screen && ! SCREEN_IS_TERMCAP (s)) | 2418 if (f != selected_frame && ! FRAME_IS_TERMCAP (f)) |
2419 Fselect_screen (WINDOW_SCREEN (XWINDOW (data->root_window)), Qnil); | 2419 Fselect_frame (WINDOW_FRAME (XWINDOW (data->root_window)), Qnil); |
2420 #endif | 2420 #endif |
2421 | 2421 |
2422 if (s == selected_screen) | 2422 if (f == selected_frame) |
2423 { | 2423 { |
2424 Fselect_window (data->current_window); | 2424 Fselect_window (data->current_window); |
2425 if (!NILP (new_current_buffer)) | 2425 if (!NILP (new_current_buffer)) |
2426 Fset_buffer (new_current_buffer); | 2426 Fset_buffer (new_current_buffer); |
2427 else | 2427 else |
2430 | 2430 |
2431 Vminibuf_scroll_window = data->minibuf_scroll_window; | 2431 Vminibuf_scroll_window = data->minibuf_scroll_window; |
2432 return (Qnil); | 2432 return (Qnil); |
2433 } | 2433 } |
2434 | 2434 |
2435 /* Mark all windows now on screen as deleted | 2435 /* Mark all windows now on frame as deleted |
2436 by setting their buffers to nil. */ | 2436 by setting their buffers to nil. */ |
2437 | 2437 |
2438 static void | 2438 static void |
2439 delete_all_subwindows (w) | 2439 delete_all_subwindows (w) |
2440 register struct window *w; | 2440 register struct window *w; |
2534 return i; | 2534 return i; |
2535 } | 2535 } |
2536 | 2536 |
2537 DEFUN ("current-window-configuration", | 2537 DEFUN ("current-window-configuration", |
2538 Fcurrent_window_configuration, Scurrent_window_configuration, 0, 1, 0, | 2538 Fcurrent_window_configuration, Scurrent_window_configuration, 0, 1, 0, |
2539 "Return an object representing the current window configuration of SCREEN.\n\ | 2539 "Return an object representing the current window configuration of FRAME.\n\ |
2540 If SCREEN is nil or omitted, use the selected screen.\n\ | 2540 If FRAME is nil or omitted, use the selected frame.\n\ |
2541 This describes the number of windows, their sizes and current buffers,\n\ | 2541 This describes the number of windows, their sizes and current buffers,\n\ |
2542 and for each displayed buffer, where display starts, and the positions of\n\ | 2542 and for each displayed buffer, where display starts, and the positions of\n\ |
2543 point and mark. An exception is made for point in the current buffer:\n\ | 2543 point and mark. An exception is made for point in the current buffer:\n\ |
2544 its value is -not- saved.") | 2544 its value is -not- saved.") |
2545 (screen) | 2545 (frame) |
2546 Lisp_Object screen; | 2546 Lisp_Object frame; |
2547 { | 2547 { |
2548 register Lisp_Object tem; | 2548 register Lisp_Object tem; |
2549 register int n_windows; | 2549 register int n_windows; |
2550 register struct save_window_data *data; | 2550 register struct save_window_data *data; |
2551 register int i; | 2551 register int i; |
2552 SCREEN_PTR s; | 2552 FRAME_PTR f; |
2553 | 2553 |
2554 if (NILP (screen)) | 2554 if (NILP (frame)) |
2555 s = selected_screen; | 2555 f = selected_frame; |
2556 else | 2556 else |
2557 { | 2557 { |
2558 CHECK_LIVE_SCREEN (screen, 0); | 2558 CHECK_LIVE_FRAME (frame, 0); |
2559 s = XSCREEN (screen); | 2559 f = XFRAME (frame); |
2560 } | 2560 } |
2561 | 2561 |
2562 n_windows = count_windows (XWINDOW (SCREEN_ROOT_WINDOW (s))); | 2562 n_windows = count_windows (XWINDOW (FRAME_ROOT_WINDOW (f))); |
2563 data = (struct save_window_data *) | 2563 data = (struct save_window_data *) |
2564 XVECTOR (Fmake_vector (make_number (SAVE_WINDOW_DATA_SIZE), | 2564 XVECTOR (Fmake_vector (make_number (SAVE_WINDOW_DATA_SIZE), |
2565 Qnil)); | 2565 Qnil)); |
2566 XFASTINT (data->screen_width) = SCREEN_WIDTH (s); | 2566 XFASTINT (data->frame_width) = FRAME_WIDTH (f); |
2567 XFASTINT (data->screen_height) = SCREEN_HEIGHT (s); | 2567 XFASTINT (data->frame_height) = FRAME_HEIGHT (f); |
2568 data->current_window = SCREEN_SELECTED_WINDOW (s); | 2568 data->current_window = FRAME_SELECTED_WINDOW (f); |
2569 XSET (data->current_buffer, Lisp_Buffer, current_buffer); | 2569 XSET (data->current_buffer, Lisp_Buffer, current_buffer); |
2570 data->minibuf_scroll_window = Vminibuf_scroll_window; | 2570 data->minibuf_scroll_window = Vminibuf_scroll_window; |
2571 data->root_window = SCREEN_ROOT_WINDOW (s); | 2571 data->root_window = FRAME_ROOT_WINDOW (f); |
2572 tem = Fmake_vector (make_number (n_windows), Qnil); | 2572 tem = Fmake_vector (make_number (n_windows), Qnil); |
2573 data->saved_windows = tem; | 2573 data->saved_windows = tem; |
2574 for (i = 0; i < n_windows; i++) | 2574 for (i = 0; i < n_windows; i++) |
2575 XVECTOR (tem)->contents[i] | 2575 XVECTOR (tem)->contents[i] |
2576 = Fmake_vector (make_number (SAVED_WINDOW_VECTOR_SIZE), Qnil); | 2576 = Fmake_vector (make_number (SAVED_WINDOW_VECTOR_SIZE), Qnil); |
2577 save_window_save (SCREEN_ROOT_WINDOW (s), | 2577 save_window_save (FRAME_ROOT_WINDOW (f), |
2578 XVECTOR (tem), 0); | 2578 XVECTOR (tem), 0); |
2579 XSET (tem, Lisp_Window_Configuration, data); | 2579 XSET (tem, Lisp_Window_Configuration, data); |
2580 return (tem); | 2580 return (tem); |
2581 } | 2581 } |
2582 | 2582 |
2598 return unbind_to (count, val); | 2598 return unbind_to (count, val); |
2599 } | 2599 } |
2600 | 2600 |
2601 init_window_once () | 2601 init_window_once () |
2602 { | 2602 { |
2603 #ifdef MULTI_SCREEN | 2603 #ifdef MULTI_FRAME |
2604 selected_screen = make_terminal_screen (); | 2604 selected_frame = make_terminal_frame (); |
2605 minibuf_window = selected_screen->minibuffer_window; | 2605 minibuf_window = selected_frame->minibuffer_window; |
2606 selected_window = selected_screen->selected_window; | 2606 selected_window = selected_frame->selected_window; |
2607 last_nonminibuf_screen = selected_screen; | 2607 last_nonminibuf_frame = selected_frame; |
2608 #else /* not MULTI_SCREEN */ | 2608 #else /* not MULTI_FRAME */ |
2609 extern Lisp_Object get_minibuffer (); | 2609 extern Lisp_Object get_minibuffer (); |
2610 | 2610 |
2611 SCREEN_ROOT_WINDOW (selected_screen) = make_window (); | 2611 FRAME_ROOT_WINDOW (selected_frame) = make_window (); |
2612 minibuf_window = make_window (); | 2612 minibuf_window = make_window (); |
2613 | 2613 |
2614 XWINDOW (SCREEN_ROOT_WINDOW (selected_screen))->next = minibuf_window; | 2614 XWINDOW (FRAME_ROOT_WINDOW (selected_frame))->next = minibuf_window; |
2615 XWINDOW (minibuf_window)->prev = SCREEN_ROOT_WINDOW (selected_screen); | 2615 XWINDOW (minibuf_window)->prev = FRAME_ROOT_WINDOW (selected_frame); |
2616 | 2616 |
2617 /* These values 9 and 10 are arbitrary, | 2617 /* These values 9 and 10 are arbitrary, |
2618 just so that there is "something there." | 2618 just so that there is "something there." |
2619 Correct values are put in in init_xdisp */ | 2619 Correct values are put in in init_xdisp */ |
2620 | 2620 |
2621 XFASTINT (XWINDOW (SCREEN_ROOT_WINDOW (selected_screen))->width) = 10; | 2621 XFASTINT (XWINDOW (FRAME_ROOT_WINDOW (selected_frame))->width) = 10; |
2622 XFASTINT (XWINDOW (minibuf_window)->width) = 10; | 2622 XFASTINT (XWINDOW (minibuf_window)->width) = 10; |
2623 | 2623 |
2624 XFASTINT (XWINDOW (SCREEN_ROOT_WINDOW (selected_screen))->height) = 9; | 2624 XFASTINT (XWINDOW (FRAME_ROOT_WINDOW (selected_frame))->height) = 9; |
2625 XFASTINT (XWINDOW (minibuf_window)->top) = 9; | 2625 XFASTINT (XWINDOW (minibuf_window)->top) = 9; |
2626 XFASTINT (XWINDOW (minibuf_window)->height) = 1; | 2626 XFASTINT (XWINDOW (minibuf_window)->height) = 1; |
2627 | 2627 |
2628 /* Prevent error in Fset_window_buffer. */ | 2628 /* Prevent error in Fset_window_buffer. */ |
2629 XWINDOW (SCREEN_ROOT_WINDOW (selected_screen))->buffer = Qt; | 2629 XWINDOW (FRAME_ROOT_WINDOW (selected_frame))->buffer = Qt; |
2630 XWINDOW (minibuf_window)->buffer = Qt; | 2630 XWINDOW (minibuf_window)->buffer = Qt; |
2631 | 2631 |
2632 /* Now set them up for real. */ | 2632 /* Now set them up for real. */ |
2633 Fset_window_buffer (SCREEN_ROOT_WINDOW (selected_screen), | 2633 Fset_window_buffer (FRAME_ROOT_WINDOW (selected_frame), |
2634 Fcurrent_buffer ()); | 2634 Fcurrent_buffer ()); |
2635 Fset_window_buffer (minibuf_window, get_minibuffer (0)); | 2635 Fset_window_buffer (minibuf_window, get_minibuffer (0)); |
2636 | 2636 |
2637 selected_window = SCREEN_ROOT_WINDOW (selected_screen); | 2637 selected_window = FRAME_ROOT_WINDOW (selected_frame); |
2638 /* Make sure this window seems more recently used than | 2638 /* Make sure this window seems more recently used than |
2639 a newly-created, never-selected window. Increment | 2639 a newly-created, never-selected window. Increment |
2640 window_select_count so the first selection ever will get | 2640 window_select_count so the first selection ever will get |
2641 something newer than this. */ | 2641 something newer than this. */ |
2642 XFASTINT (XWINDOW (selected_window)->use_time) = ++window_select_count; | 2642 XFASTINT (XWINDOW (selected_window)->use_time) = ++window_select_count; |
2643 #endif /* not MULTI_SCREEN */ | 2643 #endif /* not MULTI_FRAME */ |
2644 } | 2644 } |
2645 | 2645 |
2646 syms_of_window () | 2646 syms_of_window () |
2647 { | 2647 { |
2648 Qwindowp = intern ("windowp"); | 2648 Qwindowp = intern ("windowp"); |
2668 "Window that the last mouse click occurred on."); | 2668 "Window that the last mouse click occurred on."); |
2669 Vmouse_window = Qnil; | 2669 Vmouse_window = Qnil; |
2670 | 2670 |
2671 DEFVAR_LISP ("mouse-event", &Vmouse_event, | 2671 DEFVAR_LISP ("mouse-event", &Vmouse_event, |
2672 "The last mouse-event object. A list of four elements:\n\ | 2672 "The last mouse-event object. A list of four elements:\n\ |
2673 ((X-POS Y-POS) WINDOW SCREEN-PART KEYSEQ).\n\ | 2673 ((X-POS Y-POS) WINDOW FRAME-PART KEYSEQ).\n\ |
2674 KEYSEQ is a string, the key sequence to be looked up in the mouse maps.\n\ | 2674 KEYSEQ is a string, the key sequence to be looked up in the mouse maps.\n\ |
2675 WINDOW is the window that the click applies do.\n\ | 2675 WINDOW is the window that the click applies do.\n\ |
2676 If SCREEN-PART is non-nil, the event was on a scrollbar;\n\ | 2676 If FRAME-PART is non-nil, the event was on a scrollbar;\n\ |
2677 then Y-POS is really the total length of the scrollbar, while X-POS is\n\ | 2677 then Y-POS is really the total length of the scrollbar, while X-POS is\n\ |
2678 the relative position of the scrollbar's value within that total length.\n\ | 2678 the relative position of the scrollbar's value within that total length.\n\ |
2679 SCREEN-PART is one of the following symbols:\n\ | 2679 FRAME-PART is one of the following symbols:\n\ |
2680 `vertical-scrollbar', `vertical-slider',\n\ | 2680 `vertical-scrollbar', `vertical-slider',\n\ |
2681 `vertical-thumbup', `vertical-thumbdown',\n\ | 2681 `vertical-thumbup', `vertical-thumbdown',\n\ |
2682 `horizontal-scrollbar', `horizontal-slider',\n\ | 2682 `horizontal-scrollbar', `horizontal-slider',\n\ |
2683 `horizontal-thumbleft', `horizontal-thumbright'"); | 2683 `horizontal-thumbleft', `horizontal-thumbright'"); |
2684 Vmouse_event = Qnil; | 2684 Vmouse_event = Qnil; |
2689 | 2689 |
2690 DEFVAR_LISP ("other-window-scroll-buffer", &Vother_window_scroll_buffer, | 2690 DEFVAR_LISP ("other-window-scroll-buffer", &Vother_window_scroll_buffer, |
2691 "If non-nil, this is a buffer and \\[scroll-other-window] should scroll its window."); | 2691 "If non-nil, this is a buffer and \\[scroll-other-window] should scroll its window."); |
2692 Vother_window_scroll_buffer = Qnil; | 2692 Vother_window_scroll_buffer = Qnil; |
2693 | 2693 |
2694 #ifdef MULTI_SCREEN | 2694 #ifdef MULTI_FRAME |
2695 DEFVAR_BOOL ("pop-up-screens", &pop_up_screens, | 2695 DEFVAR_BOOL ("pop-up-frames", &pop_up_frames, |
2696 "*Non-nil means `display-buffer' should make a separate X-window."); | 2696 "*Non-nil means `display-buffer' should make a separate X-window."); |
2697 pop_up_screens = 0; | 2697 pop_up_frames = 0; |
2698 | 2698 |
2699 DEFVAR_LISP ("pop-up-screen-function", &Vpop_up_screen_function, | 2699 DEFVAR_LISP ("pop-up-frame-function", &Vpop_up_frame_function, |
2700 "*If non-nil, function to call to handle automatic new screen creation.\n\ | 2700 "*If non-nil, function to call to handle automatic new frame creation.\n\ |
2701 It is called with no arguments and should return a newly created screen.\n\ | 2701 It is called with no arguments and should return a newly created frame.\n\ |
2702 \n\ | 2702 \n\ |
2703 A typical value might be `(lambda () (x-create-screen auto-screen-parms))'\n\ | 2703 A typical value might be `(lambda () (new-frame pop-up-frame-alist))'\n\ |
2704 where `auto-screen-parms' would hold the default screen parameters."); | 2704 where `pop-up-frame-alist' would hold the default frame parameters."); |
2705 Vpop_up_screen_function = Qnil; | 2705 Vpop_up_frame_function = Qnil; |
2706 #endif | 2706 #endif |
2707 | 2707 |
2708 DEFVAR_BOOL ("pop-up-windows", &pop_up_windows, | 2708 DEFVAR_BOOL ("pop-up-windows", &pop_up_windows, |
2709 "*Non-nil means display-buffer should make new windows."); | 2709 "*Non-nil means display-buffer should make new windows."); |
2710 pop_up_windows = 1; | 2710 pop_up_windows = 1; |