aboutsummaryrefslogtreecommitdiffstats
path: root/src/window.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/window.c')
-rw-r--r--src/window.c1414
1 files changed, 1025 insertions, 389 deletions
diff --git a/src/window.c b/src/window.c
index 74b76341446..7f28ccd19b2 100644
--- a/src/window.c
+++ b/src/window.c
@@ -1,6 +1,6 @@
1/* Window creation, deletion and examination for GNU Emacs. 1/* Window creation, deletion and examination for GNU Emacs.
2 Does not include redisplay. 2 Does not include redisplay.
3 Copyright (C) 1985-1987, 1993-1998, 2000-2013 Free Software 3 Copyright (C) 1985-1987, 1993-1998, 2000-2014 Free Software
4 Foundation, Inc. 4 Foundation, Inc.
5 5
6This file is part of GNU Emacs. 6This file is part of GNU Emacs.
@@ -20,8 +20,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
20 20
21#include <config.h> 21#include <config.h>
22 22
23#define WINDOW_INLINE EXTERN_INLINE
24
25#include <stdio.h> 23#include <stdio.h>
26 24
27#include "lisp.h" 25#include "lisp.h"
@@ -59,8 +57,11 @@ static Lisp_Object Qrecord_window_buffer;
59static Lisp_Object Qwindow_deletable_p, Qdelete_window, Qdisplay_buffer; 57static Lisp_Object Qwindow_deletable_p, Qdelete_window, Qdisplay_buffer;
60static Lisp_Object Qreplace_buffer_in_windows, Qget_mru_window; 58static Lisp_Object Qreplace_buffer_in_windows, Qget_mru_window;
61static Lisp_Object Qwindow_resize_root_window, Qwindow_resize_root_window_vertically; 59static Lisp_Object Qwindow_resize_root_window, Qwindow_resize_root_window_vertically;
60static Lisp_Object Qwindow_pixel_to_total;
62static Lisp_Object Qscroll_up, Qscroll_down, Qscroll_command; 61static Lisp_Object Qscroll_up, Qscroll_down, Qscroll_command;
63static Lisp_Object Qsafe, Qabove, Qbelow, Qwindow_size, Qclone_of; 62static Lisp_Object Qsafe, Qabove, Qbelow, Qwindow_size, Qclone_of;
63static Lisp_Object Qfloor, Qceiling;
64static Lisp_Object Qwindow_point_insertion_type;
64 65
65static int displayed_window_lines (struct window *); 66static int displayed_window_lines (struct window *);
66static int count_windows (struct window *); 67static int count_windows (struct window *);
@@ -68,7 +69,6 @@ static int get_leaf_windows (struct window *, struct window **, int);
68static void window_scroll (Lisp_Object, EMACS_INT, bool, int); 69static void window_scroll (Lisp_Object, EMACS_INT, bool, int);
69static void window_scroll_pixel_based (Lisp_Object, int, bool, int); 70static void window_scroll_pixel_based (Lisp_Object, int, bool, int);
70static void window_scroll_line_based (Lisp_Object, int, bool, int); 71static void window_scroll_line_based (Lisp_Object, int, bool, int);
71static Lisp_Object window_list (void);
72static int add_window_to_list (struct window *, void *); 72static int add_window_to_list (struct window *, void *);
73static Lisp_Object next_window (Lisp_Object, Lisp_Object, 73static Lisp_Object next_window (Lisp_Object, Lisp_Object,
74 Lisp_Object, int); 74 Lisp_Object, int);
@@ -83,6 +83,7 @@ static int foreach_window_1 (struct window *,
83static Lisp_Object window_list_1 (Lisp_Object, Lisp_Object, Lisp_Object); 83static Lisp_Object window_list_1 (Lisp_Object, Lisp_Object, Lisp_Object);
84static int window_resize_check (struct window *, bool); 84static int window_resize_check (struct window *, bool);
85static void window_resize_apply (struct window *, bool); 85static void window_resize_apply (struct window *, bool);
86static void window_resize_apply_total (struct window *, bool);
86static Lisp_Object select_window (Lisp_Object, Lisp_Object, int); 87static Lisp_Object select_window (Lisp_Object, Lisp_Object, int);
87static void select_window_1 (Lisp_Object, bool); 88static void select_window_1 (Lisp_Object, bool);
88 89
@@ -121,13 +122,13 @@ Lisp_Object minibuf_selected_window;
121/* Hook run at end of temp_output_buffer_show. */ 122/* Hook run at end of temp_output_buffer_show. */
122static Lisp_Object Qtemp_buffer_show_hook; 123static Lisp_Object Qtemp_buffer_show_hook;
123 124
124/* Nonzero after init_window_once has finished. */ 125/* Incremented for each window created. */
125static int window_initialized; 126static int sequence_number;
126 127
127/* Hook to run when window config changes. */ 128/* Hook to run when window config changes. */
128static Lisp_Object Qwindow_configuration_change_hook; 129static Lisp_Object Qwindow_configuration_change_hook;
129 130
130/* Used by the function window_scroll_pixel_based */ 131/* Used by the function window_scroll_pixel_based. */
131static int window_scroll_pixel_based_preserve_x; 132static int window_scroll_pixel_based_preserve_x;
132static int window_scroll_pixel_based_preserve_y; 133static int window_scroll_pixel_based_preserve_y;
133 134
@@ -490,6 +491,15 @@ select_window (Lisp_Object window, Lisp_Object norecord, int inhibit_point_swap)
490 record_buffer before returning here. */ 491 record_buffer before returning here. */
491 goto record_and_return; 492 goto record_and_return;
492 493
494 if (NILP (norecord))
495 { /* Mark the window for redisplay since the selected-window has
496 a different mode-line. */
497 wset_redisplay (XWINDOW (selected_window));
498 wset_redisplay (w);
499 }
500 else
501 redisplay_other_windows ();
502
493 sf = SELECTED_FRAME (); 503 sf = SELECTED_FRAME ();
494 if (XFRAME (WINDOW_FRAME (w)) != sf) 504 if (XFRAME (WINDOW_FRAME (w)) != sf)
495 { 505 {
@@ -508,7 +518,6 @@ select_window (Lisp_Object window, Lisp_Object norecord, int inhibit_point_swap)
508 518
509 select_window_1 (window, inhibit_point_swap); 519 select_window_1 (window, inhibit_point_swap);
510 bset_last_selected_window (XBUFFER (w->contents), window); 520 bset_last_selected_window (XBUFFER (w->contents), window);
511 windows_or_buffers_changed++;
512 521
513 record_and_return: 522 record_and_return:
514 /* record_buffer can run QUIT, so make sure it is run only after we have 523 /* record_buffer can run QUIT, so make sure it is run only after we have
@@ -554,7 +563,7 @@ select_window_1 (Lisp_Object window, bool inhibit_point_swap)
554DEFUN ("select-window", Fselect_window, Sselect_window, 1, 2, 0, 563DEFUN ("select-window", Fselect_window, Sselect_window, 1, 2, 0,
555 doc: /* Select WINDOW which must be a live window. 564 doc: /* Select WINDOW which must be a live window.
556Also make WINDOW's frame the selected frame and WINDOW that frame's 565Also make WINDOW's frame the selected frame and WINDOW that frame's
557selected window. In addition, make WINDOW's buffer current and set that 566selected window. In addition, make WINDOW's buffer current and set its
558buffer's value of `point' to the value of WINDOW's `window-point'. 567buffer's value of `point' to the value of WINDOW's `window-point'.
559Return WINDOW. 568Return WINDOW.
560 569
@@ -562,8 +571,17 @@ Optional second arg NORECORD non-nil means do not put this buffer at the
562front of the buffer list and do not make this window the most recently 571front of the buffer list and do not make this window the most recently
563selected one. 572selected one.
564 573
565Note that the main editor command loop sets the current buffer to the 574Run `buffer-list-update-hook' unless NORECORD is non-nil. Note that
566buffer of the selected window before each command. */) 575applications and internal routines often select a window temporarily for
576various purposes; mostly, to simplify coding. As a rule, such
577selections should be not recorded and therefore will not pollute
578`buffer-list-update-hook'. Selections that "really count" are those
579causing a visible change in the next redisplay of WINDOW's frame and
580should be always recorded. So if you think of running a function each
581time a window gets selected put it on `buffer-list-update-hook'.
582
583Also note that the main editor command loop sets the current buffer to
584the buffer of the selected window before each command. */)
567 (register Lisp_Object window, Lisp_Object norecord) 585 (register Lisp_Object window, Lisp_Object norecord)
568{ 586{
569 return select_window (window, norecord, 0); 587 return select_window (window, norecord, 0);
@@ -677,34 +695,102 @@ selected one. */)
677 return make_number (decode_live_window (window)->use_time); 695 return make_number (decode_live_window (window)->use_time);
678} 696}
679 697
680DEFUN ("window-total-height", Fwindow_total_height, Swindow_total_height, 0, 1, 0, 698DEFUN ("window-pixel-width", Fwindow_pixel_width, Swindow_pixel_width, 0, 1, 0,
681 doc: /* Return the total height, in lines, of window WINDOW. 699 doc: /* Return the width of window WINDOW in pixels.
682WINDOW must be a valid window and defaults to the selected one. 700WINDOW must be a valid window and defaults to the selected one.
683 701
684The return value includes the mode line and header line, if any. 702The return value includes the fringes and margins of WINDOW as well as
685If WINDOW is an internal window, the total height is the height 703any vertical dividers or scroll bars belonging to WINDOW. If WINDOW is
686of the screen areas spanned by its children. 704an internal window, its pixel width is the width of the screen areas
705spanned by its children. */)
706 (Lisp_Object window)
707{
708 return make_number (decode_valid_window (window)->pixel_width);
709}
687 710
688On a graphical display, this total height is reported as an 711DEFUN ("window-pixel-height", Fwindow_pixel_height, Swindow_pixel_height, 0, 1, 0,
689integer multiple of the default character height. */) 712 doc: /* Return the height of window WINDOW in pixels.
713WINDOW must be a valid window and defaults to the selected one.
714
715The return value includes the mode line and header line and the bottom
716divider, if any. If WINDOW is an internal window, its pixel height is
717the height of the screen areas spanned by its children. */)
690 (Lisp_Object window) 718 (Lisp_Object window)
691{ 719{
692 return make_number (decode_valid_window (window)->total_lines); 720 return make_number (decode_valid_window (window)->pixel_height);
693} 721}
694 722
695DEFUN ("window-total-width", Fwindow_total_width, Swindow_total_width, 0, 1, 0, 723DEFUN ("window-total-height", Fwindow_total_height, Swindow_total_height, 0, 2, 0,
696 doc: /* Return the total width, in columns, of window WINDOW. 724 doc: /* Return the height of window WINDOW in lines.
697WINDOW must be a valid window and defaults to the selected one. 725WINDOW must be a valid window and defaults to the selected one.
698 726
699The return value includes any vertical dividers or scroll bars 727The return value includes the heights of WINDOW's mode and header line
700belonging to WINDOW. If WINDOW is an internal window, the total width 728and its bottom divider, if any. If WINDOW is an internal window, the
701is the width of the screen areas spanned by its children. 729total height is the height of the screen areas spanned by its children.
702 730
703On a graphical display, this total width is reported as an 731If WINDOW's pixel height is not an integral multiple of its frame's
704integer multiple of the default character width. */) 732character height, the number of lines occupied by WINDOW is rounded
705 (Lisp_Object window) 733internally. This is done in a way such that, if WINDOW is a parent
734window, the sum of the total heights of all its children internally
735equals the total height of WINDOW.
736
737If the optional argument ROUND is `ceiling', return the smallest integer
738larger than WINDOW's pixel height divided by the character height of
739WINDOW's frame. ROUND `floor' means to return the largest integer
740smaller than WINDOW's pixel height divided by the character height of
741WINDOW's frame. Any other value of ROUND means to return the internal
742total height of WINDOW. */)
743 (Lisp_Object window, Lisp_Object round)
744{
745 struct window *w = decode_valid_window (window);
746
747 if (! EQ (round, Qfloor) && ! EQ (round, Qceiling))
748 return make_number (w->total_lines);
749 else
750 {
751 int unit = FRAME_LINE_HEIGHT (WINDOW_XFRAME (w));
752
753 return make_number (EQ (round, Qceiling)
754 ? ((w->pixel_height + unit - 1) /unit)
755 : (w->pixel_height / unit));
756 }
757}
758
759DEFUN ("window-total-width", Fwindow_total_width, Swindow_total_width, 0, 2, 0,
760 doc: /* Return the total width of window WINDOW in columns.
761WINDOW must be a valid window and defaults to the selected one.
762
763The return value includes the widths of WINDOW's fringes, margins,
764scroll bars and its right divider, if any. If WINDOW is an internal
765window, the total width is the width of the screen areas spanned by its
766children.
767
768If WINDOW's pixel width is not an integral multiple of its frame's
769character width, the number of lines occupied by WINDOW is rounded
770internally. This is done in a way such that, if WINDOW is a parent
771window, the sum of the total widths of all its children internally
772equals the total width of WINDOW.
773
774If the optional argument ROUND is `ceiling', return the smallest integer
775larger than WINDOW's pixel width divided by the character width of
776WINDOW's frame. ROUND `floor' means to return the largest integer
777smaller than WINDOW's pixel width divided by the character width of
778WINDOW's frame. Any other value of ROUND means to return the internal
779total width of WINDOW. */)
780 (Lisp_Object window, Lisp_Object round)
706{ 781{
707 return make_number (decode_valid_window (window)->total_cols); 782 struct window *w = decode_valid_window (window);
783
784 if (! EQ (round, Qfloor) && ! EQ (round, Qceiling))
785 return make_number (w->total_cols);
786 else
787 {
788 int unit = FRAME_COLUMN_WIDTH (WINDOW_XFRAME (w));
789
790 return make_number (EQ (round, Qceiling)
791 ? ((w->pixel_width + unit - 1) /unit)
792 : (w->pixel_width / unit));
793 }
708} 794}
709 795
710DEFUN ("window-new-total", Fwindow_new_total, Swindow_new_total, 0, 1, 0, 796DEFUN ("window-new-total", Fwindow_new_total, Swindow_new_total, 0, 1, 0,
@@ -734,6 +820,30 @@ WINDOW must be a valid window and defaults to the selected one. */)
734 return decode_valid_window (window)->new_normal; 820 return decode_valid_window (window)->new_normal;
735} 821}
736 822
823DEFUN ("window-new-pixel", Fwindow_new_pixel, Swindow_new_pixel, 0, 1, 0,
824 doc: /* Return new pixel size of window WINDOW.
825WINDOW must be a valid window and defaults to the selected one. */)
826 (Lisp_Object window)
827{
828 return decode_valid_window (window)->new_pixel;
829}
830
831DEFUN ("window-pixel-left", Fwindow_pixel_left, Swindow_pixel_left, 0, 1, 0,
832 doc: /* Return left pixel edge of window WINDOW.
833WINDOW must be a valid window and defaults to the selected one. */)
834 (Lisp_Object window)
835{
836 return make_number (decode_valid_window (window)->pixel_left);
837}
838
839DEFUN ("window-pixel-top", Fwindow_pixel_top, Swindow_pixel_top, 0, 1, 0,
840 doc: /* Return top pixel edge of window WINDOW.
841WINDOW must be a valid window and defaults to the selected one. */)
842 (Lisp_Object window)
843{
844 return make_number (decode_valid_window (window)->pixel_top);
845}
846
737DEFUN ("window-left-column", Fwindow_left_column, Swindow_left_column, 0, 1, 0, 847DEFUN ("window-left-column", Fwindow_left_column, Swindow_left_column, 0, 1, 0,
738 doc: /* Return left column of window WINDOW. 848 doc: /* Return left column of window WINDOW.
739This is the distance, in columns, between the left edge of WINDOW and 849This is the distance, in columns, between the left edge of WINDOW and
@@ -758,79 +868,132 @@ WINDOW must be a valid window and defaults to the selected one. */)
758 return make_number (decode_valid_window (window)->top_line); 868 return make_number (decode_valid_window (window)->top_line);
759} 869}
760 870
761/* Return the number of lines of W's body. Don't count any mode or 871/* Return the number of lines/pixels of W's body. Don't count any mode
762 header line of W. */ 872 or header line or horizontal divider of W. Rounds down to nearest
763 873 integer when not working pixelwise. */
764static int 874static int
765window_body_lines (struct window *w) 875window_body_height (struct window *w, bool pixelwise)
766{ 876{
767 int height = w->total_lines; 877 int height = (w->pixel_height
768 878 - WINDOW_HEADER_LINE_HEIGHT (w)
769 if (!MINI_WINDOW_P (w)) 879 - WINDOW_MODE_LINE_HEIGHT (w)
770 { 880 - WINDOW_BOTTOM_DIVIDER_WIDTH (w));
771 if (WINDOW_WANTS_MODELINE_P (w))
772 --height;
773 if (WINDOW_WANTS_HEADER_LINE_P (w))
774 --height;
775 }
776 881
777 return height; 882 /* Don't return a negative value. */
883 return max (pixelwise
884 ? height
885 : height / FRAME_LINE_HEIGHT (WINDOW_XFRAME (w)),
886 0);
778} 887}
779 888
780/* Return the number of columns of W's body. Don't count columns 889/* Return the number of columns/pixels of W's body. Don't count columns
781 occupied by the scroll bar or the vertical bar separating W from its 890 occupied by the scroll bar or the divider/vertical bar separating W
782 right sibling. On window-systems don't count fringes or display 891 from its right sibling or margins. On window-systems don't count
783 margins either. */ 892 fringes either. Round down to nearest integer when not working
784 893 pixelwise. */
785int 894int
786window_body_cols (struct window *w) 895window_body_width (struct window *w, bool pixelwise)
787{ 896{
788 struct frame *f = XFRAME (WINDOW_FRAME (w)); 897 struct frame *f = XFRAME (WINDOW_FRAME (w));
789 int width = w->total_cols;
790
791 if (WINDOW_HAS_VERTICAL_SCROLL_BAR (w))
792 /* Scroll bars occupy a few columns. */
793 width -= WINDOW_CONFIG_SCROLL_BAR_COLS (w);
794 else if (!FRAME_WINDOW_P (f)
795 && !WINDOW_RIGHTMOST_P (w) && !WINDOW_FULL_WIDTH_P (w))
796 /* The column of `|' characters separating side-by-side windows
797 occupies one column only. */
798 width -= 1;
799
800 /* Display margins cannot be used for normal text. */
801 width -= WINDOW_LEFT_MARGIN_COLS (w) + WINDOW_RIGHT_MARGIN_COLS (w);
802
803 if (FRAME_WINDOW_P (f))
804 /* On window-systems, fringes cannot be used for normal text. */
805 width -= WINDOW_FRINGE_COLS (w);
806 898
807 return width; 899 int width = (w->pixel_width
900 - WINDOW_RIGHT_DIVIDER_WIDTH (w)
901 - (WINDOW_HAS_VERTICAL_SCROLL_BAR (w)
902 ? WINDOW_SCROLL_BAR_AREA_WIDTH (w)
903 : ((!FRAME_WINDOW_P (f)
904 && !WINDOW_RIGHTMOST_P (w)
905 && !WINDOW_RIGHT_DIVIDER_WIDTH (w))
906 /* A vertical bar is either 1 or 0. */
907 ? 1 : 0))
908 - WINDOW_MARGINS_WIDTH (w)
909 - (FRAME_WINDOW_P (f)
910 ? WINDOW_FRINGES_WIDTH (w)
911 : 0));
912
913 /* Don't return a negative value. */
914 return max (pixelwise
915 ? width
916 : width / FRAME_COLUMN_WIDTH (WINDOW_XFRAME (w)),
917 0);
918}
919
920DEFUN ("window-body-height", Fwindow_body_height, Swindow_body_height, 0, 2, 0,
921 doc: /* Return the height of WINDOW's text area.
922WINDOW must be a live window and defaults to the selected one. Optional
923argument PIXELWISE non-nil means return the height of WINDOW's text area
924in pixels. The return value does not include the mode line or header
925line or any horizontal divider.
926
927If PIXELWISE is nil, return the largest integer smaller than WINDOW's
928pixel height divided by the character height of WINDOW's frame. This
929means that if a line at the bottom of the text area is only partially
930visible, that line is not counted. */)
931 (Lisp_Object window, Lisp_Object pixelwise)
932{
933 return make_number (window_body_height (decode_live_window (window),
934 NILP (pixelwise) ? 0 : 1));
935}
936
937DEFUN ("window-body-width", Fwindow_body_width, Swindow_body_width, 0, 2, 0,
938 doc: /* Return the width of WINDOW's text area.
939WINDOW must be a live window and defaults to the selected one. Optional
940argument PIXELWISE non-nil means return the width in pixels. The return
941value does not include any vertical dividers, fringes or marginal areas,
942or scroll bars.
943
944If PIXELWISE is nil, return the largest integer smaller than WINDOW's
945pixel width divided by the character width of WINDOW's frame. This
946means that if a column at the right of the text area is only partially
947visible, that column is not counted. */)
948 (Lisp_Object window, Lisp_Object pixelwise)
949{
950 return make_number (window_body_width (decode_live_window (window),
951 NILP (pixelwise) ? 0 : 1));
952}
953
954DEFUN ("window-mode-line-height", Fwindow_mode_line_height,
955 Swindow_mode_line_height, 0, 1, 0,
956 doc: /* Return the height in pixels of WINDOW's mode-line.
957WINDOW must be a live window and defaults to the selected one. */)
958 (Lisp_Object window)
959{
960 return (make_number (WINDOW_MODE_LINE_HEIGHT (decode_live_window (window))));
808} 961}
809 962
810DEFUN ("window-body-height", Fwindow_body_height, Swindow_body_height, 0, 1, 0, 963DEFUN ("window-header-line-height", Fwindow_header_line_height,
811 doc: /* Return the height, in lines, of WINDOW's text area. 964 Swindow_header_line_height, 0, 1, 0,
812WINDOW must be a live window and defaults to the selected one. 965 doc: /* Return the height in pixels of WINDOW's header-line.
966WINDOW must be a live window and defaults to the selected one. */)
967 (Lisp_Object window)
968{
969 return (make_number (WINDOW_HEADER_LINE_HEIGHT (decode_live_window (window))));
970}
813 971
814The returned height does not include the mode line or header line. 972DEFUN ("window-right-divider-width", Fwindow_right_divider_width,
815On a graphical display, the height is expressed as an integer multiple 973 Swindow_right_divider_width, 0, 1, 0,
816of the default character height. If a line at the bottom of the text 974 doc: /* Return the width in pixels of WINDOW's right divider.
817area is only partially visible, that counts as a whole line; to 975WINDOW must be a live window and defaults to the selected one. */)
818exclude partially-visible lines, use `window-text-height'. */)
819 (Lisp_Object window) 976 (Lisp_Object window)
820{ 977{
821 return make_number (window_body_lines (decode_live_window (window))); 978 return (make_number (WINDOW_RIGHT_DIVIDER_WIDTH (decode_live_window (window))));
822} 979}
823 980
824DEFUN ("window-body-width", Fwindow_body_width, Swindow_body_width, 0, 1, 0, 981DEFUN ("window-bottom-divider-width", Fwindow_bottom_divider_width,
825 doc: /* Return the width, in columns, of WINDOW's text area. 982 Swindow_bottom_divider_width, 0, 1, 0,
826WINDOW must be a live window and defaults to the selected one. 983 doc: /* Return the width in pixels of WINDOW's bottom divider.
984WINDOW must be a live window and defaults to the selected one. */)
985 (Lisp_Object window)
986{
987 return (make_number (WINDOW_BOTTOM_DIVIDER_WIDTH (decode_live_window (window))));
988}
827 989
828The return value does not include any vertical dividers, fringe or 990DEFUN ("window-scroll-bar-width", Fwindow_scroll_bar_width,
829marginal areas, or scroll bars. On a graphical display, the width is 991 Swindow_scroll_bar_width, 0, 1, 0,
830expressed as an integer multiple of the default character width. */) 992 doc: /* Return the width in pixels of WINDOW's vertical scrollbar.
993WINDOW must be a live window and defaults to the selected one. */)
831 (Lisp_Object window) 994 (Lisp_Object window)
832{ 995{
833 return make_number (window_body_cols (decode_live_window (window))); 996 return (make_number (WINDOW_SCROLL_BAR_AREA_WIDTH (decode_live_window (window))));
834} 997}
835 998
836DEFUN ("window-hscroll", Fwindow_hscroll, Swindow_hscroll, 0, 1, 0, 999DEFUN ("window-hscroll", Fwindow_hscroll, Swindow_hscroll, 0, 1, 0,
@@ -953,7 +1116,7 @@ calc_absolute_offset (struct window *w, int *add_x, int *add_y)
953#endif 1116#endif
954#ifdef FRAME_TOOLBAR_TOP_HEIGHT 1117#ifdef FRAME_TOOLBAR_TOP_HEIGHT
955 *add_y += FRAME_TOOLBAR_TOP_HEIGHT (f); 1118 *add_y += FRAME_TOOLBAR_TOP_HEIGHT (f);
956#elif FRAME_TOOLBAR_HEIGHT 1119#elif defined (FRAME_TOOLBAR_HEIGHT)
957 *add_y += FRAME_TOOLBAR_HEIGHT (f); 1120 *add_y += FRAME_TOOLBAR_HEIGHT (f);
958#endif 1121#endif
959#ifdef FRAME_NS_TITLEBAR_HEIGHT 1122#ifdef FRAME_NS_TITLEBAR_HEIGHT
@@ -1080,11 +1243,15 @@ display margins, fringes, header line, and/or mode line. */)
1080 1243
1081/* Test if the character at column X, row Y is within window W. 1244/* Test if the character at column X, row Y is within window W.
1082 If it is not, return ON_NOTHING; 1245 If it is not, return ON_NOTHING;
1246 if it is on the window's vertical divider, return
1247 ON_RIGHT_DIVIDER;
1248 if it is on the window's horizontal divider, return
1249 ON_BOTTOM_DIVIDER;
1083 if it is in the window's text area, return ON_TEXT; 1250 if it is in the window's text area, return ON_TEXT;
1084 if it is on the window's modeline, return ON_MODE_LINE; 1251 if it is on the window's modeline, return ON_MODE_LINE;
1085 if it is on the border between the window and its right sibling, 1252 if it is on the border between the window and its right sibling,
1086 return ON_VERTICAL_BORDER. 1253 return ON_VERTICAL_BORDER;
1087 if it is on a scroll bar, return ON_SCROLL_BAR. 1254 if it is on a scroll bar, return ON_SCROLL_BAR;
1088 if it is on the window's top line, return ON_HEADER_LINE; 1255 if it is on the window's top line, return ON_HEADER_LINE;
1089 if it is in left or right fringe of the window, 1256 if it is in left or right fringe of the window,
1090 return ON_LEFT_FRINGE or ON_RIGHT_FRINGE; 1257 return ON_LEFT_FRINGE or ON_RIGHT_FRINGE;
@@ -1112,25 +1279,41 @@ coordinates_in_window (register struct window *w, int x, int y)
1112 if (y < top_y || y >= bottom_y || x < left_x || x >= right_x) 1279 if (y < top_y || y >= bottom_y || x < left_x || x >= right_x)
1113 return ON_NOTHING; 1280 return ON_NOTHING;
1114 1281
1115 /* On the mode line or header line? */ 1282 /* On the horizontal window divider (which prevails the vertical
1116 if ((WINDOW_WANTS_MODELINE_P (w) 1283 divider)? */
1117 && y >= bottom_y - CURRENT_MODE_LINE_HEIGHT (w) 1284 if (WINDOW_BOTTOM_DIVIDER_WIDTH (w) > 0
1118 && (part = ON_MODE_LINE)) 1285 && y >= (bottom_y - WINDOW_BOTTOM_DIVIDER_WIDTH (w))
1119 || (WINDOW_WANTS_HEADER_LINE_P (w) 1286 && y <= bottom_y)
1120 && y < top_y + CURRENT_HEADER_LINE_HEIGHT (w) 1287 return ON_BOTTOM_DIVIDER;
1121 && (part = ON_HEADER_LINE))) 1288 /* On vertical window divider? */
1289 else if (!WINDOW_RIGHTMOST_P (w)
1290 && WINDOW_RIGHT_DIVIDER_WIDTH (w) > 0
1291 && x >= right_x - WINDOW_RIGHT_DIVIDER_WIDTH (w)
1292 && x <= right_x)
1293 return ON_RIGHT_DIVIDER;
1294 /* On the mode or header line? */
1295 else if ((WINDOW_WANTS_MODELINE_P (w)
1296 && y >= (bottom_y
1297 - CURRENT_MODE_LINE_HEIGHT (w)
1298 - WINDOW_BOTTOM_DIVIDER_WIDTH (w))
1299 && y <= bottom_y - WINDOW_BOTTOM_DIVIDER_WIDTH (w)
1300 && (part = ON_MODE_LINE))
1301 || (WINDOW_WANTS_HEADER_LINE_P (w)
1302 && y < top_y + CURRENT_HEADER_LINE_HEIGHT (w)
1303 && (part = ON_HEADER_LINE)))
1122 { 1304 {
1123 /* If it's under/over the scroll bar portion of the mode/header 1305 /* If it's under/over the scroll bar portion of the mode/header
1124 line, say it's on the vertical line. That's to be able to 1306 line, say it's on the vertical line. That's to be able to
1125 resize windows horizontally in case we're using toolkit scroll 1307 resize windows horizontally in case we're using toolkit scroll
1126 bars. Note: If scrollbars are on the left, the window that 1308 bars. Note: If scrollbars are on the left, the window that
1127 must be eventually resized is that on the left of WINDOW. */ 1309 must be eventually resized is that on the left of WINDOW. */
1128 if ((WINDOW_HAS_VERTICAL_SCROLL_BAR_ON_LEFT (w) 1310 if ((WINDOW_RIGHT_DIVIDER_WIDTH (w) == 0)
1129 && !WINDOW_LEFTMOST_P (w) 1311 && ((WINDOW_HAS_VERTICAL_SCROLL_BAR_ON_LEFT (w)
1130 && eabs (x - left_x) < grabbable_width) 1312 && !WINDOW_LEFTMOST_P (w)
1131 || (!WINDOW_HAS_VERTICAL_SCROLL_BAR_ON_LEFT (w) 1313 && eabs (x - left_x) < grabbable_width)
1132 && !WINDOW_RIGHTMOST_P (w) 1314 || (!WINDOW_HAS_VERTICAL_SCROLL_BAR_ON_LEFT (w)
1133 && eabs (x - right_x) < grabbable_width)) 1315 && !WINDOW_RIGHTMOST_P (w)
1316 && eabs (x - right_x) < grabbable_width)))
1134 return ON_VERTICAL_BORDER; 1317 return ON_VERTICAL_BORDER;
1135 else 1318 else
1136 return part; 1319 return part;
@@ -1141,7 +1324,7 @@ coordinates_in_window (register struct window *w, int x, int y)
1141 if (w->pseudo_window_p) 1324 if (w->pseudo_window_p)
1142 { 1325 {
1143 left_x = 0; 1326 left_x = 0;
1144 right_x = WINDOW_TOTAL_WIDTH (w) - 1; 1327 right_x = WINDOW_PIXEL_WIDTH (w) - 1;
1145 } 1328 }
1146 else 1329 else
1147 { 1330 {
@@ -1162,6 +1345,7 @@ coordinates_in_window (register struct window *w, int x, int y)
1162 if (FRAME_WINDOW_P (f)) 1345 if (FRAME_WINDOW_P (f))
1163 { 1346 {
1164 if (!w->pseudo_window_p 1347 if (!w->pseudo_window_p
1348 && WINDOW_RIGHT_DIVIDER_WIDTH (w) == 0
1165 && !WINDOW_HAS_VERTICAL_SCROLL_BAR (w) 1349 && !WINDOW_HAS_VERTICAL_SCROLL_BAR (w)
1166 && !WINDOW_RIGHTMOST_P (w) 1350 && !WINDOW_RIGHTMOST_P (w)
1167 && (eabs (x - right_x) < grabbable_width)) 1351 && (eabs (x - right_x) < grabbable_width))
@@ -1170,7 +1354,10 @@ coordinates_in_window (register struct window *w, int x, int y)
1170 /* Need to say "x > right_x" rather than >=, since on character 1354 /* Need to say "x > right_x" rather than >=, since on character
1171 terminals, the vertical line's x coordinate is right_x. */ 1355 terminals, the vertical line's x coordinate is right_x. */
1172 else if (!w->pseudo_window_p 1356 else if (!w->pseudo_window_p
1357 && WINDOW_RIGHT_DIVIDER_WIDTH (w) == 0
1173 && !WINDOW_RIGHTMOST_P (w) 1358 && !WINDOW_RIGHTMOST_P (w)
1359 /* Why check ux if we are not the rightmost window? Also
1360 shouldn't a pseudo window always be rightmost? */
1174 && x > right_x - ux) 1361 && x > right_x - ux)
1175 return ON_VERTICAL_BORDER; 1362 return ON_VERTICAL_BORDER;
1176 1363
@@ -1181,8 +1368,8 @@ coordinates_in_window (register struct window *w, int x, int y)
1181 ? (x >= left_x + WINDOW_LEFT_FRINGE_WIDTH (w)) 1368 ? (x >= left_x + WINDOW_LEFT_FRINGE_WIDTH (w))
1182 : (x < left_x + lmargin_width))) 1369 : (x < left_x + lmargin_width)))
1183 return ON_LEFT_MARGIN; 1370 return ON_LEFT_MARGIN;
1184 1371 else
1185 return ON_LEFT_FRINGE; 1372 return ON_LEFT_FRINGE;
1186 } 1373 }
1187 1374
1188 if (x >= text_right) 1375 if (x >= text_right)
@@ -1192,8 +1379,8 @@ coordinates_in_window (register struct window *w, int x, int y)
1192 ? (x < right_x - WINDOW_RIGHT_FRINGE_WIDTH (w)) 1379 ? (x < right_x - WINDOW_RIGHT_FRINGE_WIDTH (w))
1193 : (x >= right_x - rmargin_width))) 1380 : (x >= right_x - rmargin_width)))
1194 return ON_RIGHT_MARGIN; 1381 return ON_RIGHT_MARGIN;
1195 1382 else
1196 return ON_RIGHT_FRINGE; 1383 return ON_RIGHT_FRINGE;
1197 } 1384 }
1198 1385
1199 /* Everything special ruled out - must be on text area */ 1386 /* Everything special ruled out - must be on text area */
@@ -1212,6 +1399,8 @@ window_relative_x_coord (struct window *w, enum window_part part, int x)
1212 case ON_TEXT: 1399 case ON_TEXT:
1213 return x - window_box_left (w, TEXT_AREA); 1400 return x - window_box_left (w, TEXT_AREA);
1214 1401
1402 case ON_HEADER_LINE:
1403 case ON_MODE_LINE:
1215 case ON_LEFT_FRINGE: 1404 case ON_LEFT_FRINGE:
1216 return x - left_x; 1405 return x - left_x;
1217 1406
@@ -1226,7 +1415,7 @@ window_relative_x_coord (struct window *w, enum window_part part, int x)
1226 case ON_RIGHT_MARGIN: 1415 case ON_RIGHT_MARGIN:
1227 return (x + 1 1416 return (x + 1
1228 - ((w->pseudo_window_p) 1417 - ((w->pseudo_window_p)
1229 ? WINDOW_TOTAL_WIDTH (w) 1418 ? WINDOW_PIXEL_WIDTH (w)
1230 : WINDOW_BOX_RIGHT_EDGE_X (w)) 1419 : WINDOW_BOX_RIGHT_EDGE_X (w))
1231 + window_box_width (w, RIGHT_MARGIN_AREA) 1420 + window_box_width (w, RIGHT_MARGIN_AREA)
1232 + ((WINDOW_HAS_FRINGES_OUTSIDE_MARGINS (w)) 1421 + ((WINDOW_HAS_FRINGES_OUTSIDE_MARGINS (w))
@@ -1248,8 +1437,10 @@ measured in characters from the upper-left corner of the frame.
1248frame. 1437frame.
1249If COORDINATES are in the text portion of WINDOW, 1438If COORDINATES are in the text portion of WINDOW,
1250 the coordinates relative to the window are returned. 1439 the coordinates relative to the window are returned.
1440If they are in the bottom divider of WINDOW, `bottom-divider' is returned.
1441If they are in the right divider of WINDOW, `right-divider' is returned.
1251If they are in the mode line of WINDOW, `mode-line' is returned. 1442If they are in the mode line of WINDOW, `mode-line' is returned.
1252If they are in the top mode line of WINDOW, `header-line' is returned. 1443If they are in the header line of WINDOW, `header-line' is returned.
1253If they are in the left fringe of WINDOW, `left-fringe' is returned. 1444If they are in the left fringe of WINDOW, `left-fringe' is returned.
1254If they are in the right fringe of WINDOW, `right-fringe' is returned. 1445If they are in the right fringe of WINDOW, `right-fringe' is returned.
1255If they are on the border between WINDOW and its right sibling, 1446If they are on the border between WINDOW and its right sibling,
@@ -1311,6 +1502,12 @@ If they are in the windows's left or right marginal areas, `left-margin'\n\
1311 /* Historically we are supposed to return nil in this case. */ 1502 /* Historically we are supposed to return nil in this case. */
1312 return Qnil; 1503 return Qnil;
1313 1504
1505 case ON_RIGHT_DIVIDER:
1506 return Qright_divider;
1507
1508 case ON_BOTTOM_DIVIDER:
1509 return Qbottom_divider;
1510
1314 default: 1511 default:
1315 emacs_abort (); 1512 emacs_abort ();
1316 } 1513 }
@@ -1561,7 +1758,7 @@ Return POS. */)
1561 set_marker_restricted (w->pointm, pos, w->contents); 1758 set_marker_restricted (w->pointm, pos, w->contents);
1562 /* We have to make sure that redisplay updates the window to show 1759 /* We have to make sure that redisplay updates the window to show
1563 the new value of point. */ 1760 the new value of point. */
1564 ++windows_or_buffers_changed; 1761 wset_redisplay (w);
1565 } 1762 }
1566 1763
1567 return pos; 1764 return pos;
@@ -1582,9 +1779,9 @@ overriding motion of point in order to display at this exact start. */)
1582 if (NILP (noforce)) 1779 if (NILP (noforce))
1583 w->force_start = 1; 1780 w->force_start = 1;
1584 w->update_mode_line = 1; 1781 w->update_mode_line = 1;
1585 if (w != XWINDOW (selected_window)) 1782 /* Bug#15957. */
1586 /* Enforce full redisplay. FIXME: make it more selective. */ 1783 w->window_end_valid = 0;
1587 windows_or_buffers_changed++; 1784 wset_redisplay (w);
1588 1785
1589 return pos; 1786 return pos;
1590} 1787}
@@ -2003,6 +2200,10 @@ replace_window (Lisp_Object old, Lisp_Object new, int setflag)
2003 2200
2004 if (setflag) 2201 if (setflag)
2005 { 2202 {
2203 n->pixel_left = o->pixel_left;
2204 n->pixel_top = o->pixel_top;
2205 n->pixel_width = o->pixel_width;
2206 n->pixel_height = o->pixel_height;
2006 n->left_col = o->left_col; 2207 n->left_col = o->left_col;
2007 n->top_line = o->top_line; 2208 n->top_line = o->top_line;
2008 n->total_cols = o->total_cols; 2209 n->total_cols = o->total_cols;
@@ -2016,8 +2217,10 @@ replace_window (Lisp_Object old, Lisp_Object new, int setflag)
2016 memset (&n->cursor, 0, sizeof (n->cursor)); 2217 memset (&n->cursor, 0, sizeof (n->cursor));
2017 memset (&n->phys_cursor, 0, sizeof (n->phys_cursor)); 2218 memset (&n->phys_cursor, 0, sizeof (n->phys_cursor));
2018 n->last_cursor_vpos = 0; 2219 n->last_cursor_vpos = 0;
2019 n->phys_cursor_type = -1; 2220#ifdef HAVE_WINDOW_SYSTEM
2221 n->phys_cursor_type = NO_CURSOR;
2020 n->phys_cursor_width = -1; 2222 n->phys_cursor_width = -1;
2223#endif
2021 n->must_be_updated_p = 0; 2224 n->must_be_updated_p = 0;
2022 n->pseudo_window_p = 0; 2225 n->pseudo_window_p = 0;
2023 n->window_end_vpos = 0; 2226 n->window_end_vpos = 0;
@@ -2081,13 +2284,13 @@ recombine_windows (Lisp_Object window)
2081 wset_parent (c, parent); 2284 wset_parent (c, parent);
2082 2285
2083 if (horflag) 2286 if (horflag)
2084 wset_normal_cols (c, 2287 wset_normal_cols
2085 make_float ((double) c->total_cols 2288 (c, make_float ((double) c->pixel_width
2086 / (double) p->total_cols)); 2289 / (double) p->pixel_width));
2087 else 2290 else
2088 wset_normal_lines (c, 2291 wset_normal_lines
2089 make_float ((double) c->total_lines 2292 (c, make_float ((double) c->pixel_height
2090 / (double) p->total_lines)); 2293 / (double) p->pixel_height));
2091 2294
2092 if (NILP (c->next)) 2295 if (NILP (c->next))
2093 { 2296 {
@@ -2143,7 +2346,7 @@ add_window_to_list (struct window *w, void *user_data)
2143 Vwindow_list is a list, return that list. Otherwise, build a new 2346 Vwindow_list is a list, return that list. Otherwise, build a new
2144 list, cache it in Vwindow_list, and return that. */ 2347 list, cache it in Vwindow_list, and return that. */
2145 2348
2146static Lisp_Object 2349Lisp_Object
2147window_list (void) 2350window_list (void)
2148{ 2351{
2149 if (!CONSP (Vwindow_list)) 2352 if (!CONSP (Vwindow_list))
@@ -2645,7 +2848,7 @@ window_loop (enum window_loop type, Lisp_Object obj, int mini, Lisp_Object frame
2645 mark_window_display_accurate (window, 0); 2848 mark_window_display_accurate (window, 0);
2646 w->update_mode_line = 1; 2849 w->update_mode_line = 1;
2647 XBUFFER (obj)->prevent_redisplay_optimizations_p = 1; 2850 XBUFFER (obj)->prevent_redisplay_optimizations_p = 1;
2648 ++update_mode_lines; 2851 update_mode_lines = 27;
2649 best_window = window; 2852 best_window = window;
2650 } 2853 }
2651 break; 2854 break;
@@ -2718,9 +2921,16 @@ selected frame and no others. */)
2718} 2921}
2719 2922
2720static Lisp_Object 2923static Lisp_Object
2721resize_root_window (Lisp_Object window, Lisp_Object delta, Lisp_Object horizontal, Lisp_Object ignore) 2924resize_root_window (Lisp_Object window, Lisp_Object delta, Lisp_Object horizontal, Lisp_Object ignore, Lisp_Object pixelwise)
2925{
2926 return call5 (Qwindow_resize_root_window, window, delta, horizontal, ignore, pixelwise);
2927}
2928
2929
2930static Lisp_Object
2931window_pixel_to_total (Lisp_Object frame, Lisp_Object horizontal)
2722{ 2932{
2723 return call4 (Qwindow_resize_root_window, window, delta, horizontal, ignore); 2933 return call2(Qwindow_pixel_to_total, frame, horizontal);
2724} 2934}
2725 2935
2726 2936
@@ -2784,8 +2994,8 @@ window-start value is reasonable when this function is called. */)
2784 { 2994 {
2785 startpos = marker_position (w->start); 2995 startpos = marker_position (w->start);
2786 startbyte = marker_byte_position (w->start); 2996 startbyte = marker_byte_position (w->start);
2787 top = WINDOW_TOP_EDGE_LINE (w) 2997 top = (WINDOW_TOP_EDGE_LINE (w)
2788 - FRAME_TOP_MARGIN (XFRAME (WINDOW_FRAME (w))); 2998 - FRAME_TOP_MARGIN (XFRAME (WINDOW_FRAME (w))));
2789 /* Make sure WINDOW is the frame's selected window. */ 2999 /* Make sure WINDOW is the frame's selected window. */
2790 if (!EQ (window, FRAME_SELECTED_WINDOW (f))) 3000 if (!EQ (window, FRAME_SELECTED_WINDOW (f)))
2791 { 3001 {
@@ -2843,7 +3053,7 @@ window-start value is reasonable when this function is called. */)
2843 } 3053 }
2844 free_window_matrices (r); 3054 free_window_matrices (r);
2845 3055
2846 windows_or_buffers_changed++; 3056 fset_redisplay (f);
2847 Vwindow_list = Qnil; 3057 Vwindow_list = Qnil;
2848 FRAME_WINDOW_SIZES_CHANGED (f) = 1; 3058 FRAME_WINDOW_SIZES_CHANGED (f) = 1;
2849 resize_failed = 0; 3059 resize_failed = 0;
@@ -2851,16 +3061,23 @@ window-start value is reasonable when this function is called. */)
2851 if (!WINDOW_LEAF_P (w)) 3061 if (!WINDOW_LEAF_P (w))
2852 { 3062 {
2853 /* Resize child windows vertically. */ 3063 /* Resize child windows vertically. */
2854 XSETINT (delta, r->total_lines - w->total_lines); 3064 XSETINT (delta, r->pixel_height - w->pixel_height);
3065 w->pixel_top = r->pixel_top;
2855 w->top_line = r->top_line; 3066 w->top_line = r->top_line;
2856 resize_root_window (window, delta, Qnil, Qnil); 3067 resize_root_window (window, delta, Qnil, Qnil, Qt);
2857 if (window_resize_check (w, 0)) 3068 if (window_resize_check (w, 0))
2858 window_resize_apply (w, 0); 3069 {
3070 window_resize_apply (w, 0);
3071 window_pixel_to_total (w->frame, Qnil);
3072 }
2859 else 3073 else
2860 { 3074 {
2861 resize_root_window (window, delta, Qnil, Qt); 3075 resize_root_window (window, delta, Qnil, Qt, Qt);
2862 if (window_resize_check (w, 0)) 3076 if (window_resize_check (w, 0))
2863 window_resize_apply (w, 0); 3077 {
3078 window_resize_apply (w, 0);
3079 window_pixel_to_total (w->frame, Qnil);
3080 }
2864 else 3081 else
2865 resize_failed = 1; 3082 resize_failed = 1;
2866 } 3083 }
@@ -2869,15 +3086,22 @@ window-start value is reasonable when this function is called. */)
2869 if (!resize_failed) 3086 if (!resize_failed)
2870 { 3087 {
2871 w->left_col = r->left_col; 3088 w->left_col = r->left_col;
2872 XSETINT (delta, r->total_cols - w->total_cols); 3089 w->pixel_left = r->pixel_left;
2873 resize_root_window (window, delta, Qt, Qnil); 3090 XSETINT (delta, r->pixel_width - w->pixel_width);
3091 resize_root_window (window, delta, Qt, Qnil, Qt);
2874 if (window_resize_check (w, 1)) 3092 if (window_resize_check (w, 1))
2875 window_resize_apply (w, 1); 3093 {
3094 window_resize_apply (w, 1);
3095 window_pixel_to_total (w->frame, Qt);
3096 }
2876 else 3097 else
2877 { 3098 {
2878 resize_root_window (window, delta, Qt, Qt); 3099 resize_root_window (window, delta, Qt, Qt, Qt);
2879 if (window_resize_check (w, 1)) 3100 if (window_resize_check (w, 1))
2880 window_resize_apply (w, 1); 3101 {
3102 window_resize_apply (w, 1);
3103 window_pixel_to_total (w->frame, Qt);
3104 }
2881 else 3105 else
2882 resize_failed = 1; 3106 resize_failed = 1;
2883 } 3107 }
@@ -2986,27 +3210,47 @@ replace_buffer_in_windows_safely (Lisp_Object buffer)
2986 } 3210 }
2987} 3211}
2988 3212
2989/* If *ROWS or *COLS are too small a size for FRAME, set them to the 3213/* If *HEIGHT or *WIDTH are too small a size for FRAME, set them to the
2990 minimum allowable size. */ 3214 minimum allowable size. PIXELWISE means interpret these as pixel
3215 sizes. */
2991 3216
2992void 3217void
2993check_frame_size (struct frame *frame, int *rows, int *cols) 3218check_frame_size (struct frame *frame, int *width, int *height, bool pixelwise)
2994{ 3219{
2995 /* For height, we have to see: 3220 /* For height, we have to see:
2996 how many windows the frame has at minimum (one or two), 3221 how many windows the frame has at minimum (one or two),
2997 and whether it has a menu bar or other special stuff at the top. */ 3222 and whether it has a menu bar or other special stuff at the top. */
2998 int min_height 3223 if (pixelwise)
2999 = ((FRAME_MINIBUF_ONLY_P (frame) || ! FRAME_HAS_MINIBUF_P (frame)) 3224 {
3000 ? MIN_SAFE_WINDOW_HEIGHT 3225 int min_height = MIN_SAFE_WINDOW_HEIGHT * FRAME_LINE_HEIGHT (frame);
3001 : 2 * MIN_SAFE_WINDOW_HEIGHT); 3226 int min_width = MIN_SAFE_WINDOW_WIDTH * FRAME_COLUMN_WIDTH (frame);
3002 3227
3003 if (FRAME_TOP_MARGIN (frame) > 0) 3228 if (!FRAME_MINIBUF_ONLY_P (frame) && FRAME_HAS_MINIBUF_P (frame))
3004 min_height += FRAME_TOP_MARGIN (frame); 3229 min_height = 2 * min_height;
3005 3230
3006 if (*rows < min_height) 3231 min_height += FRAME_TOP_MARGIN_HEIGHT (frame);
3007 *rows = min_height; 3232 min_height += FRAME_INTERNAL_BORDER_WIDTH (frame);
3008 if (*cols < MIN_SAFE_WINDOW_WIDTH) 3233
3009 *cols = MIN_SAFE_WINDOW_WIDTH; 3234 if (*height < min_height)
3235 *height = min_height;
3236 if (*width < min_width)
3237 *width = min_width;
3238 }
3239 else
3240 {
3241 int min_height
3242 = ((FRAME_MINIBUF_ONLY_P (frame) || ! FRAME_HAS_MINIBUF_P (frame))
3243 ? MIN_SAFE_WINDOW_HEIGHT
3244 : 2 * MIN_SAFE_WINDOW_HEIGHT);
3245
3246 if (FRAME_TOP_MARGIN (frame) > 0)
3247 min_height += FRAME_TOP_MARGIN (frame);
3248
3249 if (*height < min_height)
3250 *height = min_height;
3251 if (*width < MIN_SAFE_WINDOW_WIDTH)
3252 *width = MIN_SAFE_WINDOW_WIDTH;
3253 }
3010} 3254}
3011 3255
3012/* Adjust the margins of window W if text area is too small. 3256/* Adjust the margins of window W if text area is too small.
@@ -3016,31 +3260,37 @@ check_frame_size (struct frame *frame, int *rows, int *cols)
3016static int 3260static int
3017adjust_window_margins (struct window *w) 3261adjust_window_margins (struct window *w)
3018{ 3262{
3019 int box_cols = (WINDOW_TOTAL_COLS (w) 3263 int box_width = (WINDOW_PIXEL_WIDTH (w)
3020 - WINDOW_FRINGE_COLS (w) 3264 - WINDOW_FRINGES_WIDTH (w)
3021 - WINDOW_SCROLL_BAR_COLS (w)); 3265 - WINDOW_SCROLL_BAR_AREA_WIDTH (w));
3022 int margin_cols = (WINDOW_LEFT_MARGIN_COLS (w) 3266 int margin_width = WINDOW_MARGINS_WIDTH (w);
3023 + WINDOW_RIGHT_MARGIN_COLS (w));
3024 3267
3025 if (box_cols - margin_cols >= MIN_SAFE_WINDOW_WIDTH) 3268 if (box_width - margin_width >= MIN_SAFE_WINDOW_PIXEL_WIDTH (w))
3026 return 1; 3269 return 1;
3027 3270
3028 if (margin_cols < 0 || box_cols < MIN_SAFE_WINDOW_WIDTH) 3271 if (margin_width < 0 || box_width < MIN_SAFE_WINDOW_PIXEL_WIDTH (w))
3029 return 0; 3272 return 0;
3030 3273 else
3031 /* Window's text area is too narrow, but reducing the window 3274 /* Window's text area is too narrow, but reducing the window
3032 margins will fix that. */ 3275 margins will fix that. */
3033 margin_cols = box_cols - MIN_SAFE_WINDOW_WIDTH;
3034 if (WINDOW_RIGHT_MARGIN_COLS (w) > 0)
3035 { 3276 {
3036 if (WINDOW_LEFT_MARGIN_COLS (w) > 0) 3277 int unit = WINDOW_FRAME_COLUMN_WIDTH (w);
3037 w->left_margin_cols = w->right_margin_cols = margin_cols / 2; 3278
3279 margin_width = box_width - MIN_SAFE_WINDOW_PIXEL_WIDTH (w);
3280
3281 if (WINDOW_RIGHT_MARGIN_WIDTH (w) > 0)
3282 {
3283 if (WINDOW_LEFT_MARGIN_WIDTH (w) > 0)
3284 w->left_margin_cols = w->right_margin_cols =
3285 margin_width / (2 * unit);
3286 else
3287 w->right_margin_cols = margin_width / unit;
3288 }
3038 else 3289 else
3039 w->right_margin_cols = margin_cols; 3290 w->left_margin_cols = margin_width / unit;
3291
3292 return 1;
3040 } 3293 }
3041 else
3042 w->left_margin_cols = margin_cols;
3043 return 1;
3044} 3294}
3045 3295
3046/* The following three routines are needed for running a window's 3296/* The following three routines are needed for running a window's
@@ -3125,11 +3375,23 @@ If FRAME is omitted or nil, it defaults to the selected frame. */)
3125 return Qnil; 3375 return Qnil;
3126} 3376}
3127 3377
3128/* Make WINDOW display BUFFER as its contents. RUN_HOOKS_P non-zero 3378DEFUN ("run-window-scroll-functions", Frun_window_scroll_functions,
3129 means it's allowed to run hooks. See make_frame for a case where 3379 Srun_window_scroll_functions, 0, 1, 0,
3130 it's not allowed. KEEP_MARGINS_P non-zero means that the current 3380 doc: /* Run `window-scroll-functions' for WINDOW.
3131 margins, fringes, and scroll-bar settings of the window are not 3381If WINDOW is omitted or nil, it defaults to the selected window. */)
3132 reset from the buffer's local settings. */ 3382 (Lisp_Object window)
3383{
3384 if (! NILP (Vwindow_scroll_functions))
3385 run_hook_with_args_2 (Qwindow_scroll_functions, window,
3386 Fmarker_position (decode_live_window (window)->start));
3387 return Qnil;
3388}
3389
3390/* Make WINDOW display BUFFER. RUN_HOOKS_P non-zero means it's allowed
3391 to run hooks. See make_frame for a case where it's not allowed.
3392 KEEP_MARGINS_P non-zero means that the current margins, fringes, and
3393 scroll-bar settings of the window are not reset from the buffer's
3394 local settings. */
3133 3395
3134void 3396void
3135set_window_buffer (Lisp_Object window, Lisp_Object buffer, 3397set_window_buffer (Lisp_Object window, Lisp_Object buffer,
@@ -3138,7 +3400,7 @@ set_window_buffer (Lisp_Object window, Lisp_Object buffer,
3138 struct window *w = XWINDOW (window); 3400 struct window *w = XWINDOW (window);
3139 struct buffer *b = XBUFFER (buffer); 3401 struct buffer *b = XBUFFER (buffer);
3140 ptrdiff_t count = SPECPDL_INDEX (); 3402 ptrdiff_t count = SPECPDL_INDEX ();
3141 int samebuf = EQ (buffer, w->contents); 3403 bool samebuf = EQ (buffer, w->contents);
3142 3404
3143 wset_buffer (w, buffer); 3405 wset_buffer (w, buffer);
3144 3406
@@ -3177,16 +3439,13 @@ set_window_buffer (Lisp_Object window, Lisp_Object buffer,
3177 } 3439 }
3178 /* Maybe we could move this into the `if' but it's not obviously safe and 3440 /* Maybe we could move this into the `if' but it's not obviously safe and
3179 I doubt it's worth the trouble. */ 3441 I doubt it's worth the trouble. */
3180 windows_or_buffers_changed++; 3442 wset_redisplay (w);
3443 w->update_mode_line = true;
3181 3444
3182 /* We must select BUFFER for running the window-scroll-functions. */ 3445 /* We must select BUFFER to run the window-scroll-functions and to look up
3183 /* We can't check ! NILP (Vwindow_scroll_functions) here 3446 the buffer-local value of Vwindow_point_insertion_type. */
3184 because that might itself be a local variable. */ 3447 record_unwind_current_buffer ();
3185 if (window_initialized) 3448 Fset_buffer (buffer);
3186 {
3187 record_unwind_current_buffer ();
3188 Fset_buffer (buffer);
3189 }
3190 3449
3191 XMARKER (w->pointm)->insertion_type = !NILP (Vwindow_point_insertion_type); 3450 XMARKER (w->pointm)->insertion_type = !NILP (Vwindow_point_insertion_type);
3192 3451
@@ -3208,14 +3467,15 @@ set_window_buffer (Lisp_Object window, Lisp_Object buffer,
3208 if (! NILP (Vwindow_scroll_functions)) 3467 if (! NILP (Vwindow_scroll_functions))
3209 run_hook_with_args_2 (Qwindow_scroll_functions, window, 3468 run_hook_with_args_2 (Qwindow_scroll_functions, window,
3210 Fmarker_position (w->start)); 3469 Fmarker_position (w->start));
3211 run_window_configuration_change_hook (XFRAME (WINDOW_FRAME (w))); 3470 if (!samebuf)
3471 run_window_configuration_change_hook (XFRAME (WINDOW_FRAME (w)));
3212 } 3472 }
3213 3473
3214 unbind_to (count, Qnil); 3474 unbind_to (count, Qnil);
3215} 3475}
3216 3476
3217DEFUN ("set-window-buffer", Fset_window_buffer, Sset_window_buffer, 2, 3, 0, 3477DEFUN ("set-window-buffer", Fset_window_buffer, Sset_window_buffer, 2, 3, 0,
3218 doc: /* Make WINDOW display BUFFER-OR-NAME as its contents. 3478 doc: /* Make WINDOW display BUFFER-OR-NAME.
3219WINDOW must be a live window and defaults to the selected one. 3479WINDOW must be a live window and defaults to the selected one.
3220BUFFER-OR-NAME must be a buffer or the name of an existing buffer. 3480BUFFER-OR-NAME must be a buffer or the name of an existing buffer.
3221 3481
@@ -3284,8 +3544,8 @@ displaying that buffer. */)
3284{ 3544{
3285 if (NILP (object)) 3545 if (NILP (object))
3286 { 3546 {
3287 windows_or_buffers_changed++; 3547 windows_or_buffers_changed = 29;
3288 update_mode_lines++; 3548 update_mode_lines = 28;
3289 return Qt; 3549 return Qt;
3290 } 3550 }
3291 3551
@@ -3296,7 +3556,7 @@ displaying that buffer. */)
3296 w->update_mode_line = 1; 3556 w->update_mode_line = 1;
3297 if (BUFFERP (w->contents)) 3557 if (BUFFERP (w->contents))
3298 XBUFFER (w->contents)->prevent_redisplay_optimizations_p = 1; 3558 XBUFFER (w->contents)->prevent_redisplay_optimizations_p = 1;
3299 ++update_mode_lines; 3559 update_mode_lines = 29;
3300 return Qt; 3560 return Qt;
3301 } 3561 }
3302 3562
@@ -3387,6 +3647,8 @@ make_parent_window (Lisp_Object window, bool horflag)
3387 adjust_window_count (p, 1); 3647 adjust_window_count (p, 1);
3388 XSETWINDOW (parent, p); 3648 XSETWINDOW (parent, p);
3389 3649
3650 p->sequence_number = ++sequence_number;
3651
3390 replace_window (window, parent, 1); 3652 replace_window (window, parent, 1);
3391 3653
3392 wset_next (o, Qnil); 3654 wset_next (o, Qnil);
@@ -3415,6 +3677,7 @@ make_window (void)
3415 wset_normal_cols (w, make_float (1.0)); 3677 wset_normal_cols (w, make_float (1.0));
3416 wset_new_total (w, make_number (0)); 3678 wset_new_total (w, make_number (0));
3417 wset_new_normal (w, make_number (0)); 3679 wset_new_normal (w, make_number (0));
3680 wset_new_pixel (w, make_number (0));
3418 wset_start (w, Fmake_marker ()); 3681 wset_start (w, Fmake_marker ());
3419 wset_pointm (w, Fmake_marker ()); 3682 wset_pointm (w, Fmake_marker ());
3420 wset_vertical_scroll_bar_type (w, Qt); 3683 wset_vertical_scroll_bar_type (w, Qt);
@@ -3428,8 +3691,11 @@ make_window (void)
3428 w->nrows_scale_factor = w->ncols_scale_factor = 1; 3691 w->nrows_scale_factor = w->ncols_scale_factor = 1;
3429 w->left_fringe_width = w->right_fringe_width = -1; 3692 w->left_fringe_width = w->right_fringe_width = -1;
3430 w->mode_line_height = w->header_line_height = -1; 3693 w->mode_line_height = w->header_line_height = -1;
3431 w->phys_cursor_type = -1; 3694#ifdef HAVE_WINDOW_SYSTEM
3695 w->phys_cursor_type = NO_CURSOR;
3432 w->phys_cursor_width = -1; 3696 w->phys_cursor_width = -1;
3697#endif
3698 w->sequence_number = ++sequence_number;
3433 w->scroll_bar_width = -1; 3699 w->scroll_bar_width = -1;
3434 w->column_number_displayed = -1; 3700 w->column_number_displayed = -1;
3435 3701
@@ -3440,6 +3706,30 @@ make_window (void)
3440 return window; 3706 return window;
3441} 3707}
3442 3708
3709DEFUN ("set-window-new-pixel", Fset_window_new_pixel, Sset_window_new_pixel, 2, 3, 0,
3710 doc: /* Set new pixel size of WINDOW to SIZE.
3711WINDOW must be a valid window and defaults to the selected one.
3712Return SIZE.
3713
3714Optional argument ADD non-nil means add SIZE to the new pixel size of
3715WINDOW and return the sum.
3716
3717Note: This function does not operate on any child windows of WINDOW. */)
3718 (Lisp_Object window, Lisp_Object size, Lisp_Object add)
3719{
3720 struct window *w = decode_valid_window (window);
3721 EMACS_INT size_min = NILP (add) ? 0 : - XINT (w->new_pixel);
3722 EMACS_INT size_max = size_min + min (INT_MAX, MOST_POSITIVE_FIXNUM);
3723
3724 CHECK_RANGED_INTEGER (size, size_min, size_max);
3725 if (NILP (add))
3726 wset_new_pixel (w, size);
3727 else
3728 wset_new_pixel (w, make_number (XINT (w->new_pixel) + XINT (size)));
3729
3730 return w->new_pixel;
3731}
3732
3443DEFUN ("set-window-new-total", Fset_window_new_total, Sset_window_new_total, 2, 3, 0, 3733DEFUN ("set-window-new-total", Fset_window_new_total, Sset_window_new_total, 2, 3, 0,
3444 doc: /* Set new total size of WINDOW to SIZE. 3734 doc: /* Set new total size of WINDOW to SIZE.
3445WINDOW must be a valid window and defaults to the selected one. 3735WINDOW must be a valid window and defaults to the selected one.
@@ -3474,8 +3764,8 @@ Note: This function does not operate on any child windows of WINDOW. */)
3474 return size; 3764 return size;
3475} 3765}
3476 3766
3477/* Return 1 if setting w->total_lines (w->total_cols if HORFLAG is 3767/* Return 1 if setting w->pixel_height (w->pixel_width if HORFLAG is
3478 non-zero) to w->new_total would result in correct heights (widths) 3768 non-zero) to w->new_pixel would result in correct heights (widths)
3479 for window W and recursively all child windows of W. 3769 for window W and recursively all child windows of W.
3480 3770
3481 Note: This function does not check any of `window-fixed-size-p', 3771 Note: This function does not check any of `window-fixed-size-p',
@@ -3484,6 +3774,7 @@ Note: This function does not operate on any child windows of WINDOW. */)
3484static int 3774static int
3485window_resize_check (struct window *w, bool horflag) 3775window_resize_check (struct window *w, bool horflag)
3486{ 3776{
3777 struct frame *f = XFRAME (w->frame);
3487 struct window *c; 3778 struct window *c;
3488 3779
3489 if (WINDOW_VERTICAL_COMBINATION_P (w)) 3780 if (WINDOW_VERTICAL_COMBINATION_P (w))
@@ -3495,26 +3786,33 @@ window_resize_check (struct window *w, bool horflag)
3495 { 3786 {
3496 while (c) 3787 while (c)
3497 { 3788 {
3498 if ((XINT (c->new_total) != XINT (w->new_total)) 3789 if (XINT (c->new_pixel) != XINT (w->new_pixel)
3499 || !window_resize_check (c, horflag)) 3790 || !window_resize_check (c, horflag))
3500 return 0; 3791 return 0;
3792
3501 c = NILP (c->next) ? 0 : XWINDOW (c->next); 3793 c = NILP (c->next) ? 0 : XWINDOW (c->next);
3502 } 3794 }
3795
3503 return 1; 3796 return 1;
3504 } 3797 }
3505 else 3798 else
3506 /* The sum of the heights of the child windows of W must equal 3799 /* The sum of the heights of the child windows of W must equal
3507 W's height. */ 3800 W's height. */
3508 { 3801 {
3509 int sum_of_sizes = 0; 3802 int remaining_pixels = XINT (w->new_pixel);
3803
3510 while (c) 3804 while (c)
3511 { 3805 {
3512 if (!window_resize_check (c, horflag)) 3806 if (!window_resize_check (c, horflag))
3513 return 0; 3807 return 0;
3514 sum_of_sizes = sum_of_sizes + XINT (c->new_total); 3808
3809 remaining_pixels -= XINT (c->new_pixel);
3810 if (remaining_pixels < 0)
3811 return 0;
3515 c = NILP (c->next) ? 0 : XWINDOW (c->next); 3812 c = NILP (c->next) ? 0 : XWINDOW (c->next);
3516 } 3813 }
3517 return (sum_of_sizes == XINT (w->new_total)); 3814
3815 return remaining_pixels == 0;
3518 } 3816 }
3519 } 3817 }
3520 else if (WINDOW_HORIZONTAL_COMBINATION_P (w)) 3818 else if (WINDOW_HORIZONTAL_COMBINATION_P (w))
@@ -3525,26 +3823,33 @@ window_resize_check (struct window *w, bool horflag)
3525 /* The sum of the widths of the child windows of W must equal W's 3823 /* The sum of the widths of the child windows of W must equal W's
3526 width. */ 3824 width. */
3527 { 3825 {
3528 int sum_of_sizes = 0; 3826 int remaining_pixels = XINT (w->new_pixel);
3827
3529 while (c) 3828 while (c)
3530 { 3829 {
3531 if (!window_resize_check (c, horflag)) 3830 if (!window_resize_check (c, horflag))
3532 return 0; 3831 return 0;
3533 sum_of_sizes = sum_of_sizes + XINT (c->new_total); 3832
3833 remaining_pixels -= XINT (c->new_pixel);
3834 if (remaining_pixels < 0)
3835 return 0;
3534 c = NILP (c->next) ? 0 : XWINDOW (c->next); 3836 c = NILP (c->next) ? 0 : XWINDOW (c->next);
3535 } 3837 }
3536 return (sum_of_sizes == XINT (w->new_total)); 3838
3839 return remaining_pixels == 0;
3537 } 3840 }
3538 else 3841 else
3539 /* All child windows of W must have the same height as W. */ 3842 /* All child windows of W must have the same height as W. */
3540 { 3843 {
3541 while (c) 3844 while (c)
3542 { 3845 {
3543 if ((XINT (c->new_total) != XINT (w->new_total)) 3846 if (XINT (c->new_pixel) != XINT (w->new_pixel)
3544 || !window_resize_check (c, horflag)) 3847 || !window_resize_check (c, horflag))
3545 return 0; 3848 return 0;
3849
3546 c = NILP (c->next) ? 0 : XWINDOW (c->next); 3850 c = NILP (c->next) ? 0 : XWINDOW (c->next);
3547 } 3851 }
3852
3548 return 1; 3853 return 1;
3549 } 3854 }
3550 } 3855 }
@@ -3552,12 +3857,15 @@ window_resize_check (struct window *w, bool horflag)
3552 /* A leaf window. Make sure it's not too small. The following 3857 /* A leaf window. Make sure it's not too small. The following
3553 hardcodes the values of `window-safe-min-width' (2) and 3858 hardcodes the values of `window-safe-min-width' (2) and
3554 `window-safe-min-height' (1) which are defined in window.el. */ 3859 `window-safe-min-height' (1) which are defined in window.el. */
3555 return XINT (w->new_total) >= (horflag ? 2 : 1); 3860 return (XINT (w->new_pixel) >= (horflag
3861 ? (2 * FRAME_COLUMN_WIDTH (f))
3862 : FRAME_LINE_HEIGHT (f)));
3556} 3863}
3557 3864
3558/* Set w->total_lines (w->total_cols if HORIZONTAL is non-zero) to 3865
3559 w->new_total for window W and recursively all child windows of W. 3866/* Set w->pixel_height (w->pixel_height if HORIZONTAL is non-zero) to
3560 Also calculate and assign the new vertical (horizontal) start 3867 w->new_pixel for window W and recursively all child windows of W.
3868 Also calculate and assign the new vertical (horizontal) pixel start
3561 positions of each of these windows. 3869 positions of each of these windows.
3562 3870
3563 This function does not perform any error checks. Make sure you have 3871 This function does not perform any error checks. Make sure you have
@@ -3566,25 +3874,30 @@ static void
3566window_resize_apply (struct window *w, bool horflag) 3874window_resize_apply (struct window *w, bool horflag)
3567{ 3875{
3568 struct window *c; 3876 struct window *c;
3569 int pos; 3877 int edge;
3878 int unit = (horflag
3879 ? FRAME_COLUMN_WIDTH (WINDOW_XFRAME (w))
3880 : FRAME_LINE_HEIGHT (WINDOW_XFRAME (w)));
3570 3881
3571 /* Note: Assigning new_normal requires that the new total size of the 3882 /* Note: Assigning new_normal requires that the new total size of the
3572 parent window has been set *before*. */ 3883 parent window has been set *before*. */
3573 if (horflag) 3884 if (horflag)
3574 { 3885 {
3575 w->total_cols = XFASTINT (w->new_total); 3886 w->pixel_width = XFASTINT (w->new_pixel);
3887 w->total_cols = w->pixel_width / unit;
3576 if (NUMBERP (w->new_normal)) 3888 if (NUMBERP (w->new_normal))
3577 wset_normal_cols (w, w->new_normal); 3889 wset_normal_cols (w, w->new_normal);
3578 3890
3579 pos = w->left_col; 3891 edge = w->pixel_left;
3580 } 3892 }
3581 else 3893 else
3582 { 3894 {
3583 w->total_lines = XFASTINT (w->new_total); 3895 w->pixel_height = XFASTINT (w->new_pixel);
3896 w->total_lines = w->pixel_height / unit;
3584 if (NUMBERP (w->new_normal)) 3897 if (NUMBERP (w->new_normal))
3585 wset_normal_lines (w, w->new_normal); 3898 wset_normal_lines (w, w->new_normal);
3586 3899
3587 pos = w->top_line; 3900 edge = w->pixel_top;
3588 } 3901 }
3589 3902
3590 if (WINDOW_VERTICAL_COMBINATION_P (w)) 3903 if (WINDOW_VERTICAL_COMBINATION_P (w))
@@ -3594,12 +3907,19 @@ window_resize_apply (struct window *w, bool horflag)
3594 while (c) 3907 while (c)
3595 { 3908 {
3596 if (horflag) 3909 if (horflag)
3597 c->left_col = pos; 3910 {
3911 c->pixel_left = edge;
3912 c->left_col = edge / unit;
3913 }
3598 else 3914 else
3599 c->top_line = pos; 3915 {
3916 c->pixel_top = edge;
3917 c->top_line = edge / unit;
3918 }
3600 window_resize_apply (c, horflag); 3919 window_resize_apply (c, horflag);
3601 if (!horflag) 3920 if (!horflag)
3602 pos = pos + c->total_lines; 3921 edge = edge + c->pixel_height;
3922
3603 c = NILP (c->next) ? 0 : XWINDOW (c->next); 3923 c = NILP (c->next) ? 0 : XWINDOW (c->next);
3604 } 3924 }
3605 } 3925 }
@@ -3610,18 +3930,93 @@ window_resize_apply (struct window *w, bool horflag)
3610 while (c) 3930 while (c)
3611 { 3931 {
3612 if (horflag) 3932 if (horflag)
3613 c->left_col = pos; 3933 {
3934 c->pixel_left = edge;
3935 c->left_col = edge / unit;
3936 }
3614 else 3937 else
3615 c->top_line = pos; 3938 {
3939 c->pixel_top = edge;
3940 c->top_line = edge / unit;
3941 }
3942
3616 window_resize_apply (c, horflag); 3943 window_resize_apply (c, horflag);
3617 if (horflag) 3944 if (horflag)
3618 pos = pos + c->total_cols; 3945 edge = edge + c->pixel_width;
3946
3619 c = NILP (c->next) ? 0 : XWINDOW (c->next); 3947 c = NILP (c->next) ? 0 : XWINDOW (c->next);
3620 } 3948 }
3621 } 3949 }
3950 else
3951 {
3952 adjust_window_margins (w);
3953 /* Bug#15957. */
3954 w->window_end_valid = 0;
3955 }
3622} 3956}
3623 3957
3624 3958
3959/* Set w->total_lines (w->total_cols if HORIZONTAL is non-zero) to
3960 w->new_total for window W and recursively all child windows of W.
3961 Also calculate and assign the new vertical (horizontal) start
3962 positions of each of these windows. */
3963static void
3964window_resize_apply_total (struct window *w, bool horflag)
3965{
3966 struct window *c;
3967 int edge;
3968
3969 /* Note: Assigning new_normal requires that the new total size of the
3970 parent window has been set *before*. */
3971 if (horflag)
3972 {
3973 w->total_cols = XFASTINT (w->new_total);
3974 edge = w->left_col;
3975 }
3976 else
3977 {
3978 w->total_lines = XFASTINT (w->new_total);
3979 edge = w->top_line;
3980 }
3981
3982 if (WINDOW_VERTICAL_COMBINATION_P (w))
3983 /* W is a vertical combination. */
3984 {
3985 c = XWINDOW (w->contents);
3986 while (c)
3987 {
3988 if (horflag)
3989 c->left_col = edge;
3990 else
3991 c->top_line = edge;
3992
3993 window_resize_apply_total (c, horflag);
3994 if (!horflag)
3995 edge = edge + c->total_lines;
3996
3997 c = NILP (c->next) ? 0 : XWINDOW (c->next);
3998 }
3999 }
4000 else if (WINDOW_HORIZONTAL_COMBINATION_P (w))
4001 /* W is a horizontal combination. */
4002 {
4003 c = XWINDOW (w->contents);
4004 while (c)
4005 {
4006 if (horflag)
4007 c->left_col = edge;
4008 else
4009 c->top_line = edge;
4010
4011 window_resize_apply_total (c, horflag);
4012 if (horflag)
4013 edge = edge + c->total_cols;
4014
4015 c = NILP (c->next) ? 0 : XWINDOW (c->next);
4016 }
4017 }
4018}
4019
3625DEFUN ("window-resize-apply", Fwindow_resize_apply, Swindow_resize_apply, 0, 2, 0, 4020DEFUN ("window-resize-apply", Fwindow_resize_apply, Swindow_resize_apply, 0, 2, 0,
3626 doc: /* Apply requested size values for window-tree of FRAME. 4021 doc: /* Apply requested size values for window-tree of FRAME.
3627If FRAME is omitted or nil, it defaults to the selected frame. 4022If FRAME is omitted or nil, it defaults to the selected frame.
@@ -3643,20 +4038,58 @@ be applied on the Elisp level. */)
3643 bool horflag = !NILP (horizontal); 4038 bool horflag = !NILP (horizontal);
3644 4039
3645 if (!window_resize_check (r, horflag) 4040 if (!window_resize_check (r, horflag)
3646 || (XINT (r->new_total) 4041 || (XINT (r->new_pixel)
3647 != (horflag ? r->total_cols : r->total_lines))) 4042 != (horflag ? r->pixel_width : r->pixel_height)))
3648 return Qnil; 4043 return Qnil;
3649 4044
3650 block_input (); 4045 block_input ();
3651 window_resize_apply (r, horflag); 4046 window_resize_apply (r, horflag);
3652 4047
3653 windows_or_buffers_changed++; 4048 fset_redisplay (f);
3654 FRAME_WINDOW_SIZES_CHANGED (f) = 1; 4049 FRAME_WINDOW_SIZES_CHANGED (f) = 1;
3655 4050
3656 adjust_frame_glyphs (f); 4051 adjust_frame_glyphs (f);
3657 unblock_input (); 4052 unblock_input ();
3658 4053
3659 run_window_configuration_change_hook (f); 4054 return Qt;
4055}
4056
4057
4058DEFUN ("window-resize-apply-total", Fwindow_resize_apply_total, Swindow_resize_apply_total, 0, 2, 0,
4059 doc: /* Apply requested total size values for window-tree of FRAME.
4060If FRAME is omitted or nil, it defaults to the selected frame.
4061
4062This function does not assign pixel or normal size values. You should
4063have run `window-resize-apply' before running this.
4064
4065Optional argument HORIZONTAL omitted or nil means apply requested
4066height values. HORIZONTAL non-nil means apply requested width
4067values. */)
4068 (Lisp_Object frame, Lisp_Object horizontal)
4069{
4070 struct frame *f = decode_live_frame (frame);
4071 struct window *r = XWINDOW (FRAME_ROOT_WINDOW (f));
4072
4073 block_input ();
4074 /* Necessary when deleting the top-/or leftmost window. */
4075 r->left_col = 0;
4076 r->top_line = FRAME_TOP_MARGIN (f);
4077 window_resize_apply_total (r, !NILP (horizontal));
4078 /* Handle the mini window. */
4079 if (FRAME_HAS_MINIBUF_P (f) && !FRAME_MINIBUF_ONLY_P (f))
4080 {
4081 struct window *m = XWINDOW (f->minibuffer_window);
4082
4083 if (NILP (horizontal))
4084 {
4085 m->top_line = r->top_line + r->total_lines;
4086 m->total_lines = XFASTINT (m->new_total);
4087 }
4088 else
4089 m->total_cols = XFASTINT (m->new_total);
4090 }
4091
4092 unblock_input ();
3660 4093
3661 return Qt; 4094 return Qt;
3662} 4095}
@@ -3664,59 +4097,113 @@ be applied on the Elisp level. */)
3664 4097
3665/* Resize frame F's windows when number of lines of F is set to SIZE. 4098/* Resize frame F's windows when number of lines of F is set to SIZE.
3666 HORFLAG 1 means resize windows when number of columns of F is set to 4099 HORFLAG 1 means resize windows when number of columns of F is set to
3667 SIZE. 4100 SIZE. PIXELWISE 1 means to interpret SIZE as pixels.
3668 4101
3669 This function can delete all windows but the selected one in order to 4102 This function can delete all windows but the selected one in order to
3670 satisfy the request. The result will be meaningful if and only if 4103 satisfy the request. The result will be meaningful if and only if
3671 F's windows have meaningful sizes when you call this. */ 4104 F's windows have meaningful sizes when you call this. */
3672void 4105void
3673resize_frame_windows (struct frame *f, int size, bool horflag) 4106resize_frame_windows (struct frame *f, int size, bool horflag, bool pixelwise)
3674{ 4107{
3675 Lisp_Object root = f->root_window; 4108 Lisp_Object root = f->root_window;
3676 struct window *r = XWINDOW (root); 4109 struct window *r = XWINDOW (root);
3677 Lisp_Object mini = f->minibuffer_window; 4110 Lisp_Object mini = f->minibuffer_window;
3678 struct window *m; 4111 struct window *m;
4112 /* old_size is the old size of the frame's root window. */
4113 int old_size = horflag ? r->total_cols : r->total_lines;
4114 int old_pixel_size = horflag ? r->pixel_width : r->pixel_height;
3679 /* new_size is the new size of the frame's root window. */ 4115 /* new_size is the new size of the frame's root window. */
3680 int new_size = (horflag 4116 int new_size, new_pixel_size;
3681 ? size 4117 int unit = horflag ? FRAME_COLUMN_WIDTH (f) : FRAME_LINE_HEIGHT (f);
3682 : (size 4118
3683 - FRAME_TOP_MARGIN (f) 4119 /* Don't let the size drop below one unit. This is more comforting
3684 - ((FRAME_HAS_MINIBUF_P (f) && !FRAME_MINIBUF_ONLY_P (f)) 4120 when we are called from x_set_tool_bar_lines since the latter may
3685 ? 1 : 0))); 4121 have implicitly given us a zero or negative height. */
4122 if (pixelwise)
4123 {
4124 /* Note: This does not include the size for internal borders
4125 since these are not part of the frame's text area. */
4126 new_pixel_size = max (horflag
4127 ? size
4128 : (size
4129 - FRAME_TOP_MARGIN_HEIGHT (f)
4130 - ((FRAME_HAS_MINIBUF_P (f)
4131 && !FRAME_MINIBUF_ONLY_P (f))
4132 ? FRAME_LINE_HEIGHT (f) : 0)),
4133 unit);
4134 new_size = new_pixel_size / unit;
4135 }
4136 else
4137 {
4138 new_size = max (horflag
4139 ? size
4140 : (size
4141 - FRAME_TOP_MARGIN (f)
4142 - ((FRAME_HAS_MINIBUF_P (f)
4143 && !FRAME_MINIBUF_ONLY_P (f))
4144 ? 1 : 0)),
4145 1);
4146 new_pixel_size = new_size * unit;
4147 }
3686 4148
3687 r->top_line = FRAME_TOP_MARGIN (f); 4149 r->top_line = FRAME_TOP_MARGIN (f);
3688 if (WINDOW_LEAF_P (r)) 4150 r->pixel_top = FRAME_TOP_MARGIN_HEIGHT (f);
4151
4152 if (new_pixel_size == old_pixel_size)
4153 ;
4154 else if (WINDOW_LEAF_P (r))
3689 /* For a leaf root window just set the size. */ 4155 /* For a leaf root window just set the size. */
3690 if (horflag) 4156 if (horflag)
3691 r->total_cols = new_size; 4157 {
4158 r->total_cols = new_size;
4159 r->pixel_width = new_pixel_size;
4160 }
3692 else 4161 else
3693 r->total_lines = new_size; 4162 {
4163 r->total_lines = new_size;
4164 r->pixel_height = new_pixel_size;
4165 }
3694 else 4166 else
3695 { 4167 {
3696 /* old_size is the old size of the frame's root window. */
3697 int old_size = horflag ? r->total_cols : r->total_lines;
3698 Lisp_Object delta; 4168 Lisp_Object delta;
3699 4169
3700 XSETINT (delta, new_size - old_size); 4170 if (pixelwise)
4171 XSETINT (delta, new_pixel_size - old_pixel_size);
4172 else
4173 XSETINT (delta, new_size - old_size);
4174
3701 /* Try a "normal" resize first. */ 4175 /* Try a "normal" resize first. */
3702 resize_root_window (root, delta, horflag ? Qt : Qnil, Qnil); 4176 resize_root_window (root, delta, horflag ? Qt : Qnil, Qnil,
4177 pixelwise ? Qt : Qnil);
3703 if (window_resize_check (r, horflag) 4178 if (window_resize_check (r, horflag)
3704 && new_size == XINT (r->new_total)) 4179 && new_pixel_size == XINT (r->new_pixel))
3705 window_resize_apply (r, horflag); 4180 {
4181 window_resize_apply (r, horflag);
4182 window_pixel_to_total (r->frame, horflag ? Qt : Qnil);
4183 }
3706 else 4184 else
3707 { 4185 {
3708 /* Try with "reasonable" minimum sizes next. */ 4186 /* Try with "reasonable" minimum sizes next. */
3709 resize_root_window (root, delta, horflag ? Qt : Qnil, Qt); 4187 resize_root_window (root, delta, horflag ? Qt : Qnil, Qt,
4188 pixelwise ? Qt : Qnil);
3710 if (window_resize_check (r, horflag) 4189 if (window_resize_check (r, horflag)
3711 && new_size == XINT (r->new_total)) 4190 && new_pixel_size == XINT (r->new_pixel))
3712 window_resize_apply (r, horflag); 4191 {
4192 window_resize_apply (r, horflag);
4193 window_pixel_to_total (r->frame, horflag ? Qt : Qnil);
4194 }
3713 else 4195 else
3714 { 4196 {
3715 /* Finally, try with "safe" minimum sizes. */ 4197 /* Finally, try with "safe" minimum sizes. */
3716 resize_root_window (root, delta, horflag ? Qt : Qnil, Qsafe); 4198 resize_root_window (root, delta, horflag ? Qt : Qnil, Qsafe,
4199 pixelwise ? Qt : Qnil);
3717 if (window_resize_check (r, horflag) 4200 if (window_resize_check (r, horflag)
3718 && new_size == XINT (r->new_total)) 4201 && new_pixel_size == XINT (r->new_pixel))
3719 window_resize_apply (r, horflag); 4202 {
4203 window_resize_apply (r, horflag);
4204 window_pixel_to_total (r->frame, horflag ? Qt : Qnil);
4205 }
4206#if 0 /* Let's try without killing other windows. */
3720 else 4207 else
3721 { 4208 {
3722 /* We lost. Delete all windows but the frame's 4209 /* We lost. Delete all windows but the frame's
@@ -3724,10 +4211,17 @@ resize_frame_windows (struct frame *f, int size, bool horflag)
3724 root = f->selected_window; 4211 root = f->selected_window;
3725 Fdelete_other_windows_internal (root, Qnil); 4212 Fdelete_other_windows_internal (root, Qnil);
3726 if (horflag) 4213 if (horflag)
3727 XWINDOW (root)->total_cols = new_size; 4214 {
4215 XWINDOW (root)->total_cols = new_size;
4216 XWINDOW (root)->pixel_width = new_pixel_size;
4217 }
3728 else 4218 else
3729 XWINDOW (root)->total_lines = new_size; 4219 {
4220 XWINDOW (root)->total_lines = new_size;
4221 XWINDOW (root)->pixel_height = new_pixel_size;
4222 }
3730 } 4223 }
4224#endif /* 0 */
3731 } 4225 }
3732 } 4226 }
3733 } 4227 }
@@ -3736,42 +4230,47 @@ resize_frame_windows (struct frame *f, int size, bool horflag)
3736 { 4230 {
3737 m = XWINDOW (mini); 4231 m = XWINDOW (mini);
3738 if (horflag) 4232 if (horflag)
3739 m->total_cols = size; 4233 {
4234 m->total_cols = size;
4235 m->pixel_width = new_pixel_size;
4236 }
3740 else 4237 else
3741 { 4238 {
3742 /* Are we sure we always want 1 line here? */ 4239 /* Are we sure we always want 1 line here? */
3743 m->total_lines = 1; 4240 m->total_lines = 1;
4241 m->pixel_height = FRAME_LINE_HEIGHT (f);
3744 m->top_line = r->top_line + r->total_lines; 4242 m->top_line = r->top_line + r->total_lines;
4243 m->pixel_top = r->pixel_top + r->pixel_height;
3745 } 4244 }
3746 } 4245 }
3747 4246
3748 windows_or_buffers_changed++; 4247 fset_redisplay (f);
3749} 4248}
3750 4249
3751 4250
3752DEFUN ("split-window-internal", Fsplit_window_internal, Ssplit_window_internal, 4, 4, 0, 4251DEFUN ("split-window-internal", Fsplit_window_internal, Ssplit_window_internal, 4, 4, 0,
3753 doc: /* Split window OLD. 4252 doc: /* Split window OLD.
3754Second argument TOTAL-SIZE specifies the number of lines or columns of the 4253Second argument PIXEL-SIZE specifies the number of pixels of the
3755new window. In any case TOTAL-SIZE must be a positive integer. 4254new window. In any case TOTAL-SIZE must be a positive integer.
3756 4255
3757Third argument SIDE nil (or `below') specifies that the new window shall 4256Third argument SIDE nil (or `below') specifies that the new window shall
3758be located below WINDOW. SIDE `above' means the new window shall be 4257be located below WINDOW. SIDE `above' means the new window shall be
3759located above WINDOW. In both cases TOTAL-SIZE specifies the number of 4258located above WINDOW. In both cases PIXEL-SIZE specifies the pixel
3760lines of the new window including space reserved for the mode and/or 4259height of the new window including space reserved for the mode and/or
3761header line. 4260header line.
3762 4261
3763SIDE t (or `right') specifies that the new window shall be located on 4262SIDE t (or `right') specifies that the new window shall be located on
3764the right side of WINDOW. SIDE `left' means the new window shall be 4263the right side of WINDOW. SIDE `left' means the new window shall be
3765located on the left of WINDOW. In both cases TOTAL-SIZE specifies the 4264located on the left of WINDOW. In both cases PIXEL-SIZE specifies the
3766number of columns of the new window including space reserved for fringes 4265width of the new window including space reserved for fringes and the
3767and the scrollbar or a divider column. 4266scrollbar or a divider column.
3768 4267
3769Fourth argument NORMAL-SIZE specifies the normal size of the new window 4268Fourth argument NORMAL-SIZE specifies the normal size of the new window
3770according to the SIDE argument. 4269according to the SIDE argument.
3771 4270
3772The new total and normal sizes of all involved windows must have been 4271The new pixel and normal sizes of all involved windows must have been
3773set correctly. See the code of `split-window' for how this is done. */) 4272set correctly. See the code of `split-window' for how this is done. */)
3774 (Lisp_Object old, Lisp_Object total_size, Lisp_Object side, Lisp_Object normal_size) 4273 (Lisp_Object old, Lisp_Object pixel_size, Lisp_Object side, Lisp_Object normal_size)
3775{ 4274{
3776 /* OLD (*o) is the window we have to split. (*p) is either OLD's 4275 /* OLD (*o) is the window we have to split. (*p) is either OLD's
3777 parent window or an internal window we have to install as OLD's new 4276 parent window or an internal window we have to install as OLD's new
@@ -3780,19 +4279,24 @@ set correctly. See the code of `split-window' for how this is done. */)
3780 NEW (*n) is the new window created with some parameters taken from 4279 NEW (*n) is the new window created with some parameters taken from
3781 REFERENCE (*r). */ 4280 REFERENCE (*r). */
3782 register Lisp_Object new, frame, reference; 4281 register Lisp_Object new, frame, reference;
3783 register struct window *o, *p, *n, *r; 4282 register struct window *o, *p, *n, *r, *c;
3784 struct frame *f; 4283 struct frame *f;
3785 bool horflag 4284 bool horflag
3786 /* HORFLAG is 1 when we split side-by-side, 0 otherwise. */ 4285 /* HORFLAG is 1 when we split side-by-side, 0 otherwise. */
3787 = EQ (side, Qt) || EQ (side, Qleft) || EQ (side, Qright); 4286 = EQ (side, Qt) || EQ (side, Qleft) || EQ (side, Qright);
3788 int combination_limit = 0; 4287 int combination_limit = 0, sum = 0;
4288 int total_size;
3789 4289
3790 CHECK_WINDOW (old); 4290 CHECK_WINDOW (old);
3791 o = XWINDOW (old); 4291 o = XWINDOW (old);
3792 frame = WINDOW_FRAME (o); 4292 frame = WINDOW_FRAME (o);
3793 f = XFRAME (frame); 4293 f = XFRAME (frame);
3794 4294
3795 CHECK_NUMBER (total_size); 4295 CHECK_NUMBER (pixel_size);
4296 total_size
4297 = XINT (pixel_size) / (horflag
4298 ? FRAME_COLUMN_WIDTH (f)
4299 : FRAME_LINE_HEIGHT (f));
3796 4300
3797 /* Set combination_limit to 1 if we have to make a new parent window. 4301 /* Set combination_limit to 1 if we have to make a new parent window.
3798 We do that if either `window-combination-limit' is t, or OLD has no 4302 We do that if either `window-combination-limit' is t, or OLD has no
@@ -3816,7 +4320,7 @@ set correctly. See the code of `split-window' for how this is done. */)
3816 /* The following bugs are caught by `split-window'. */ 4320 /* The following bugs are caught by `split-window'. */
3817 if (MINI_WINDOW_P (o)) 4321 if (MINI_WINDOW_P (o))
3818 error ("Attempt to split minibuffer window"); 4322 error ("Attempt to split minibuffer window");
3819 else if (XINT (total_size) < (horflag ? 2 : 1)) 4323 else if (total_size < (horflag ? 2 : 1))
3820 error ("Size of new window too small (after split)"); 4324 error ("Size of new window too small (after split)");
3821 else if (!combination_limit && !NILP (Vwindow_combination_resize)) 4325 else if (!combination_limit && !NILP (Vwindow_combination_resize))
3822 /* `window-combination-resize' non-nil means try to resize OLD's siblings 4326 /* `window-combination-resize' non-nil means try to resize OLD's siblings
@@ -3824,26 +4328,25 @@ set correctly. See the code of `split-window' for how this is done. */)
3824 { 4328 {
3825 p = XWINDOW (o->parent); 4329 p = XWINDOW (o->parent);
3826 /* Temporarily pretend we split the parent window. */ 4330 /* Temporarily pretend we split the parent window. */
3827 wset_new_total 4331 wset_new_pixel
3828 (p, make_number ((horflag ? p->total_cols : p->total_lines) 4332 (p, make_number ((horflag ? p->pixel_width : p->pixel_height)
3829 - XINT (total_size))); 4333 - XINT (pixel_size)));
3830 if (!window_resize_check (p, horflag)) 4334 if (!window_resize_check (p, horflag))
3831 error ("Window sizes don't fit"); 4335 error ("Window sizes don't fit");
3832 else 4336 else
3833 /* Undo the temporary pretension. */ 4337 /* Undo the temporary pretension. */
3834 wset_new_total (p, make_number 4338 wset_new_pixel (p, make_number (horflag ? p->pixel_width : p->pixel_height));
3835 (horflag ? p->total_cols : p->total_lines));
3836 } 4339 }
3837 else 4340 else
3838 { 4341 {
3839 if (!window_resize_check (o, horflag)) 4342 if (!window_resize_check (o, horflag))
3840 error ("Resizing old window failed"); 4343 error ("Resizing old window failed");
3841 else if (XINT (total_size) + XINT (o->new_total) 4344 else if (XINT (pixel_size) + XINT (o->new_pixel)
3842 != (horflag ? o->total_cols : o->total_lines)) 4345 != (horflag ? o->pixel_width : o->pixel_height))
3843 error ("Sum of sizes of old and new window don't fit"); 4346 error ("Sum of sizes of old and new window don't fit");
3844 } 4347 }
3845 4348
3846 /* This is our point of no return. */ 4349 /* This is our point of no return. */
3847 if (combination_limit) 4350 if (combination_limit)
3848 { 4351 {
3849 /* Save the old value of o->normal_cols/lines. It gets corrupted 4352 /* Save the old value of o->normal_cols/lines. It gets corrupted
@@ -3859,14 +4362,16 @@ set correctly. See the code of `split-window' for how this is done. */)
3859 that its children get merged into another window. */ 4362 that its children get merged into another window. */
3860 wset_combination_limit (p, Qt); 4363 wset_combination_limit (p, Qt);
3861 /* These get applied below. */ 4364 /* These get applied below. */
3862 wset_new_total (p, make_number 4365 wset_new_pixel
3863 (horflag ? o->total_cols : o->total_lines)); 4366 (p, make_number (horflag ? o->pixel_width : o->pixel_height));
4367 wset_new_total
4368 (p, make_number (horflag ? o->total_cols : o->total_lines));
3864 wset_new_normal (p, new_normal); 4369 wset_new_normal (p, new_normal);
3865 } 4370 }
3866 else 4371 else
3867 p = XWINDOW (o->parent); 4372 p = XWINDOW (o->parent);
3868 4373
3869 windows_or_buffers_changed++; 4374 fset_redisplay (f);
3870 FRAME_WINDOW_SIZES_CHANGED (f) = 1; 4375 FRAME_WINDOW_SIZES_CHANGED (f) = 1;
3871 new = make_window (); 4376 new = make_window ();
3872 n = XWINDOW (new); 4377 n = XWINDOW (new);
@@ -3907,18 +4412,33 @@ set correctly. See the code of `split-window' for how this is done. */)
3907 /* Directly assign orthogonal coordinates and sizes. */ 4412 /* Directly assign orthogonal coordinates and sizes. */
3908 if (horflag) 4413 if (horflag)
3909 { 4414 {
4415 n->pixel_top = o->pixel_top;
3910 n->top_line = o->top_line; 4416 n->top_line = o->top_line;
4417 n->pixel_height = o->pixel_height;
3911 n->total_lines = o->total_lines; 4418 n->total_lines = o->total_lines;
3912 } 4419 }
3913 else 4420 else
3914 { 4421 {
4422 n->pixel_left = o->pixel_left;
3915 n->left_col = o->left_col; 4423 n->left_col = o->left_col;
4424 n->pixel_width = o->pixel_width;
3916 n->total_cols = o->total_cols; 4425 n->total_cols = o->total_cols;
3917 } 4426 }
3918 4427
3919 /* Iso-coordinates and sizes are assigned by window_resize_apply, 4428 /* Iso-coordinates and sizes are assigned by window_resize_apply,
3920 get them ready here. */ 4429 get them ready here. */
3921 wset_new_total (n, total_size); 4430 wset_new_pixel (n, pixel_size);
4431 c = XWINDOW (p->contents);
4432 while (c)
4433 {
4434 if (c != n)
4435 sum = sum + XINT (c->new_total);
4436 c = NILP (c->next) ? 0 : XWINDOW (c->next);
4437 }
4438 wset_new_total (n, make_number ((horflag
4439 ? p->total_cols
4440 : p->total_lines)
4441 - sum));
3922 wset_new_normal (n, normal_size); 4442 wset_new_normal (n, normal_size);
3923 4443
3924 block_input (); 4444 block_input ();
@@ -3997,8 +4517,8 @@ Signal an error when WINDOW is the only window on its frame. */)
3997 } 4517 }
3998 4518
3999 if (window_resize_check (r, horflag) 4519 if (window_resize_check (r, horflag)
4000 && (XINT (r->new_total) 4520 && (XINT (r->new_pixel)
4001 == (horflag ? r->total_cols : r->total_lines))) 4521 == (horflag ? r->pixel_width : r->pixel_height)))
4002 /* We can delete WINDOW now. */ 4522 /* We can delete WINDOW now. */
4003 { 4523 {
4004 4524
@@ -4008,7 +4528,6 @@ Signal an error when WINDOW is the only window on its frame. */)
4008 xwidget_view_delete_all_in_window(w); 4528 xwidget_view_delete_all_in_window(w);
4009#endif 4529#endif
4010 window_resize_apply (p, horflag); 4530 window_resize_apply (p, horflag);
4011
4012 /* If this window is referred to by the dpyinfo's mouse 4531 /* If this window is referred to by the dpyinfo's mouse
4013 highlight, invalidate that slot to be safe (Bug#9904). */ 4532 highlight, invalidate that slot to be safe (Bug#9904). */
4014 if (!FRAME_INITIAL_P (f)) 4533 if (!FRAME_INITIAL_P (f))
@@ -4019,7 +4538,7 @@ Signal an error when WINDOW is the only window on its frame. */)
4019 hlinfo->mouse_face_window = Qnil; 4538 hlinfo->mouse_face_window = Qnil;
4020 } 4539 }
4021 4540
4022 windows_or_buffers_changed++; 4541 fset_redisplay (f);
4023 Vwindow_list = Qnil; 4542 Vwindow_list = Qnil;
4024 FRAME_WINDOW_SIZES_CHANGED (f) = 1; 4543 FRAME_WINDOW_SIZES_CHANGED (f) = 1;
4025 4544
@@ -4119,54 +4638,78 @@ Signal an error when WINDOW is the only window on its frame. */)
4119/* Grow mini-window W by DELTA lines, DELTA >= 0, or as much as we 4638/* Grow mini-window W by DELTA lines, DELTA >= 0, or as much as we
4120 can. */ 4639 can. */
4121void 4640void
4122grow_mini_window (struct window *w, int delta) 4641grow_mini_window (struct window *w, int delta, bool pixelwise)
4123{ 4642{
4124 struct frame *f = XFRAME (w->frame); 4643 struct frame *f = XFRAME (w->frame);
4125 struct window *r; 4644 struct window *r;
4126 Lisp_Object root, value; 4645 Lisp_Object root, height;
4646 int line_height, pixel_height;
4127 4647
4128 eassert (MINI_WINDOW_P (w)); 4648 eassert (MINI_WINDOW_P (w));
4129 eassert (delta >= 0); 4649 eassert (delta >= 0);
4130 4650
4131 root = FRAME_ROOT_WINDOW (f); 4651 if (delta > 0)
4132 r = XWINDOW (root);
4133 value = call2 (Qwindow_resize_root_window_vertically,
4134 root, make_number (- delta));
4135 if (INTEGERP (value) && window_resize_check (r, 0))
4136 { 4652 {
4137 block_input (); 4653 root = FRAME_ROOT_WINDOW (f);
4138 window_resize_apply (r, 0); 4654 r = XWINDOW (root);
4655 height = call3 (Qwindow_resize_root_window_vertically,
4656 root, make_number (- delta), pixelwise ? Qt : Qnil);
4657 if (INTEGERP (height) && window_resize_check (r, 0))
4658 {
4659 block_input ();
4660 window_resize_apply (r, 0);
4139 4661
4140 /* Grow the mini-window. */ 4662 if (pixelwise)
4141 w->top_line = r->top_line + r->total_lines; 4663 {
4142 w->total_lines -= XINT (value); 4664 pixel_height = min (-XINT (height), INT_MAX - w->pixel_height);
4143 /* Enforce full redisplay. FIXME: make it more selective. */ 4665 line_height = pixel_height / FRAME_LINE_HEIGHT (f);
4144 windows_or_buffers_changed++; 4666 }
4145 adjust_frame_glyphs (f); 4667 else
4146 unblock_input (); 4668 {
4669 line_height = min (-XINT (height),
4670 ((INT_MAX - w->pixel_height)
4671 / FRAME_LINE_HEIGHT (f)));
4672 pixel_height = line_height * FRAME_LINE_HEIGHT (f);
4673 }
4674
4675 /* Grow the mini-window. */
4676 w->pixel_top = r->pixel_top + r->pixel_height;
4677 w->top_line = r->top_line + r->total_lines;
4678 /* Make sure the mini-window has always at least one line. */
4679 w->pixel_height = max (w->pixel_height + pixel_height,
4680 FRAME_LINE_HEIGHT (f));
4681 w->total_lines = max (w->total_lines + line_height, 1);
4682
4683 /* Enforce full redisplay of the frame. */
4684 /* FIXME: Shouldn't window--resize-root-window-vertically do it? */
4685 fset_redisplay (f);
4686 adjust_frame_glyphs (f);
4687 unblock_input ();
4688 }
4147 } 4689 }
4148} 4690}
4149 4691
4150 4692/* Shrink mini-window W to one line. */
4151/* Shrink mini-window W. */
4152void 4693void
4153shrink_mini_window (struct window *w) 4694shrink_mini_window (struct window *w, bool pixelwise)
4154{ 4695{
4155 struct frame *f = XFRAME (w->frame); 4696 struct frame *f = XFRAME (w->frame);
4156 struct window *r; 4697 struct window *r;
4157 Lisp_Object root, value; 4698 Lisp_Object root, delta;
4158 EMACS_INT size; 4699 EMACS_INT height, unit;
4159 4700
4160 eassert (MINI_WINDOW_P (w)); 4701 eassert (MINI_WINDOW_P (w));
4161 4702
4162 size = w->total_lines; 4703 height = pixelwise ? w->pixel_height : w->total_lines;
4163 if (size > 1) 4704 unit = pixelwise ? FRAME_LINE_HEIGHT (f) : 1;
4705 if (height > unit)
4164 { 4706 {
4165 root = FRAME_ROOT_WINDOW (f); 4707 root = FRAME_ROOT_WINDOW (f);
4166 r = XWINDOW (root); 4708 r = XWINDOW (root);
4167 value = call2 (Qwindow_resize_root_window_vertically, 4709 delta = call3 (Qwindow_resize_root_window_vertically,
4168 root, make_number (size - 1)); 4710 root, make_number (height - unit),
4169 if (INTEGERP (value) && window_resize_check (r, 0)) 4711 pixelwise ? Qt : Qnil);
4712 if (INTEGERP (delta) && window_resize_check (r, 0))
4170 { 4713 {
4171 block_input (); 4714 block_input ();
4172 window_resize_apply (r, 0); 4715 window_resize_apply (r, 0);
@@ -4174,8 +4717,11 @@ shrink_mini_window (struct window *w)
4174 /* Shrink the mini-window. */ 4717 /* Shrink the mini-window. */
4175 w->top_line = r->top_line + r->total_lines; 4718 w->top_line = r->top_line + r->total_lines;
4176 w->total_lines = 1; 4719 w->total_lines = 1;
4177 /* Enforce full redisplay. FIXME: make it more selective. */ 4720 w->pixel_top = r->pixel_top + r->pixel_height;
4178 windows_or_buffers_changed++; 4721 w->pixel_height = FRAME_LINE_HEIGHT (f);
4722 /* Enforce full redisplay of the frame. */
4723 /* FIXME: Shouldn't window--resize-root-window-vertically do it? */
4724 fset_redisplay (f);
4179 adjust_frame_glyphs (f); 4725 adjust_frame_glyphs (f);
4180 unblock_input (); 4726 unblock_input ();
4181 } 4727 }
@@ -4204,26 +4750,27 @@ DEFUN ("resize-mini-window-internal", Fresize_mini_window_internal, Sresize_mini
4204 error ("Cannot resize a minibuffer-only frame"); 4750 error ("Cannot resize a minibuffer-only frame");
4205 4751
4206 r = XWINDOW (FRAME_ROOT_WINDOW (f)); 4752 r = XWINDOW (FRAME_ROOT_WINDOW (f));
4207 height = r->total_lines + w->total_lines; 4753 height = r->pixel_height + w->pixel_height;
4208 if (window_resize_check (r, 0) 4754 if (window_resize_check (r, 0)
4209 && XINT (w->new_total) > 0 4755 && XINT (w->new_pixel) > 0
4210 && height == XINT (r->new_total) + XINT (w->new_total)) 4756 && height == XINT (r->new_pixel) + XINT (w->new_pixel))
4211 { 4757 {
4212 block_input (); 4758 block_input ();
4213 window_resize_apply (r, 0); 4759 window_resize_apply (r, 0);
4214 4760
4215 w->total_lines = XFASTINT (w->new_total); 4761 w->total_lines = XFASTINT (w->new_total);
4216 w->top_line = r->top_line + r->total_lines; 4762 w->top_line = r->top_line + r->total_lines;
4763 w->pixel_height = XFASTINT (w->new_pixel);
4764 w->pixel_top = r->pixel_top + r->pixel_height;
4217 4765
4218 windows_or_buffers_changed++; 4766 fset_redisplay (f);
4219 FRAME_WINDOW_SIZES_CHANGED (f) = 1; 4767 FRAME_WINDOW_SIZES_CHANGED (f) = 1;
4220 adjust_frame_glyphs (f); 4768 adjust_frame_glyphs (f);
4221 unblock_input (); 4769 unblock_input ();
4222
4223 run_window_configuration_change_hook (f);
4224 return Qt; 4770 return Qt;
4225 } 4771 }
4226 else error ("Failed to resize minibuffer window"); 4772 else
4773 error ("Failed to resize minibuffer window");
4227} 4774}
4228 4775
4229/* Mark window cursors off for all windows in the window tree rooted 4776/* Mark window cursors off for all windows in the window tree rooted
@@ -4286,6 +4833,8 @@ window_scroll (Lisp_Object window, EMACS_INT n, bool whole, int noerror)
4286 immediate_quit = 1; 4833 immediate_quit = 1;
4287 n = clip_to_bounds (INT_MIN, n, INT_MAX); 4834 n = clip_to_bounds (INT_MIN, n, INT_MAX);
4288 4835
4836 wset_redisplay (XWINDOW (window));
4837
4289 /* If we must, use the pixel-based version which is much slower than 4838 /* If we must, use the pixel-based version which is much slower than
4290 the line-based one but can handle varying line heights. */ 4839 the line-based one but can handle varying line heights. */
4291 if (FRAME_WINDOW_P (XFRAME (XWINDOW (window)->frame))) 4840 if (FRAME_WINDOW_P (XFRAME (XWINDOW (window)->frame)))
@@ -4293,6 +4842,8 @@ window_scroll (Lisp_Object window, EMACS_INT n, bool whole, int noerror)
4293 else 4842 else
4294 window_scroll_line_based (window, n, whole, noerror); 4843 window_scroll_line_based (window, n, whole, noerror);
4295 4844
4845 /* Bug#15957. */
4846 XWINDOW (window)->window_end_valid = 0;
4296 immediate_quit = 0; 4847 immediate_quit = 0;
4297} 4848}
4298 4849
@@ -4835,9 +5386,6 @@ scroll_command (Lisp_Object n, int direction)
4835 { 5386 {
4836 record_unwind_protect (save_excursion_restore, save_excursion_save ()); 5387 record_unwind_protect (save_excursion_restore, save_excursion_save ());
4837 Fset_buffer (XWINDOW (selected_window)->contents); 5388 Fset_buffer (XWINDOW (selected_window)->contents);
4838
4839 /* Make redisplay consider other windows than just selected_window. */
4840 ++windows_or_buffers_changed;
4841 } 5389 }
4842 5390
4843 if (NILP (n)) 5391 if (NILP (n))
@@ -4893,8 +5441,10 @@ specifies the window. This takes precedence over
4893 if (MINI_WINDOW_P (XWINDOW (selected_window)) 5441 if (MINI_WINDOW_P (XWINDOW (selected_window))
4894 && !NILP (Vminibuf_scroll_window)) 5442 && !NILP (Vminibuf_scroll_window))
4895 window = Vminibuf_scroll_window; 5443 window = Vminibuf_scroll_window;
4896 /* If buffer is specified, scroll that buffer. */ 5444 /* If buffer is specified and live, scroll that buffer. */
4897 else if (!NILP (Vother_window_scroll_buffer)) 5445 else if (!NILP (Vother_window_scroll_buffer)
5446 && BUFFERP (Vother_window_scroll_buffer)
5447 && BUFFER_LIVE_P (XBUFFER (Vother_window_scroll_buffer)))
4898 { 5448 {
4899 window = Fget_buffer_window (Vother_window_scroll_buffer, Qnil); 5449 window = Fget_buffer_window (Vother_window_scroll_buffer, Qnil);
4900 if (NILP (window)) 5450 if (NILP (window))
@@ -4947,7 +5497,6 @@ specifies the window to scroll. This takes precedence over
4947 5497
4948 /* Don't screw up if window_scroll gets an error. */ 5498 /* Don't screw up if window_scroll gets an error. */
4949 record_unwind_protect (save_excursion_restore, save_excursion_save ()); 5499 record_unwind_protect (save_excursion_restore, save_excursion_save ());
4950 ++windows_or_buffers_changed;
4951 5500
4952 Fset_buffer (w->contents); 5501 Fset_buffer (w->contents);
4953 SET_PT_BOTH (marker_position (w->pointm), marker_byte_position (w->pointm)); 5502 SET_PT_BOTH (marker_position (w->pointm), marker_byte_position (w->pointm));
@@ -4983,7 +5532,7 @@ by this function. This happens in an interactive call. */)
4983{ 5532{
4984 struct window *w = XWINDOW (selected_window); 5533 struct window *w = XWINDOW (selected_window);
4985 EMACS_INT requested_arg = (NILP (arg) 5534 EMACS_INT requested_arg = (NILP (arg)
4986 ? window_body_cols (w) - 2 5535 ? window_body_width (w, 0) - 2
4987 : XINT (Fprefix_numeric_value (arg))); 5536 : XINT (Fprefix_numeric_value (arg)));
4988 Lisp_Object result = set_window_hscroll (w, w->hscroll + requested_arg); 5537 Lisp_Object result = set_window_hscroll (w, w->hscroll + requested_arg);
4989 5538
@@ -5006,7 +5555,7 @@ by this function. This happens in an interactive call. */)
5006{ 5555{
5007 struct window *w = XWINDOW (selected_window); 5556 struct window *w = XWINDOW (selected_window);
5008 EMACS_INT requested_arg = (NILP (arg) 5557 EMACS_INT requested_arg = (NILP (arg)
5009 ? window_body_cols (w) - 2 5558 ? window_body_width (w, 0) - 2
5010 : XINT (Fprefix_numeric_value (arg))); 5559 : XINT (Fprefix_numeric_value (arg)));
5011 Lisp_Object result = set_window_hscroll (w, w->hscroll - requested_arg); 5560 Lisp_Object result = set_window_hscroll (w, w->hscroll - requested_arg);
5012 5561
@@ -5280,22 +5829,36 @@ and redisplay normally--don't erase and redraw the frame. */)
5280 return Qnil; 5829 return Qnil;
5281} 5830}
5282 5831
5283DEFUN ("window-text-height", Fwindow_text_height, Swindow_text_height, 5832DEFUN ("window-text-width", Fwindow_text_width, Swindow_text_width,
5284 0, 1, 0, 5833 0, 1, 0,
5285 doc: /* Return the height in lines of the text display area of WINDOW. 5834 doc: /* Return the width in columns of the text display area of WINDOW.
5286WINDOW must be a live window and defaults to the selected one. 5835WINDOW must be a live window and defaults to the selected one.
5287 5836
5288The returned height does not include the mode line, any header line, 5837The returned width does not include dividers, scrollbars, margins,
5289nor any partial-height lines at the bottom of the text area. */) 5838fringes, nor any partial-width columns at the right of the text
5839area. */)
5290 (Lisp_Object window) 5840 (Lisp_Object window)
5291{ 5841{
5292 struct window *w = decode_live_window (window); 5842 struct window *w = decode_live_window (window);
5293 int pixel_height = window_box_height (w); 5843
5294 int line_height = pixel_height / FRAME_LINE_HEIGHT (XFRAME (w->frame)); 5844 return make_number (window_box_width (w, TEXT_AREA)
5295 return make_number (line_height); 5845 / FRAME_COLUMN_WIDTH (WINDOW_XFRAME (w)));
5296} 5846}
5297 5847
5848DEFUN ("window-text-height", Fwindow_text_height, Swindow_text_height,
5849 0, 1, 0,
5850 doc: /* Return the height in lines of the text display area of WINDOW.
5851WINDOW must be a live window and defaults to the selected one.
5298 5852
5853The returned height does not include dividers, the mode line, any header
5854line, nor any partial-height lines at the bottom of the text area. */)
5855 (Lisp_Object window)
5856{
5857 struct window *w = decode_live_window (window);
5858
5859 return make_number (window_box_height (w)
5860 / FRAME_LINE_HEIGHT (WINDOW_XFRAME (w)));
5861}
5299 5862
5300DEFUN ("move-to-window-line", Fmove_to_window_line, Smove_to_window_line, 5863DEFUN ("move-to-window-line", Fmove_to_window_line, Smove_to_window_line,
5301 1, 1, "P", 5864 1, 1, "P",
@@ -5388,17 +5951,24 @@ struct save_window_data
5388 5951
5389 /* All fields above are traced by the GC. 5952 /* All fields above are traced by the GC.
5390 From `frame-cols' down, the fields are ignored by the GC. */ 5953 From `frame-cols' down, the fields are ignored by the GC. */
5391 5954 /* We should be able to do without the following two. */
5392 int frame_cols, frame_lines, frame_menu_bar_lines; 5955 int frame_cols, frame_lines;
5393 int frame_tool_bar_lines; 5956 /* These two should get eventually replaced by their pixel
5957 counterparts. */
5958 int frame_menu_bar_lines, frame_tool_bar_lines;
5959 int frame_text_width, frame_text_height;
5960 /* These are currently unused. We need them as soon as we convert
5961 to pixels. */
5962 int frame_menu_bar_height, frame_tool_bar_height;
5394 }; 5963 };
5395 5964
5396/* This is saved as a Lisp_Vector */ 5965/* This is saved as a Lisp_Vector. */
5397struct saved_window 5966struct saved_window
5398{ 5967{
5399 struct vectorlike_header header; 5968 struct vectorlike_header header;
5400 5969
5401 Lisp_Object window, buffer, start, pointm, mark; 5970 Lisp_Object window, buffer, start, pointm;
5971 Lisp_Object pixel_left, pixel_top, pixel_height, pixel_width;
5402 Lisp_Object left_col, top_line, total_cols, total_lines; 5972 Lisp_Object left_col, top_line, total_cols, total_lines;
5403 Lisp_Object normal_cols, normal_lines; 5973 Lisp_Object normal_cols, normal_lines;
5404 Lisp_Object hscroll, min_hscroll; 5974 Lisp_Object hscroll, min_hscroll;
@@ -5435,6 +6005,13 @@ DEFUN ("window-configuration-frame", Fwindow_configuration_frame, Swindow_config
5435 return XWINDOW (SAVED_WINDOW_N (saved_windows, 0)->window)->frame; 6005 return XWINDOW (SAVED_WINDOW_N (saved_windows, 0)->window)->frame;
5436} 6006}
5437 6007
6008/* From Chong's unwind_create_frame_1. */
6009static void
6010unwind_change_frame (Lisp_Object val)
6011{
6012 inhibit_lisp_code = val;
6013}
6014
5438DEFUN ("set-window-configuration", Fset_window_configuration, 6015DEFUN ("set-window-configuration", Fset_window_configuration,
5439 Sset_window_configuration, 1, 1, 0, 6016 Sset_window_configuration, 1, 1, 0,
5440 doc: /* Set the configuration of windows and buffers as specified by CONFIGURATION. 6017 doc: /* Set the configuration of windows and buffers as specified by CONFIGURATION.
@@ -5514,13 +6091,17 @@ the return value is nil. Otherwise the value is t. */)
5514 int n_leaf_windows; 6091 int n_leaf_windows;
5515 ptrdiff_t k; 6092 ptrdiff_t k;
5516 int i, n; 6093 int i, n;
5517 6094 ptrdiff_t count = SPECPDL_INDEX ();
5518 /* If the frame has been resized since this window configuration was 6095 /* If the frame has been resized since this window configuration was
5519 made, we change the frame to the size specified in the 6096 made, we change the frame to the size specified in the
5520 configuration, restore the configuration, and then resize it 6097 configuration, restore the configuration, and then resize it
5521 back. We keep track of the prevailing height in these variables. */ 6098 back. We keep track of the prevailing height in these variables. */
5522 int previous_frame_lines = FRAME_LINES (f); 6099 int previous_frame_text_height = FRAME_TEXT_HEIGHT (f);
5523 int previous_frame_cols = FRAME_COLS (f); 6100 int previous_frame_text_width = FRAME_TEXT_WIDTH (f);
6101 /* int previous_frame_menu_bar_height = FRAME_MENU_BAR_HEIGHT (f); */
6102 /* int previous_frame_tool_bar_height = FRAME_TOOL_BAR_HEIGHT (f); */
6103 /* int previous_frame_lines = FRAME_LINES (f); */
6104 /* int previous_frame_cols = FRAME_COLS (f); */
5524 int previous_frame_menu_bar_lines = FRAME_MENU_BAR_LINES (f); 6105 int previous_frame_menu_bar_lines = FRAME_MENU_BAR_LINES (f);
5525 int previous_frame_tool_bar_lines = FRAME_TOOL_BAR_LINES (f); 6106 int previous_frame_tool_bar_lines = FRAME_TOOL_BAR_LINES (f);
5526 6107
@@ -5539,26 +6120,35 @@ the return value is nil. Otherwise the value is t. */)
5539 call1 (Qrecord_window_buffer, window); 6120 call1 (Qrecord_window_buffer, window);
5540 } 6121 }
5541 6122
6123 /* Don't run lisp in the following segment since the frame is in a
6124 completely inconsistent state. See Bug#16207. */
6125 record_unwind_protect (unwind_change_frame, inhibit_lisp_code);
6126 inhibit_lisp_code = Qt;
5542 /* The mouse highlighting code could get screwed up 6127 /* The mouse highlighting code could get screwed up
5543 if it runs during this. */ 6128 if it runs during this. */
5544 block_input (); 6129 block_input ();
5545 6130
5546 if (data->frame_lines != previous_frame_lines 6131 if (data->frame_text_width != previous_frame_text_width
5547 || data->frame_cols != previous_frame_cols) 6132 || data->frame_text_height != previous_frame_text_height)
5548 change_frame_size (f, data->frame_lines, 6133 change_frame_size (f, data->frame_text_width,
5549 data->frame_cols, 0, 0, 0); 6134 data->frame_text_height, 0, 0, 0, 1);
5550#if defined (HAVE_WINDOW_SYSTEM) || defined (MSDOS) 6135
5551 if (data->frame_menu_bar_lines 6136 if (data->frame_menu_bar_lines != previous_frame_menu_bar_lines)
5552 != previous_frame_menu_bar_lines) 6137 {
5553 x_set_menu_bar_lines (f, make_number (data->frame_menu_bar_lines),
5554 make_number (0));
5555#ifdef HAVE_WINDOW_SYSTEM 6138#ifdef HAVE_WINDOW_SYSTEM
5556 if (data->frame_tool_bar_lines 6139 if (FRAME_WINDOW_P (f))
5557 != previous_frame_tool_bar_lines) 6140 x_set_menu_bar_lines (f, make_number (data->frame_menu_bar_lines),
6141 make_number (0));
6142 else /* TTY or MSDOS */
6143#endif
6144 set_menu_bar_lines (f, make_number (data->frame_menu_bar_lines),
6145 make_number (0));
6146 }
6147#ifdef HAVE_WINDOW_SYSTEM
6148 if (data->frame_tool_bar_lines != previous_frame_tool_bar_lines)
5558 x_set_tool_bar_lines (f, make_number (data->frame_tool_bar_lines), 6149 x_set_tool_bar_lines (f, make_number (data->frame_tool_bar_lines),
5559 make_number (0)); 6150 make_number (0));
5560#endif 6151#endif
5561#endif
5562 6152
5563 /* "Swap out" point from the selected window's buffer 6153 /* "Swap out" point from the selected window's buffer
5564 into the window itself. (Normally the pointm of the selected 6154 into the window itself. (Normally the pointm of the selected
@@ -5574,7 +6164,7 @@ the return value is nil. Otherwise the value is t. */)
5574 BUF_PT_BYTE (XBUFFER (w->contents))); 6164 BUF_PT_BYTE (XBUFFER (w->contents)));
5575 } 6165 }
5576 6166
5577 windows_or_buffers_changed++; 6167 fset_redisplay (f);
5578 FRAME_WINDOW_SIZES_CHANGED (f) = 1; 6168 FRAME_WINDOW_SIZES_CHANGED (f) = 1;
5579 6169
5580 /* Problem: Freeing all matrices and later allocating them again 6170 /* Problem: Freeing all matrices and later allocating them again
@@ -5627,6 +6217,10 @@ the return value is nil. Otherwise the value is t. */)
5627 /* If we squirreled away the buffer, restore it now. */ 6217 /* If we squirreled away the buffer, restore it now. */
5628 if (BUFFERP (w->combination_limit)) 6218 if (BUFFERP (w->combination_limit))
5629 wset_buffer (w, w->combination_limit); 6219 wset_buffer (w, w->combination_limit);
6220 w->pixel_left = XFASTINT (p->pixel_left);
6221 w->pixel_top = XFASTINT (p->pixel_top);
6222 w->pixel_width = XFASTINT (p->pixel_width);
6223 w->pixel_height = XFASTINT (p->pixel_height);
5630 w->left_col = XFASTINT (p->left_col); 6224 w->left_col = XFASTINT (p->left_col);
5631 w->top_line = XFASTINT (p->top_line); 6225 w->top_line = XFASTINT (p->top_line);
5632 w->total_cols = XFASTINT (p->total_cols); 6226 w->total_cols = XFASTINT (p->total_cols);
@@ -5675,8 +6269,6 @@ the return value is nil. Otherwise the value is t. */)
5675 set_marker_restricted (w->start, p->start, w->contents); 6269 set_marker_restricted (w->start, p->start, w->contents);
5676 set_marker_restricted (w->pointm, p->pointm, 6270 set_marker_restricted (w->pointm, p->pointm,
5677 w->contents); 6271 w->contents);
5678 Fset_marker (BVAR (XBUFFER (w->contents), mark),
5679 p->mark, w->contents);
5680 6272
5681 /* As documented in Fcurrent_window_configuration, don't 6273 /* As documented in Fcurrent_window_configuration, don't
5682 restore the location of point in the buffer which was 6274 restore the location of point in the buffer which was
@@ -5730,9 +6322,13 @@ the return value is nil. Otherwise the value is t. */)
5730 /* In the following call to `select-window', prevent "swapping out 6322 /* In the following call to `select-window', prevent "swapping out
5731 point" in the old selected window using the buffer that has 6323 point" in the old selected window using the buffer that has
5732 been restored into it. We already swapped out that point from 6324 been restored into it. We already swapped out that point from
5733 that window's old buffer. */ 6325 that window's old buffer.
5734 select_window (data->current_window, Qnil, 1); 6326
5735 BVAR (XBUFFER (XWINDOW (selected_window)->contents), last_selected_window) 6327 Do not record the buffer here. We do that in a separate call
6328 to select_window below. See also Bug#16207. */
6329 select_window (data->current_window, Qt, 1);
6330 BVAR (XBUFFER (XWINDOW (selected_window)->contents),
6331 last_selected_window)
5736 = selected_window; 6332 = selected_window;
5737 6333
5738 if (NILP (data->focus_frame) 6334 if (NILP (data->focus_frame)
@@ -5740,21 +6336,29 @@ the return value is nil. Otherwise the value is t. */)
5740 && FRAME_LIVE_P (XFRAME (data->focus_frame)))) 6336 && FRAME_LIVE_P (XFRAME (data->focus_frame))))
5741 Fredirect_frame_focus (frame, data->focus_frame); 6337 Fredirect_frame_focus (frame, data->focus_frame);
5742 6338
5743 /* Set the screen height to the value it had before this function. */ 6339 /* Set the frame size to the value it had before this function. */
5744 if (previous_frame_lines != FRAME_LINES (f) 6340 if (previous_frame_text_width != FRAME_TEXT_WIDTH (f)
5745 || previous_frame_cols != FRAME_COLS (f)) 6341 || previous_frame_text_height != FRAME_TEXT_HEIGHT (f))
5746 change_frame_size (f, previous_frame_lines, previous_frame_cols, 6342 change_frame_size (f, previous_frame_text_width,
5747 0, 0, 0); 6343 previous_frame_text_height, 0, 0, 0, 1);
5748#if defined (HAVE_WINDOW_SYSTEM) || defined (MSDOS) 6344
5749 if (previous_frame_menu_bar_lines != FRAME_MENU_BAR_LINES (f)) 6345 if (previous_frame_menu_bar_lines != FRAME_MENU_BAR_LINES (f))
5750 x_set_menu_bar_lines (f, make_number (previous_frame_menu_bar_lines), 6346 {
5751 make_number (0)); 6347#ifdef HAVE_WINDOW_SYSTEM
6348 if (FRAME_WINDOW_P (f))
6349 x_set_menu_bar_lines (f,
6350 make_number (previous_frame_menu_bar_lines),
6351 make_number (0));
6352 else /* TTY or MSDOS */
6353#endif
6354 set_menu_bar_lines (f, make_number (previous_frame_menu_bar_lines),
6355 make_number (0));
6356 }
5752#ifdef HAVE_WINDOW_SYSTEM 6357#ifdef HAVE_WINDOW_SYSTEM
5753 if (previous_frame_tool_bar_lines != FRAME_TOOL_BAR_LINES (f)) 6358 if (previous_frame_tool_bar_lines != FRAME_TOOL_BAR_LINES (f))
5754 x_set_tool_bar_lines (f, make_number (previous_frame_tool_bar_lines), 6359 x_set_tool_bar_lines (f, make_number (previous_frame_tool_bar_lines),
5755 make_number (0)); 6360 make_number (0));
5756#endif 6361#endif
5757#endif
5758 6362
5759 /* Now, free glyph matrices in windows that were not reused. */ 6363 /* Now, free glyph matrices in windows that were not reused. */
5760 for (i = n = 0; i < n_leaf_windows; ++i) 6364 for (i = n = 0; i < n_leaf_windows; ++i)
@@ -5767,6 +6371,7 @@ the return value is nil. Otherwise the value is t. */)
5767 6371
5768 adjust_frame_glyphs (f); 6372 adjust_frame_glyphs (f);
5769 unblock_input (); 6373 unblock_input ();
6374 unbind_to (count, Qnil);
5770 6375
5771 /* Scan dead buffer windows. */ 6376 /* Scan dead buffer windows. */
5772 for (; CONSP (dead_windows); dead_windows = XCDR (dead_windows)) 6377 for (; CONSP (dead_windows); dead_windows = XCDR (dead_windows))
@@ -5776,6 +6381,10 @@ the return value is nil. Otherwise the value is t. */)
5776 delete_deletable_window (window); 6381 delete_deletable_window (window);
5777 } 6382 }
5778 6383
6384 /* Record the selected window's buffer here. The window should
6385 already be the selected one from the call above. */
6386 select_window (data->current_window, Qnil, 0);
6387
5779 /* Fselect_window will have made f the selected frame, so we 6388 /* Fselect_window will have made f the selected frame, so we
5780 reselect the proper frame here. Fhandle_switch_frame will change the 6389 reselect the proper frame here. Fhandle_switch_frame will change the
5781 selected window too, but that doesn't make the call to 6390 selected window too, but that doesn't make the call to
@@ -5928,6 +6537,10 @@ save_window_save (Lisp_Object window, struct Lisp_Vector *vector, int i)
5928 wset_temslot (w, make_number (i)); i++; 6537 wset_temslot (w, make_number (i)); i++;
5929 p->window = window; 6538 p->window = window;
5930 p->buffer = (WINDOW_LEAF_P (w) ? w->contents : Qnil); 6539 p->buffer = (WINDOW_LEAF_P (w) ? w->contents : Qnil);
6540 p->pixel_left = make_number (w->pixel_left);
6541 p->pixel_top = make_number (w->pixel_top);
6542 p->pixel_width = make_number (w->pixel_width);
6543 p->pixel_height = make_number (w->pixel_height);
5931 p->left_col = make_number (w->left_col); 6544 p->left_col = make_number (w->left_col);
5932 p->top_line = make_number (w->top_line); 6545 p->top_line = make_number (w->top_line);
5933 p->total_cols = make_number (w->total_cols); 6546 p->total_cols = make_number (w->total_cols);
@@ -6006,31 +6619,21 @@ save_window_save (Lisp_Object window, struct Lisp_Vector *vector, int i)
6006 else 6619 else
6007 p->pointm = Fcopy_marker (w->pointm, Qnil); 6620 p->pointm = Fcopy_marker (w->pointm, Qnil);
6008 XMARKER (p->pointm)->insertion_type 6621 XMARKER (p->pointm)->insertion_type
6009 = !NILP (Vwindow_point_insertion_type); 6622 = !NILP (buffer_local_value /* Don't signal error if void. */
6623 (Qwindow_point_insertion_type, w->contents));
6010 6624
6011 p->start = Fcopy_marker (w->start, Qnil); 6625 p->start = Fcopy_marker (w->start, Qnil);
6012 p->start_at_line_beg = w->start_at_line_beg ? Qt : Qnil; 6626 p->start_at_line_beg = w->start_at_line_beg ? Qt : Qnil;
6013
6014 tem = BVAR (XBUFFER (w->contents), mark);
6015 p->mark = Fcopy_marker (tem, Qnil);
6016 } 6627 }
6017 else 6628 else
6018 { 6629 {
6019 p->pointm = Qnil; 6630 p->pointm = Qnil;
6020 p->start = Qnil; 6631 p->start = Qnil;
6021 p->mark = Qnil;
6022 p->start_at_line_beg = Qnil; 6632 p->start_at_line_beg = Qnil;
6023 } 6633 }
6024 6634
6025 if (NILP (w->parent)) 6635 p->parent = NILP (w->parent) ? Qnil : XWINDOW (w->parent)->temslot;
6026 p->parent = Qnil; 6636 p->prev = NILP (w->prev) ? Qnil : XWINDOW (w->prev)->temslot;
6027 else
6028 p->parent = XWINDOW (w->parent)->temslot;
6029
6030 if (NILP (w->prev))
6031 p->prev = Qnil;
6032 else
6033 p->prev = XWINDOW (w->prev)->temslot;
6034 6637
6035 if (WINDOWP (w->contents)) 6638 if (WINDOWP (w->contents))
6036 i = save_window_save (w->contents, vector, i); 6639 i = save_window_save (w->contents, vector, i);
@@ -6044,8 +6647,8 @@ DEFUN ("current-window-configuration", Fcurrent_window_configuration,
6044 doc: /* Return an object representing the current window configuration of FRAME. 6647 doc: /* Return an object representing the current window configuration of FRAME.
6045If FRAME is nil or omitted, use the selected frame. 6648If FRAME is nil or omitted, use the selected frame.
6046This describes the number of windows, their sizes and current buffers, 6649This describes the number of windows, their sizes and current buffers,
6047and for each displayed buffer, where display starts, and the positions of 6650and for each displayed buffer, where display starts, and the position of
6048point and mark. An exception is made for point in the current buffer: 6651point. An exception is made for point in the current buffer:
6049its value is -not- saved. 6652its value is -not- saved.
6050This also records the currently selected frame, and FRAME's focus 6653This also records the currently selected frame, and FRAME's focus
6051redirection (see `redirect-frame-focus'). The variable 6654redirection (see `redirect-frame-focus'). The variable
@@ -6067,6 +6670,10 @@ saved by this function. */)
6067 data->frame_lines = FRAME_LINES (f); 6670 data->frame_lines = FRAME_LINES (f);
6068 data->frame_menu_bar_lines = FRAME_MENU_BAR_LINES (f); 6671 data->frame_menu_bar_lines = FRAME_MENU_BAR_LINES (f);
6069 data->frame_tool_bar_lines = FRAME_TOOL_BAR_LINES (f); 6672 data->frame_tool_bar_lines = FRAME_TOOL_BAR_LINES (f);
6673 data->frame_text_width = FRAME_TEXT_WIDTH (f);
6674 data->frame_text_height = FRAME_TEXT_HEIGHT (f);
6675 data->frame_menu_bar_height = FRAME_MENU_BAR_HEIGHT (f);
6676 data->frame_tool_bar_height = FRAME_TOOL_BAR_HEIGHT (f);
6070 data->selected_frame = selected_frame; 6677 data->selected_frame = selected_frame;
6071 data->current_window = FRAME_SELECTED_WINDOW (f); 6678 data->current_window = FRAME_SELECTED_WINDOW (f);
6072 XSETBUFFER (data->current_buffer, current_buffer); 6679 XSETBUFFER (data->current_buffer, current_buffer);
@@ -6093,7 +6700,8 @@ apply_window_adjustment (struct window *w)
6093 adjust_window_margins (w); 6700 adjust_window_margins (w);
6094 clear_glyph_matrix (w->current_matrix); 6701 clear_glyph_matrix (w->current_matrix);
6095 w->window_end_valid = 0; 6702 w->window_end_valid = 0;
6096 windows_or_buffers_changed++; 6703 windows_or_buffers_changed = 30;
6704 wset_redisplay (w);
6097 adjust_frame_glyphs (XFRAME (WINDOW_FRAME (w))); 6705 adjust_frame_glyphs (XFRAME (WINDOW_FRAME (w)));
6098} 6706}
6099 6707
@@ -6153,8 +6761,10 @@ as nil. */)
6153 (Lisp_Object window) 6761 (Lisp_Object window)
6154{ 6762{
6155 struct window *w = decode_live_window (window); 6763 struct window *w = decode_live_window (window);
6156 return Fcons (w->left_margin_cols ? make_number (w->left_margin_cols) : Qnil, 6764 return Fcons (w->left_margin_cols
6157 w->right_margin_cols ? make_number (w->right_margin_cols) : Qnil); 6765 ? make_number (w->left_margin_cols) : Qnil,
6766 w->right_margin_cols
6767 ? make_number (w->right_margin_cols) : Qnil);
6158} 6768}
6159 6769
6160 6770
@@ -6264,15 +6874,14 @@ DEFUN ("set-window-scroll-bars", Fset_window_scroll_bars,
6264 doc: /* Set width and type of scroll bars of window WINDOW. 6874 doc: /* Set width and type of scroll bars of window WINDOW.
6265WINDOW must be a live window and defaults to the selected one. 6875WINDOW must be a live window and defaults to the selected one.
6266 6876
6267Second parameter WIDTH specifies the pixel width for the scroll bar; 6877Second parameter WIDTH specifies the pixel width for the scroll bar.
6268this is automatically adjusted to a multiple of the frame column width.
6269Third parameter VERTICAL-TYPE specifies the type of the vertical scroll 6878Third parameter VERTICAL-TYPE specifies the type of the vertical scroll
6270bar: left, right, or nil. 6879bar: left, right, or nil.
6271If WIDTH is nil, use the frame's scroll-bar width. 6880If WIDTH is nil, use the frame's scroll-bar width.
6272If VERTICAL-TYPE is t, use the frame's scroll-bar type. 6881If VERTICAL-TYPE is t, use the frame's scroll-bar type.
6273Fourth parameter HORIZONTAL-TYPE is currently unused. 6882Fourth parameter HORIZONTAL-TYPE is currently unused.
6274 6883
6275Return t if scroll bars was actually changed and nil otherwise. */) 6884Return t if scroll bars were actually changed and nil otherwise. */)
6276 (Lisp_Object window, Lisp_Object width, 6885 (Lisp_Object window, Lisp_Object width,
6277 Lisp_Object vertical_type, Lisp_Object horizontal_type) 6886 Lisp_Object vertical_type, Lisp_Object horizontal_type)
6278{ 6887{
@@ -6295,9 +6904,7 @@ value. */)
6295{ 6904{
6296 struct window *w = decode_live_window (window); 6905 struct window *w = decode_live_window (window);
6297 6906
6298 return list4 (make_number ((WINDOW_CONFIG_SCROLL_BAR_WIDTH (w) 6907 return list4 (make_number (WINDOW_SCROLL_BAR_AREA_WIDTH (w)),
6299 ? WINDOW_CONFIG_SCROLL_BAR_WIDTH (w)
6300 : WINDOW_SCROLL_BAR_AREA_WIDTH (w))),
6301 make_number (WINDOW_SCROLL_BAR_COLS (w)), 6908 make_number (WINDOW_SCROLL_BAR_COLS (w)),
6302 w->vertical_scroll_bar_type, Qnil); 6909 w->vertical_scroll_bar_type, Qnil);
6303} 6910}
@@ -6467,6 +7074,10 @@ compare_window_configurations (Lisp_Object configuration1,
6467 != EQ (d2->current_window, sw2->window) 7074 != EQ (d2->current_window, sw2->window)
6468 /* Windows' buffers must match. */ 7075 /* Windows' buffers must match. */
6469 || !EQ (sw1->buffer, sw2->buffer) 7076 || !EQ (sw1->buffer, sw2->buffer)
7077 || !EQ (sw1->pixel_left, sw2->pixel_left)
7078 || !EQ (sw1->pixel_top, sw2->pixel_top)
7079 || !EQ (sw1->pixel_height, sw2->pixel_height)
7080 || !EQ (sw1->pixel_width, sw2->pixel_width)
6470 || !EQ (sw1->left_col, sw2->left_col) 7081 || !EQ (sw1->left_col, sw2->left_col)
6471 || !EQ (sw1->top_line, sw2->top_line) 7082 || !EQ (sw1->top_line, sw2->top_line)
6472 || !EQ (sw1->total_cols, sw2->total_cols) 7083 || !EQ (sw1->total_cols, sw2->total_cols)
@@ -6481,8 +7092,7 @@ compare_window_configurations (Lisp_Object configuration1,
6481 || !EQ (sw1->min_hscroll, sw2->min_hscroll) 7092 || !EQ (sw1->min_hscroll, sw2->min_hscroll)
6482 || !EQ (sw1->start_at_line_beg, sw2->start_at_line_beg) 7093 || !EQ (sw1->start_at_line_beg, sw2->start_at_line_beg)
6483 || NILP (Fequal (sw1->start, sw2->start)) 7094 || NILP (Fequal (sw1->start, sw2->start))
6484 || NILP (Fequal (sw1->pointm, sw2->pointm)) 7095 || NILP (Fequal (sw1->pointm, sw2->pointm))))
6485 || NILP (Fequal (sw1->mark, sw2->mark))))
6486 || !EQ (sw1->left_margin_cols, sw2->left_margin_cols) 7096 || !EQ (sw1->left_margin_cols, sw2->left_margin_cols)
6487 || !EQ (sw1->right_margin_cols, sw2->right_margin_cols) 7097 || !EQ (sw1->right_margin_cols, sw2->right_margin_cols)
6488 || !EQ (sw1->left_fringe_width, sw2->left_fringe_width) 7098 || !EQ (sw1->left_fringe_width, sw2->left_fringe_width)
@@ -6499,7 +7109,7 @@ compare_window_configurations (Lisp_Object configuration1,
6499DEFUN ("compare-window-configurations", Fcompare_window_configurations, 7109DEFUN ("compare-window-configurations", Fcompare_window_configurations,
6500 Scompare_window_configurations, 2, 2, 0, 7110 Scompare_window_configurations, 2, 2, 0,
6501 doc: /* Compare two window configurations as regards the structure of windows. 7111 doc: /* Compare two window configurations as regards the structure of windows.
6502This function ignores details such as the values of point and mark 7112This function ignores details such as the values of point
6503and scrolling positions. */) 7113and scrolling positions. */)
6504 (Lisp_Object x, Lisp_Object y) 7114 (Lisp_Object x, Lisp_Object y)
6505{ 7115{
@@ -6516,9 +7126,6 @@ init_window_once (void)
6516 Vterminal_frame = selected_frame; 7126 Vterminal_frame = selected_frame;
6517 minibuf_window = f->minibuffer_window; 7127 minibuf_window = f->minibuffer_window;
6518 selected_window = f->selected_window; 7128 selected_window = f->selected_window;
6519 last_nonminibuf_frame = f;
6520
6521 window_initialized = 1;
6522} 7129}
6523 7130
6524void 7131void
@@ -6546,6 +7153,7 @@ syms_of_window (void)
6546 DEFSYM (Qdelete_window, "delete-window"); 7153 DEFSYM (Qdelete_window, "delete-window");
6547 DEFSYM (Qwindow_resize_root_window, "window--resize-root-window"); 7154 DEFSYM (Qwindow_resize_root_window, "window--resize-root-window");
6548 DEFSYM (Qwindow_resize_root_window_vertically, "window--resize-root-window-vertically"); 7155 DEFSYM (Qwindow_resize_root_window_vertically, "window--resize-root-window-vertically");
7156 DEFSYM (Qwindow_pixel_to_total, "window--pixel-to-total");
6549 DEFSYM (Qsafe, "safe"); 7157 DEFSYM (Qsafe, "safe");
6550 DEFSYM (Qdisplay_buffer, "display-buffer"); 7158 DEFSYM (Qdisplay_buffer, "display-buffer");
6551 DEFSYM (Qreplace_buffer_in_windows, "replace-buffer-in-windows"); 7159 DEFSYM (Qreplace_buffer_in_windows, "replace-buffer-in-windows");
@@ -6556,6 +7164,8 @@ syms_of_window (void)
6556 DEFSYM (Qabove, "above"); 7164 DEFSYM (Qabove, "above");
6557 DEFSYM (Qbelow, "below"); 7165 DEFSYM (Qbelow, "below");
6558 DEFSYM (Qclone_of, "clone-of"); 7166 DEFSYM (Qclone_of, "clone-of");
7167 DEFSYM (Qfloor, "floor");
7168 DEFSYM (Qceiling, "ceiling");
6559 7169
6560 staticpro (&Vwindow_list); 7170 staticpro (&Vwindow_list);
6561 7171
@@ -6586,7 +7196,7 @@ is displayed in the `mode-line' face. */);
6586 mode_line_in_non_selected_windows = 1; 7196 mode_line_in_non_selected_windows = 1;
6587 7197
6588 DEFVAR_LISP ("other-window-scroll-buffer", Vother_window_scroll_buffer, 7198 DEFVAR_LISP ("other-window-scroll-buffer", Vother_window_scroll_buffer,
6589 doc: /* If non-nil, this is a buffer and \\[scroll-other-window] should scroll its window. */); 7199 doc: /* If this is a live buffer, \\[scroll-other-window] should scroll its window. */);
6590 Vother_window_scroll_buffer = Qnil; 7200 Vother_window_scroll_buffer = Qnil;
6591 7201
6592 DEFVAR_BOOL ("auto-window-vscroll", auto_window_vscroll_p, 7202 DEFVAR_BOOL ("auto-window-vscroll", auto_window_vscroll_p,
@@ -6613,6 +7223,7 @@ on their symbols to be controlled by this variable. */);
6613 DEFVAR_LISP ("window-point-insertion-type", Vwindow_point_insertion_type, 7223 DEFVAR_LISP ("window-point-insertion-type", Vwindow_point_insertion_type,
6614 doc: /* Type of marker to use for `window-point'. */); 7224 doc: /* Type of marker to use for `window-point'. */);
6615 Vwindow_point_insertion_type = Qnil; 7225 Vwindow_point_insertion_type = Qnil;
7226 DEFSYM (Qwindow_point_insertion_type, "window_point_insertion_type");
6616 7227
6617 DEFVAR_LISP ("window-configuration-change-hook", 7228 DEFVAR_LISP ("window-configuration-change-hook",
6618 Vwindow_configuration_change_hook, 7229 Vwindow_configuration_change_hook,
@@ -6704,6 +7315,17 @@ Parameters not saved by `current-window-configuration' or
6704respectively are not installed by `window-state-put'. */); 7315respectively are not installed by `window-state-put'. */);
6705 Vwindow_persistent_parameters = list1 (Fcons (Qclone_of, Qt)); 7316 Vwindow_persistent_parameters = list1 (Fcons (Qclone_of, Qt));
6706 7317
7318 DEFVAR_BOOL ("window-resize-pixelwise", window_resize_pixelwise,
7319 doc: /* Non-nil means resize windows pixelwise.
7320This currently affects the functions: `split-window', `maximize-window',
7321`minimize-window', `fit-window-to-buffer' and `fit-frame-to-buffer', and
7322all functions that symmetrically resize a parent window.
7323
7324Note that when a frame's pixel size is not a multiple of the
7325frame's character size, at least one window may get resized
7326pixelwise even if this option is nil. */);
7327 window_resize_pixelwise = 0;
7328
6707 defsubr (&Sselected_window); 7329 defsubr (&Sselected_window);
6708 defsubr (&Sminibuffer_window); 7330 defsubr (&Sminibuffer_window);
6709 defsubr (&Swindow_minibuffer_p); 7331 defsubr (&Swindow_minibuffer_p);
@@ -6726,16 +7348,23 @@ respectively are not installed by `window-state-put'. */);
6726 defsubr (&Swindow_combination_limit); 7348 defsubr (&Swindow_combination_limit);
6727 defsubr (&Sset_window_combination_limit); 7349 defsubr (&Sset_window_combination_limit);
6728 defsubr (&Swindow_use_time); 7350 defsubr (&Swindow_use_time);
6729 defsubr (&Swindow_top_line); 7351 defsubr (&Swindow_pixel_width);
6730 defsubr (&Swindow_left_column); 7352 defsubr (&Swindow_pixel_height);
6731 defsubr (&Swindow_total_height);
6732 defsubr (&Swindow_total_width); 7353 defsubr (&Swindow_total_width);
7354 defsubr (&Swindow_total_height);
6733 defsubr (&Swindow_normal_size); 7355 defsubr (&Swindow_normal_size);
7356 defsubr (&Swindow_new_pixel);
6734 defsubr (&Swindow_new_total); 7357 defsubr (&Swindow_new_total);
6735 defsubr (&Swindow_new_normal); 7358 defsubr (&Swindow_new_normal);
7359 defsubr (&Swindow_pixel_left);
7360 defsubr (&Swindow_pixel_top);
7361 defsubr (&Swindow_left_column);
7362 defsubr (&Swindow_top_line);
7363 defsubr (&Sset_window_new_pixel);
6736 defsubr (&Sset_window_new_total); 7364 defsubr (&Sset_window_new_total);
6737 defsubr (&Sset_window_new_normal); 7365 defsubr (&Sset_window_new_normal);
6738 defsubr (&Swindow_resize_apply); 7366 defsubr (&Swindow_resize_apply);
7367 defsubr (&Swindow_resize_apply_total);
6739 defsubr (&Swindow_body_height); 7368 defsubr (&Swindow_body_height);
6740 defsubr (&Swindow_body_width); 7369 defsubr (&Swindow_body_width);
6741 defsubr (&Swindow_hscroll); 7370 defsubr (&Swindow_hscroll);
@@ -6745,6 +7374,11 @@ respectively are not installed by `window-state-put'. */);
6745 defsubr (&Swindow_edges); 7374 defsubr (&Swindow_edges);
6746 defsubr (&Swindow_pixel_edges); 7375 defsubr (&Swindow_pixel_edges);
6747 defsubr (&Swindow_absolute_pixel_edges); 7376 defsubr (&Swindow_absolute_pixel_edges);
7377 defsubr (&Swindow_mode_line_height);
7378 defsubr (&Swindow_header_line_height);
7379 defsubr (&Swindow_right_divider_width);
7380 defsubr (&Swindow_bottom_divider_width);
7381 defsubr (&Swindow_scroll_bar_width);
6748 defsubr (&Swindow_inside_edges); 7382 defsubr (&Swindow_inside_edges);
6749 defsubr (&Swindow_inside_pixel_edges); 7383 defsubr (&Swindow_inside_pixel_edges);
6750 defsubr (&Swindow_inside_absolute_pixel_edges); 7384 defsubr (&Swindow_inside_absolute_pixel_edges);
@@ -6767,6 +7401,7 @@ respectively are not installed by `window-state-put'. */);
6767 defsubr (&Sresize_mini_window_internal); 7401 defsubr (&Sresize_mini_window_internal);
6768 defsubr (&Sset_window_buffer); 7402 defsubr (&Sset_window_buffer);
6769 defsubr (&Srun_window_configuration_change_hook); 7403 defsubr (&Srun_window_configuration_change_hook);
7404 defsubr (&Srun_window_scroll_functions);
6770 defsubr (&Sselect_window); 7405 defsubr (&Sselect_window);
6771 defsubr (&Sforce_window_update); 7406 defsubr (&Sforce_window_update);
6772 defsubr (&Ssplit_window_internal); 7407 defsubr (&Ssplit_window_internal);
@@ -6778,6 +7413,7 @@ respectively are not installed by `window-state-put'. */);
6778 defsubr (&Sscroll_other_window); 7413 defsubr (&Sscroll_other_window);
6779 defsubr (&Sminibuffer_selected_window); 7414 defsubr (&Sminibuffer_selected_window);
6780 defsubr (&Srecenter); 7415 defsubr (&Srecenter);
7416 defsubr (&Swindow_text_width);
6781 defsubr (&Swindow_text_height); 7417 defsubr (&Swindow_text_height);
6782 defsubr (&Smove_to_window_line); 7418 defsubr (&Smove_to_window_line);
6783 defsubr (&Swindow_configuration_p); 7419 defsubr (&Swindow_configuration_p);