aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/window.c373
1 files changed, 217 insertions, 156 deletions
diff --git a/src/window.c b/src/window.c
index a91b5e68aea..a6e1d9c6c31 100644
--- a/src/window.c
+++ b/src/window.c
@@ -153,20 +153,7 @@ DEFUN ("minibuffer-window", Fminibuffer_window, Sminibuffer_window, 0, 0, 0,
153 () 153 ()
154{ 154{
155#ifdef MULTI_SCREEN 155#ifdef MULTI_SCREEN
156 if (minibuf_level == 0 156 choose_minibuf_screen ();
157 && !EQ (minibuf_window, selected_screen->minibuffer_window)
158 && !EQ (Qnil, selected_screen->minibuffer_window))
159 {
160 Fset_window_buffer (selected_screen->minibuffer_window,
161 XWINDOW (minibuf_window)->buffer);
162 minibuf_window = selected_screen->minibuffer_window;
163 }
164
165 if (SCREENP (Vglobal_minibuffer_screen))
166 minibuf_window = XSCREEN (Vglobal_minibuffer_screen)->minibuffer_window;
167 else
168 minibuf_window = selected_screen->minibuffer_window;
169
170#endif /* MULTI_SCREEN */ 157#endif /* MULTI_SCREEN */
171 return minibuf_window; 158 return minibuf_window;
172} 159}
@@ -328,55 +315,135 @@ and BOTTOM is one more than the bottommost row used by WINDOW\n\
328 Qnil)))); 315 Qnil))));
329} 316}
330 317
318/* Test if the character at column *x, row *y is within window *w.
319 If it is not, return 0;
320 if it is in the window's text area,
321 set *x and *y to its location relative to the upper left corner
322 of the window, and
323 return 1;
324 if it is on the window's modeline, return 2;
325 if it is on the border between the window and its right sibling,
326 return 3. */
327static int
328coordinates_in_window (w, x, y)
329 register struct window *w;
330 register int *x, *y;
331{
332 register int left = XINT (w->left);
333 register int width = XINT (w->width);
334 register int window_height = XINT (w->height);
335 register int top = XFASTINT (w->top);
336
337 if ( *x < left || *x >= left + width
338 || *y < top || *y >= top + window_height)
339 return 0;
340
341 /* Is the character is the mode line? */
342 if (*y == top + window_height - 1
343 && window_height > 1) /* 1 line => minibuffer */
344 return 2;
345
346 /* Is the character in the right border? */
347 if (*x == left + width - 1
348 && left + width != SCREEN_WIDTH (XSCREEN (w->screen)))
349 return 3;
350
351 *x -= left;
352 *y -= top;
353 return 1;
354}
355
356DEFUN ("coordinates-in-window-p", Fcoordinates_in_window_p,
357 Scoordinates_in_window_p, 2, 2, 0,
358 "Return non-nil if COORDINATES are in WINDOW.\n\
359COORDINATES is a cons of the form (X . Y), X and Y being screen-relative.\n\
360If COORDINATES are in the text portion of WINDOW,\n\
361 the coordinates relative to the window are returned.\n\
362If they are in the mode line of WINDOW, 'mode-line is returned.\n\
363If they are on the border between WINDOW and its right sibling,\n\
364 'vertical-split is returned.")
365 (coordinates, window)
366 register Lisp_Object coordinates, window;
367{
368 int x, y;
369
370 CHECK_WINDOW (window, 0);
371 CHECK_CONS (coordinates, 1);
372 x = XINT (Fcar (coordinates));
373 y = XINT (Fcdr (coordinates));
374
375 switch (coordinates_in_window (XWINDOW (window), &x, &y))
376 {
377 case 0: /* NOT in window at all. */
378 return Qnil;
379
380 case 1: /* In text part of window. */
381 return Fcons (x, y);
382
383 case 2: /* In mode line of window. */
384 return Qmode_line;
385
386 case 3: /* On right border of window. */
387 return Qvertical_split;
388
389 default:
390 abort ();
391 }
392}
393
331/* Find the window containing column x, row y, and return it as a 394/* Find the window containing column x, row y, and return it as a
332 Lisp_Object. If x, y is on the window's modeline, set *modeline_p 395 Lisp_Object. If x, y is on the window's modeline, set *part
333 to 1; otherwise set it to 0. If there is no window under x, y 396 to 1; if it is on the separating line between the window and its
334 return nil and leave *modeline_p unmodified. */ 397 right sibling, set it to 2; otherwise set it to 0. If there is no
398 window under x, y return nil and leave *part unmodified. */
335Lisp_Object 399Lisp_Object
336window_from_coordinates (screen, x, y, modeline_p) 400window_from_coordinates (screen, x, y, part)
337 SCREEN_PTR screen; 401 SCREEN_PTR screen;
338 int x, y; 402 int x, y;
339 int *modeline_p; 403 int *part;
340{ 404{
341 register Lisp_Object tem, first; 405 register Lisp_Object tem, first;
342 406
343 first = SCREEN_SELECTED_WINDOW (screen); 407 tem = first = SCREEN_SELECTED_WINDOW (screen);
344 tem = next_screen_window (screen, first, Qt);
345 408
346 while (1) 409 do
347 { 410 {
348 int found = coordinates_in_window (XWINDOW (tem), &x, &y); 411 int found = coordinates_in_window (XWINDOW (tem), &x, &y);
349 412
350 if (found) 413 if (found)
351 { 414 {
352 *modeline_p = (found == -1); 415 *part = found - 1;
353 return tem; 416 return tem;
354 } 417 }
355 418
356 if (EQ (tem, first)) 419 tem = Fnext_window (tem, Qt, Qlambda);
357 return Qnil;
358
359 tem = next_screen_window (screen, tem, Qt);
360 } 420 }
421 while (! EQ (tem, first));
422
423 return Qnil;
361} 424}
362 425
363DEFUN ("locate-window-from-coordinates", 426DEFUN ("window-at", Fwindow_at, Swindow_at, 1, 2, 0,
364 Flocate_window_from_coordinates, Slocate_window_from_coordinates, 427 "Return window containing position COORDINATES on SCREEN.\n\
365 2, 2, 0, 428If omitted, SCREEN defaults to the currently selected screen.\n\
366 "Return window on SCREEN containing position COORDINATES.\n\ 429COORDINATES is a pair (SCREEN-X . SCREEN-Y) of coordinates\n\
367COORDINATES is a list (SCREEN-X SCREEN-Y) of coordinates\n\
368which are relative to 0,0 at the top left corner of the screen.") 430which are relative to 0,0 at the top left corner of the screen.")
369 (screen, coordinates) 431 (coordinates, screen)
370 Lisp_Object screen, coordinates; 432 Lisp_Object coordinates, screen;
371{ 433{
372 int part; 434 int part;
373 435
374 CHECK_SCREEN (screen, 0); 436 if (NULL (screen))
437 XSET (screen, Lisp_Screen, selected_screen);
438 else
439 CHECK_LIVE_SCREEN (screen, 0);
375 CHECK_CONS (coordinates, 1); 440 CHECK_CONS (coordinates, 1);
441 CHECK_NUMBER (XCONS (coordinates)->car, 1);
442 CHECK_NUMBER (XCONS (coordinates)->cdr, 1);
376 443
377 return window_from_coordinates (XSCREEN (screen), 444 return window_from_coordinates (XSCREEN (screen),
378 XINT (Fcar (coordinates)), 445 XINT (Fcar (coordinates)),
379 XINT (Fcar (Fcdr (coordinates))), 446 XINT (Fcdr (coordinates)),
380 &part); 447 &part);
381} 448}
382 449
@@ -689,86 +756,56 @@ DEFUN ("delete-window", Fdelete_window, Sdelete_window, 0, 1, "",
689 return Qnil; 756 return Qnil;
690} 757}
691 758
692#ifdef MULTI_SCREEN
693Lisp_Object
694next_screen_window (screen, window, mini)
695 SCREEN_PTR screen;
696 Lisp_Object window, mini;
697{
698 Lisp_Object tem;
699
700 if (NULL (window))
701 window = SCREEN_SELECTED_WINDOW (screen);
702
703 /* Do this loop at least once, to get the next window, and perhaps
704 again, if we hit the minibuffer and that is not acceptable. */
705 do
706 {
707 /* Find a window that actually has a next one. This loop
708 climbs up the tree. */
709 while (tem = XWINDOW (window)->next, NULL (tem))
710 if (tem = XWINDOW (window)->parent, !NULL (tem))
711 window = tem;
712 else
713 /* Since window's next and parent are nil, we have found
714 the minibuffer window of this screen. */
715 {
716 tem = SCREEN_ROOT_WINDOW (screen);
717 break;
718 }
719
720 window = tem;
721 /* If we're in a combination window, find its first child and
722 recurse on that. Otherwise, we've found the window we want. */
723 while (1)
724 {
725 if (!NULL (XWINDOW (window)->hchild))
726 window = XWINDOW (window)->hchild;
727 else if (!NULL (XWINDOW (window)->vchild))
728 window = XWINDOW (window)->vchild;
729 else break;
730 }
731 }
732 /* Exit the loop if
733 this isn't a minibuffer window, or
734 we're accepting all minibuffer windows, even when inactive, or
735 we're accepting active minibuffer windows and this one is. */
736 while (MINI_WINDOW_P (XWINDOW (window))
737 && !EQ (mini, Qt)
738 && (!NULL (mini) || !minibuf_level));
739
740 return window;
741}
742#endif
743 759
744extern Lisp_Object next_screen (), prev_screen (); 760extern Lisp_Object next_screen (), prev_screen ();
745 761
746DEFUN ("next-window", Fnext_window, Snext_window, 0, 3, 0, 762DEFUN ("next-window", Fnext_window, Snext_window, 0, 3, 0,
747 "Return next window after WINDOW in canonical ordering of windows.\n\ 763 "Return next window after WINDOW in canonical ordering of windows.\n\
748Optional second arg MINIBUF t means count the minibuffer window\n\ 764If omitted, WINDOW defaults to the selected window.\n\
749even if not active. If MINIBUF is neither t nor nil it means\n\ 765\n\
750not to count the minibuffer even if it is active.\n\ 766Optional second arg MINIBUF t means count the minibuffer window even\n\
751Optional third arg ALL-SCREENS t means include all windows in all screens;\n\ 767if not active. MINIBUF nil or omitted means count the minibuffer iff\n\
752otherwise cycle within the selected screen, with the exception that if a\n\ 768it is active. MINIBUF neither t nor nil means not to count the\n\
753global minibuffer screen is in use and MINIBUF is t, all screens are used.") 769minibuffer even if it is active.\n\
754 (window, mini, all_screens) 770\n\
755 register Lisp_Object window, mini, all_screens; 771Several screens may share a single minibuffer; if the minibuffer\n\
772counts, all windows on all screens that share that minibuffer count\n\
773too. This means that next-window may be used to iterate through the\n\
774set of windows even when the minibuffer is on another screen. If the\n\
775minibuffer does not count, only windows from WINDOW's screen count.\n\
776\n\
777Optional third arg ALL-SCREENS t means include windows on all screens.\n\
778ALL-SCREENS nil or omitted means cycle within the screens as specified\n\
779above. If neither nil nor t, restrict to WINDOW's screen.")
780 (window, minibuf, all_screens)
781 register Lisp_Object window, minibuf, all_screens;
756{ 782{
757 register Lisp_Object tem; 783 register Lisp_Object tem;
784 Lisp_Object start_window;
758 785
759 if (NULL (window)) 786 if (NULL (window))
760 window = selected_window; 787 window = selected_window;
761 else 788 else
762 CHECK_WINDOW (window, 0); 789 CHECK_WINDOW (window, 0);
763 790
764#ifdef MULTI_SCREEN 791 start_window = window;
765 if (EQ (mini, Qt) 792
766 || (! NULL (mini) && minibuf_level)) 793 /* minibuf == nil may or may not include minibuffers.
767 { 794 Decide if it does. */
768 if (SCREENP (Vglobal_minibuffer_screen)) 795 if (NULL (minibuf))
769 all_screens = Qt; 796 minibuf = (minibuf_level ? Qt : Qlambda);
770 } 797
771#endif 798 /* all_screens == nil doesn't specify which screens to include.
799 Decide which screens it includes. */
800 if (NULL (all_screens))
801 all_screens = (EQ (minibuf, Qt)
802 ? (SCREEN_MINIBUF_WINDOW
803 (XSCREEN
804 (WINDOW_SCREEN
805 (XWINDOW (window)))))
806 : Qnil);
807 else if (! EQ (all_screens, Qt))
808 all_screens = Qnil;
772 809
773 /* Do this loop at least once, to get the next window, and perhaps 810 /* Do this loop at least once, to get the next window, and perhaps
774 again, if we hit the minibuffer and that is not acceptable. */ 811 again, if we hit the minibuffer and that is not acceptable. */
@@ -779,21 +816,22 @@ global minibuffer screen is in use and MINIBUF is t, all screens are used.")
779 while (tem = XWINDOW (window)->next, NULL (tem)) 816 while (tem = XWINDOW (window)->next, NULL (tem))
780 if (tem = XWINDOW (window)->parent, !NULL (tem)) 817 if (tem = XWINDOW (window)->parent, !NULL (tem))
781 window = tem; 818 window = tem;
782 else 819 else
783 /* Since window's next and parent are nil, it must be
784 the minibuffer window of this screen. If all_screens,
785 jump to the next screen. */
786 { 820 {
821 /* We've reached the end of this screen.
822 Which other screens are acceptable? */
787 tem = WINDOW_SCREEN (XWINDOW (window)); 823 tem = WINDOW_SCREEN (XWINDOW (window));
788#ifdef MULTI_SCREEN 824#ifdef MULTI_SCREEN
789 if (! NULL (all_screens)) 825 if (! NULL (all_screens))
790 tem = next_screen (tem, NULL (mini) ? 0 : 1); 826 tem = next_screen (tem, all_screens);
791#endif 827#endif
792 tem = SCREEN_ROOT_WINDOW (XSCREEN (tem)); 828 tem = SCREEN_ROOT_WINDOW (XSCREEN (tem));
829
793 break; 830 break;
794 } 831 }
795 832
796 window = tem; 833 window = tem;
834
797 /* If we're in a combination window, find its first child and 835 /* If we're in a combination window, find its first child and
798 recurse on that. Otherwise, we've found the window we want. */ 836 recurse on that. Otherwise, we've found the window we want. */
799 while (1) 837 while (1)
@@ -805,46 +843,66 @@ global minibuffer screen is in use and MINIBUF is t, all screens are used.")
805 else break; 843 else break;
806 } 844 }
807 } 845 }
808 /* Exit the loop if 846 /* Which windows are acceptible?
847 Exit the loop and accept this window if
809 this isn't a minibuffer window, or 848 this isn't a minibuffer window, or
810 we're accepting all minibuffer windows, even when inactive, or 849 we're accepting minibuffer windows, or
811 we're accepting active minibuffer windows and this one is, or 850 we've come all the way around and we're back at the original window. */
812 this is a screen whose only window is a minibuffer window. */
813 while (MINI_WINDOW_P (XWINDOW (window)) 851 while (MINI_WINDOW_P (XWINDOW (window))
814 && !EQ (mini, Qt) 852 && ! EQ (minibuf, Qt)
815 && (!NULL (mini) || !minibuf_level) 853 && window != start_window);
816 && !EQ (SCREEN_ROOT_WINDOW (XSCREEN (XWINDOW (window)->screen)),
817 SCREEN_MINIBUF_WINDOW (XSCREEN (XWINDOW (window)->screen))));
818 854
819 return window; 855 return window;
820} 856}
821 857
822DEFUN ("previous-window", Fprevious_window, Sprevious_window, 0, 3, 0, 858DEFUN ("previous-window", Fprevious_window, Sprevious_window, 0, 3, 0,
823 "Return previous window before WINDOW in canonical ordering of windows.\n\ 859 "Return the window preceeding WINDOW in canonical ordering of windows.\n\
824Optional second arg MINIBUF t means count the minibuffer window\n\ 860If omitted, WINDOW defaults to the selected window.\n\
825even if not active. If MINIBUF is neither t nor nil it means\n\ 861\n\
826not to count the minibuffer even if it is active.\n\ 862Optional second arg MINIBUF t means count the minibuffer window even\n\
827Optional third arg ALL-SCREENS t means include all windows in all screens;\n\ 863if not active. MINIBUF nil or omitted means count the minibuffer iff\n\
828otherwise cycle within the selected screen, with the exception that if a\n\ 864it is active. MINIBUF neither t nor nil means not to count the\n\
829global minibuffer screen is in use and MINIBUF is t, all screens are used.") 865minibuffer even if it is active.\n\
830 (window, mini, all_screens) 866\n\
831 register Lisp_Object window, mini, all_screens; 867Several screens may share a single minibuffer; if the minibuffer\n\
868counts, all windows on all screens that share that minibuffer count\n\
869too. This means that previous-window may be used to iterate through\n\
870the set of windows even when the minibuffer is on another screen. If\n\
871the minibuffer does not count, only windows from WINDOW's screen\n\
872count.\n\
873\n\
874Optional third arg ALL-SCREENS t means include windows on all screens.\n\
875ALL-SCREENS nil or omitted means cycle within the screens as specified\n\
876above. If neither nil nor t, restrict to WINDOW's screen.")
877 (window, minibuf, all_screens)
878 register Lisp_Object window, minibuf, all_screens;
832{ 879{
833 register Lisp_Object tem; 880 register Lisp_Object tem;
881 Lisp_Object start_window;
834 882
835 if (NULL (window)) 883 if (NULL (window))
836 window = selected_window; 884 window = selected_window;
837 else 885 else
838 CHECK_WINDOW (window, 0); 886 CHECK_WINDOW (window, 0);
839 887
840#ifdef MULTI_SCREEN 888 start_window = window;
841 if (EQ (mini, Qt) 889
842 || (! NULL (mini) && minibuf_level)) 890 /* minibuf == nil may or may not include minibuffers.
843 { 891 Decide if it does. */
844 if (SCREENP (Vglobal_minibuffer_screen)) 892 if (NULL (minibuf))
845 all_screens = Qt; 893 minibuf = (minibuf_level ? Qt : Qlambda);
846 } 894
847#endif 895 /* all_screens == nil doesn't specify which screens to include.
896 Decide which screens it includes. */
897 if (NULL (all_screens))
898 all_screens = (EQ (minibuf, Qt)
899 ? (SCREEN_MINIBUF_WINDOW
900 (XSCREEN
901 (WINDOW_SCREEN
902 (XWINDOW (window)))))
903 : Qnil);
904 else if (! EQ (all_screens, Qt))
905 all_screens = Qnil;
848 906
849 /* Do this loop at least once, to get the previous window, and perhaps 907 /* Do this loop at least once, to get the previous window, and perhaps
850 again, if we hit the minibuffer and that is not acceptable. */ 908 again, if we hit the minibuffer and that is not acceptable. */
@@ -855,17 +913,17 @@ global minibuffer screen is in use and MINIBUF is t, all screens are used.")
855 while (tem = XWINDOW (window)->prev, NULL (tem)) 913 while (tem = XWINDOW (window)->prev, NULL (tem))
856 if (tem = XWINDOW (window)->parent, !NULL (tem)) 914 if (tem = XWINDOW (window)->parent, !NULL (tem))
857 window = tem; 915 window = tem;
858 else 916 else
859 /* Since window's prev and parent are nil, we have found
860 the root window of this screen. If all_screens, jump
861 to the previous screen. */
862 { 917 {
918 /* We have found the top window on the screen.
919 Which screens are acceptable? */
863 tem = WINDOW_SCREEN (XWINDOW (window)); 920 tem = WINDOW_SCREEN (XWINDOW (window));
864#ifdef MULTI_SCREEN 921#ifdef MULTI_SCREEN
865 if (! NULL (all_screens)) 922 if (! NULL (all_screens))
866 tem = prev_screen (tem, NULL (mini) ? 0 : 1); 923 tem = next_screen (tem, all_screens);
867#endif 924#endif
868 tem = SCREEN_ROOT_WINDOW (XSCREEN (tem)); 925 tem = SCREEN_ROOT_WINDOW (XSCREEN (tem));
926
869 break; 927 break;
870 } 928 }
871 929
@@ -883,16 +941,14 @@ global minibuffer screen is in use and MINIBUF is t, all screens are used.")
883 window = tem; 941 window = tem;
884 } 942 }
885 } 943 }
886 /* Exit the loop if 944 /* Which windows are acceptable?
945 Exit the loop and accept this window if
887 this isn't a minibuffer window, or 946 this isn't a minibuffer window, or
888 we're accepting all minibuffer windows, even when inactive, or 947 we're accepting minibuffer windows, or
889 we're accepting active minibuffer windows and this one is, or 948 we've come all the way around and we're back at the original window. */
890 this is a screen whose only window is a minibuffer window. */
891 while (MINI_WINDOW_P (XWINDOW (window)) 949 while (MINI_WINDOW_P (XWINDOW (window))
892 && !EQ (mini, Qt) 950 && !EQ (minibuf, Qt)
893 && (!NULL (mini) || !minibuf_level) 951 && window != start_window);
894 && !EQ (SCREEN_ROOT_WINDOW (XSCREEN (XWINDOW (window)->screen)),
895 SCREEN_MINIBUF_WINDOW (XSCREEN (XWINDOW (window)->screen))));
896 952
897 return window; 953 return window;
898} 954}
@@ -983,7 +1039,7 @@ window_loop (type, obj, mini, screens)
983 the current window. */ 1039 the current window. */
984#ifdef MULTI_SCREEN 1040#ifdef MULTI_SCREEN
985 if (screen) 1041 if (screen)
986 next_window = next_screen_window (screen, w, mini ? Qt : Qnil); 1042 next_window = Fnext_window (w, (mini ? Qt : Qnil), Qlambda);
987 else 1043 else
988#endif /* MULTI_SCREEN */ 1044#endif /* MULTI_SCREEN */
989 /* We know screen is 0, so we're looping through all screens. 1045 /* We know screen is 0, so we're looping through all screens.
@@ -1467,16 +1523,14 @@ Returns the window displaying BUFFER.")
1467 1523
1468 if (pop_up_windows 1524 if (pop_up_windows
1469#ifdef MULTI_SCREEN 1525#ifdef MULTI_SCREEN
1470 || EQ (SCREEN_ROOT_WINDOW (selected_screen), 1526 || SCREEN_MINIBUF_ONLY_P (selected_screen)
1471 SCREEN_MINIBUF_WINDOW (selected_screen))
1472#endif 1527#endif
1473 ) 1528 )
1474 { 1529 {
1475 Lisp_Object screens = Qnil; 1530 Lisp_Object screens = Qnil;
1476 1531
1477#ifdef MULTI_SCREEN 1532#ifdef MULTI_SCREEN
1478 if (EQ (SCREEN_ROOT_WINDOW (selected_screen), 1533 if (SCREEN_MINIBUF_ONLY_P (selected_screen))
1479 SCREEN_MINIBUF_WINDOW (selected_screen)))
1480 XSET (screens, Lisp_Screen, last_nonminibuf_screen); 1534 XSET (screens, Lisp_Screen, last_nonminibuf_screen);
1481#endif 1535#endif
1482 /* Don't try to create a window if would get an error */ 1536 /* Don't try to create a window if would get an error */
@@ -1782,17 +1836,22 @@ change_window_height (delta, widthflag)
1782 1836
1783 { 1837 {
1784 register int maxdelta; 1838 register int maxdelta;
1785 register Lisp_Object tem;
1786 1839
1787 maxdelta = (!NULL (parent) ? (*sizefun) (parent) - *sizep 1840 maxdelta = (!NULL (parent) ? (*sizefun) (parent) - *sizep
1788 : (tem = (!NULL (p->next) ? p->next : p->prev), 1841 : !NULL (p->next) ? (*sizefun) (p->next) - MINSIZE (p->next)
1789 (*sizefun) (tem) - MINSIZE (tem))); 1842 : !NULL (p->prev) ? (*sizefun) (p->prev) - MINSIZE (p->prev)
1843 /* This is a screen with only one window, a minibuffer-only
1844 or a minibufferless screen. */
1845 : (delta = 0));
1790 1846
1791 if (delta > maxdelta) 1847 if (delta > maxdelta)
1792 /* This case traps trying to make the minibuffer 1848 /* This case traps trying to make the minibuffer
1793 the full screen, or make the only window aside from the 1849 the full screen, or make the only window aside from the
1794 minibuffer the full screen. */ 1850 minibuffer the full screen. */
1795 delta = maxdelta; 1851 delta = maxdelta;
1852
1853 if (delta == 0)
1854 return;
1796 } 1855 }
1797 1856
1798 if (!NULL (p->next) && 1857 if (!NULL (p->next) &&
@@ -2497,7 +2556,7 @@ its value is -not- saved.")
2497 s = selected_screen; 2556 s = selected_screen;
2498 else 2557 else
2499 { 2558 {
2500 CHECK_SCREEN (screen, 0); 2559 CHECK_LIVE_SCREEN (screen, 0);
2501 s = XSCREEN (screen); 2560 s = XSCREEN (screen);
2502 } 2561 }
2503 2562
@@ -2546,6 +2605,7 @@ init_window_once ()
2546 selected_screen = make_terminal_screen (); 2605 selected_screen = make_terminal_screen ();
2547 minibuf_window = selected_screen->minibuffer_window; 2606 minibuf_window = selected_screen->minibuffer_window;
2548 selected_window = selected_screen->selected_window; 2607 selected_window = selected_screen->selected_window;
2608 last_nonminibuf_screen = selected_screen;
2549#else /* not MULTI_SCREEN */ 2609#else /* not MULTI_SCREEN */
2550 extern Lisp_Object get_minibuffer (); 2610 extern Lisp_Object get_minibuffer ();
2551 2611
@@ -2677,7 +2737,8 @@ If there is only one window, it is split regardless of this value.");
2677 defsubr (&Swindow_hscroll); 2737 defsubr (&Swindow_hscroll);
2678 defsubr (&Sset_window_hscroll); 2738 defsubr (&Sset_window_hscroll);
2679 defsubr (&Swindow_edges); 2739 defsubr (&Swindow_edges);
2680 defsubr (&Slocate_window_from_coordinates); 2740 defsubr (&Scoordinates_in_window_p);
2741 defsubr (&Swindow_at);
2681 defsubr (&Swindow_point); 2742 defsubr (&Swindow_point);
2682 defsubr (&Swindow_start); 2743 defsubr (&Swindow_start);
2683 defsubr (&Swindow_end); 2744 defsubr (&Swindow_end);