aboutsummaryrefslogtreecommitdiffstats
path: root/src/window.c
diff options
context:
space:
mode:
authorEli Zaretskii2012-11-13 16:17:18 +0200
committerEli Zaretskii2012-11-13 16:17:18 +0200
commit3c4ca7155293ffc2d04708007131bcbc882d8913 (patch)
tree61787be8cd43b6fb3d5159852fbd186eea404de7 /src/window.c
parent5ade42a5114255c43117065494b96d480c1e1588 (diff)
parentc708524567662c8911c5ab2695acc7bda0383705 (diff)
downloademacs-3c4ca7155293ffc2d04708007131bcbc882d8913.tar.gz
emacs-3c4ca7155293ffc2d04708007131bcbc882d8913.zip
Merge from trunk.
Diffstat (limited to 'src/window.c')
-rw-r--r--src/window.c239
1 files changed, 107 insertions, 132 deletions
diff --git a/src/window.c b/src/window.c
index dfcabda59b9..9f3474fcd53 100644
--- a/src/window.c
+++ b/src/window.c
@@ -244,7 +244,7 @@ decode_live_window (register Lisp_Object window)
244 return XWINDOW (window); 244 return XWINDOW (window);
245} 245}
246 246
247static struct window * 247struct window *
248decode_any_window (register Lisp_Object window) 248decode_any_window (register Lisp_Object window)
249{ 249{
250 struct window *w; 250 struct window *w;
@@ -270,6 +270,15 @@ decode_valid_window (register Lisp_Object window)
270 return w; 270 return w;
271} 271}
272 272
273/* Build a frequently used 4-integer (X Y W H) list. */
274
275static Lisp_Object
276list4i (EMACS_INT x, EMACS_INT y, EMACS_INT w, EMACS_INT h)
277{
278 return list4 (make_number (x), make_number (y),
279 make_number (w), make_number (h));
280}
281
273DEFUN ("windowp", Fwindowp, Swindowp, 1, 1, 0, 282DEFUN ("windowp", Fwindowp, Swindowp, 1, 1, 0,
274 doc: /* Return t if OBJECT is a window and nil otherwise. */) 283 doc: /* Return t if OBJECT is a window and nil otherwise. */)
275 (Lisp_Object object) 284 (Lisp_Object object)
@@ -296,7 +305,7 @@ Internal windows and deleted windows are not live. */)
296} 305}
297 306
298/* Frames and windows. */ 307/* Frames and windows. */
299DEFUN ("window-frame", Fwindow_frame, Swindow_frame, 1, 1, 0, 308DEFUN ("window-frame", Fwindow_frame, Swindow_frame, 0, 1, 0,
300 doc: /* Return the frame that window WINDOW is on. 309 doc: /* Return the frame that window WINDOW is on.
301WINDOW must be a valid window and defaults to the selected one. */) 310WINDOW must be a valid window and defaults to the selected one. */)
302 (Lisp_Object window) 311 (Lisp_Object window)
@@ -331,10 +340,7 @@ DEFUN ("minibuffer-window", Fminibuffer_window, Sminibuffer_window, 0, 1, 0,
331If FRAME is omitted or nil, it defaults to the selected frame. */) 340If FRAME is omitted or nil, it defaults to the selected frame. */)
332 (Lisp_Object frame) 341 (Lisp_Object frame)
333{ 342{
334 if (NILP (frame)) 343 return FRAME_MINIBUF_WINDOW (decode_live_frame (frame));
335 frame = selected_frame;
336 CHECK_LIVE_FRAME (frame);
337 return FRAME_MINIBUF_WINDOW (XFRAME (frame));
338} 344}
339 345
340DEFUN ("window-minibuffer-p", Fwindow_minibuffer_p, 346DEFUN ("window-minibuffer-p", Fwindow_minibuffer_p,
@@ -556,7 +562,7 @@ Return nil for a window with no parent (e.g. a root window). */)
556 return decode_valid_window (window)->parent; 562 return decode_valid_window (window)->parent;
557} 563}
558 564
559DEFUN ("window-top-child", Fwindow_top_child, Swindow_top_child, 1, 1, 0, 565DEFUN ("window-top-child", Fwindow_top_child, Swindow_top_child, 0, 1, 0,
560 doc: /* Return the topmost child window of window WINDOW. 566 doc: /* Return the topmost child window of window WINDOW.
561WINDOW must be a valid window and defaults to the selected one. 567WINDOW must be a valid window and defaults to the selected one.
562Return nil if WINDOW is a live window (live windows have no children). 568Return nil if WINDOW is a live window (live windows have no children).
@@ -564,11 +570,10 @@ Return nil if WINDOW is an internal window whose children form a
564horizontal combination. */) 570horizontal combination. */)
565 (Lisp_Object window) 571 (Lisp_Object window)
566{ 572{
567 CHECK_WINDOW (window);
568 return decode_valid_window (window)->vchild; 573 return decode_valid_window (window)->vchild;
569} 574}
570 575
571DEFUN ("window-left-child", Fwindow_left_child, Swindow_left_child, 1, 1, 0, 576DEFUN ("window-left-child", Fwindow_left_child, Swindow_left_child, 0, 1, 0,
572 doc: /* Return the leftmost child window of window WINDOW. 577 doc: /* Return the leftmost child window of window WINDOW.
573WINDOW must be a valid window and defaults to the selected one. 578WINDOW must be a valid window and defaults to the selected one.
574Return nil if WINDOW is a live window (live windows have no children). 579Return nil if WINDOW is a live window (live windows have no children).
@@ -576,7 +581,6 @@ Return nil if WINDOW is an internal window whose children form a
576vertical combination. */) 581vertical combination. */)
577 (Lisp_Object window) 582 (Lisp_Object window)
578{ 583{
579 CHECK_WINDOW (window);
580 return decode_valid_window (window)->hchild; 584 return decode_valid_window (window)->hchild;
581} 585}
582 586
@@ -600,22 +604,27 @@ Return nil if WINDOW has no previous sibling. */)
600 604
601DEFUN ("window-combination-limit", Fwindow_combination_limit, Swindow_combination_limit, 1, 1, 0, 605DEFUN ("window-combination-limit", Fwindow_combination_limit, Swindow_combination_limit, 1, 1, 0,
602 doc: /* Return combination limit of window WINDOW. 606 doc: /* Return combination limit of window WINDOW.
603WINDOW must be a valid window and defaults to the selected one.
604If the return value is nil, child windows of WINDOW can be recombined with 607If the return value is nil, child windows of WINDOW can be recombined with
605WINDOW's siblings. A return value of t means that child windows of 608WINDOW's siblings. A return value of t means that child windows of
606WINDOW are never \(re-)combined with WINDOW's siblings. */) 609WINDOW are never \(re-)combined with WINDOW's siblings.
610
611WINDOW must be a valid window. The return value is meaningful for
612internal windows only. */)
607 (Lisp_Object window) 613 (Lisp_Object window)
608{ 614{
609 return decode_valid_window (window)->combination_limit; 615 CHECK_VALID_WINDOW (window);
616 return XWINDOW (window)->combination_limit;
610} 617}
611 618
612DEFUN ("set-window-combination-limit", Fset_window_combination_limit, Sset_window_combination_limit, 2, 2, 0, 619DEFUN ("set-window-combination-limit", Fset_window_combination_limit, Sset_window_combination_limit, 2, 2, 0,
613 doc: /* Set combination limit of window WINDOW to LIMIT; return LIMIT. 620 doc: /* Set combination limit of window WINDOW to LIMIT; return LIMIT.
614WINDOW must be a valid window and defaults to the selected one.
615If LIMIT is nil, child windows of WINDOW can be recombined with WINDOW's 621If LIMIT is nil, child windows of WINDOW can be recombined with WINDOW's
616siblings. LIMIT t means that child windows of WINDOW are never 622siblings. LIMIT t means that child windows of WINDOW are never
617\(re-)combined with WINDOW's siblings. Other values are reserved for 623\(re-)combined with WINDOW's siblings. Other values are reserved for
618future use. */) 624future use.
625
626WINDOW must be a valid window. Setting the combination limit is
627meaningful for internal windows only. */)
619 (Lisp_Object window, Lisp_Object limit) 628 (Lisp_Object window, Lisp_Object limit)
620{ 629{
621 wset_combination_limit (decode_valid_window (window), limit); 630 wset_combination_limit (decode_valid_window (window), limit);
@@ -774,8 +783,7 @@ area is only partially visible, that counts as a whole line; to
774exclude partially-visible lines, use `window-text-height'. */) 783exclude partially-visible lines, use `window-text-height'. */)
775 (Lisp_Object window) 784 (Lisp_Object window)
776{ 785{
777 struct window *w = decode_live_window (window); 786 return make_number (window_body_lines (decode_live_window (window)));
778 return make_number (window_body_lines (w));
779} 787}
780 788
781DEFUN ("window-body-width", Fwindow_body_width, Swindow_body_width, 0, 1, 0, 789DEFUN ("window-body-width", Fwindow_body_width, Swindow_body_width, 0, 1, 0,
@@ -787,8 +795,7 @@ marginal areas, or scroll bars. On a graphical display, the width is
787expressed as an integer multiple of the default character width. */) 795expressed as an integer multiple of the default character width. */)
788 (Lisp_Object window) 796 (Lisp_Object window)
789{ 797{
790 struct window *w = decode_live_window (window); 798 return make_number (window_body_cols (decode_live_window (window)));
791 return make_number (window_body_cols (w));
792} 799}
793 800
794DEFUN ("window-hscroll", Fwindow_hscroll, Swindow_hscroll, 0, 1, 0, 801DEFUN ("window-hscroll", Fwindow_hscroll, Swindow_hscroll, 0, 1, 0,
@@ -831,10 +838,8 @@ Note that if `automatic-hscrolling' is non-nil, you cannot scroll the
831window so that the location of point moves off-window. */) 838window so that the location of point moves off-window. */)
832 (Lisp_Object window, Lisp_Object ncol) 839 (Lisp_Object window, Lisp_Object ncol)
833{ 840{
834 struct window *w = decode_live_window (window);
835
836 CHECK_NUMBER (ncol); 841 CHECK_NUMBER (ncol);
837 return set_window_hscroll (w, XINT (ncol)); 842 return set_window_hscroll (decode_live_window (window), XINT (ncol));
838} 843}
839 844
840DEFUN ("window-redisplay-end-trigger", Fwindow_redisplay_end_trigger, 845DEFUN ("window-redisplay-end-trigger", Fwindow_redisplay_end_trigger,
@@ -879,11 +884,8 @@ header line, and/or mode line. For the edges of just the text area, use
879{ 884{
880 register struct window *w = decode_valid_window (window); 885 register struct window *w = decode_valid_window (window);
881 886
882 return Fcons (make_number (WINDOW_LEFT_EDGE_COL (w)), 887 return list4i (WINDOW_LEFT_EDGE_COL (w), WINDOW_TOP_EDGE_LINE (w),
883 Fcons (make_number (WINDOW_TOP_EDGE_LINE (w)), 888 WINDOW_RIGHT_EDGE_COL (w), WINDOW_BOTTOM_EDGE_LINE (w));
884 Fcons (make_number (WINDOW_RIGHT_EDGE_COL (w)),
885 Fcons (make_number (WINDOW_BOTTOM_EDGE_LINE (w)),
886 Qnil))));
887} 889}
888 890
889DEFUN ("window-pixel-edges", Fwindow_pixel_edges, Swindow_pixel_edges, 0, 1, 0, 891DEFUN ("window-pixel-edges", Fwindow_pixel_edges, Swindow_pixel_edges, 0, 1, 0,
@@ -902,11 +904,8 @@ of just the text area, use `window-inside-pixel-edges'. */)
902{ 904{
903 register struct window *w = decode_valid_window (window); 905 register struct window *w = decode_valid_window (window);
904 906
905 return Fcons (make_number (WINDOW_LEFT_EDGE_X (w)), 907 return list4i (WINDOW_LEFT_EDGE_X (w), WINDOW_TOP_EDGE_Y (w),
906 Fcons (make_number (WINDOW_TOP_EDGE_Y (w)), 908 WINDOW_RIGHT_EDGE_X (w), WINDOW_BOTTOM_EDGE_Y (w));
907 Fcons (make_number (WINDOW_RIGHT_EDGE_X (w)),
908 Fcons (make_number (WINDOW_BOTTOM_EDGE_Y (w)),
909 Qnil))));
910} 909}
911 910
912static void 911static void
@@ -948,13 +947,13 @@ of just the text area, use `window-inside-absolute-pixel-edges'. */)
948{ 947{
949 register struct window *w = decode_valid_window (window); 948 register struct window *w = decode_valid_window (window);
950 int add_x, add_y; 949 int add_x, add_y;
950
951 calc_absolute_offset (w, &add_x, &add_y); 951 calc_absolute_offset (w, &add_x, &add_y);
952 952
953 return Fcons (make_number (WINDOW_LEFT_EDGE_X (w) + add_x), 953 return list4i (WINDOW_LEFT_EDGE_X (w) + add_x,
954 Fcons (make_number (WINDOW_TOP_EDGE_Y (w) + add_y), 954 WINDOW_TOP_EDGE_Y (w) + add_y,
955 Fcons (make_number (WINDOW_RIGHT_EDGE_X (w) + add_x), 955 WINDOW_RIGHT_EDGE_X (w) + add_x,
956 Fcons (make_number (WINDOW_BOTTOM_EDGE_Y (w) + add_y), 956 WINDOW_BOTTOM_EDGE_Y (w) + add_y);
957 Qnil))));
958} 957}
959 958
960DEFUN ("window-inside-edges", Fwindow_inside_edges, Swindow_inside_edges, 0, 1, 0, 959DEFUN ("window-inside-edges", Fwindow_inside_edges, Swindow_inside_edges, 0, 1, 0,
@@ -973,16 +972,16 @@ display margins, fringes, header line, and/or mode line. */)
973{ 972{
974 register struct window *w = decode_live_window (window); 973 register struct window *w = decode_live_window (window);
975 974
976 return list4 (make_number (WINDOW_BOX_LEFT_EDGE_COL (w) 975 return list4i ((WINDOW_BOX_LEFT_EDGE_COL (w)
977 + WINDOW_LEFT_MARGIN_COLS (w) 976 + WINDOW_LEFT_MARGIN_COLS (w)
978 + WINDOW_LEFT_FRINGE_COLS (w)), 977 + WINDOW_LEFT_FRINGE_COLS (w)),
979 make_number (WINDOW_TOP_EDGE_LINE (w) 978 (WINDOW_TOP_EDGE_LINE (w)
980 + WINDOW_HEADER_LINE_LINES (w)), 979 + WINDOW_HEADER_LINE_LINES (w)),
981 make_number (WINDOW_BOX_RIGHT_EDGE_COL (w) 980 (WINDOW_BOX_RIGHT_EDGE_COL (w)
982 - WINDOW_RIGHT_MARGIN_COLS (w) 981 - WINDOW_RIGHT_MARGIN_COLS (w)
983 - WINDOW_RIGHT_FRINGE_COLS (w)), 982 - WINDOW_RIGHT_FRINGE_COLS (w)),
984 make_number (WINDOW_BOTTOM_EDGE_LINE (w) 983 (WINDOW_BOTTOM_EDGE_LINE (w)
985 - WINDOW_MODE_LINE_LINES (w))); 984 - WINDOW_MODE_LINE_LINES (w)));
986} 985}
987 986
988DEFUN ("window-inside-pixel-edges", Fwindow_inside_pixel_edges, Swindow_inside_pixel_edges, 0, 1, 0, 987DEFUN ("window-inside-pixel-edges", Fwindow_inside_pixel_edges, Swindow_inside_pixel_edges, 0, 1, 0,
@@ -1000,16 +999,16 @@ display margins, fringes, header line, and/or mode line. */)
1000{ 999{
1001 register struct window *w = decode_live_window (window); 1000 register struct window *w = decode_live_window (window);
1002 1001
1003 return list4 (make_number (WINDOW_BOX_LEFT_EDGE_X (w) 1002 return list4i ((WINDOW_BOX_LEFT_EDGE_X (w)
1004 + WINDOW_LEFT_MARGIN_WIDTH (w) 1003 + WINDOW_LEFT_MARGIN_WIDTH (w)
1005 + WINDOW_LEFT_FRINGE_WIDTH (w)), 1004 + WINDOW_LEFT_FRINGE_WIDTH (w)),
1006 make_number (WINDOW_TOP_EDGE_Y (w) 1005 (WINDOW_TOP_EDGE_Y (w)
1007 + WINDOW_HEADER_LINE_HEIGHT (w)), 1006 + WINDOW_HEADER_LINE_HEIGHT (w)),
1008 make_number (WINDOW_BOX_RIGHT_EDGE_X (w) 1007 (WINDOW_BOX_RIGHT_EDGE_X (w)
1009 - WINDOW_RIGHT_MARGIN_WIDTH (w) 1008 - WINDOW_RIGHT_MARGIN_WIDTH (w)
1010 - WINDOW_RIGHT_FRINGE_WIDTH (w)), 1009 - WINDOW_RIGHT_FRINGE_WIDTH (w)),
1011 make_number (WINDOW_BOTTOM_EDGE_Y (w) 1010 (WINDOW_BOTTOM_EDGE_Y (w)
1012 - WINDOW_MODE_LINE_HEIGHT (w))); 1011 - WINDOW_MODE_LINE_HEIGHT (w)));
1013} 1012}
1014 1013
1015DEFUN ("window-inside-absolute-pixel-edges", 1014DEFUN ("window-inside-absolute-pixel-edges",
@@ -1029,18 +1028,19 @@ display margins, fringes, header line, and/or mode line. */)
1029{ 1028{
1030 register struct window *w = decode_live_window (window); 1029 register struct window *w = decode_live_window (window);
1031 int add_x, add_y; 1030 int add_x, add_y;
1031
1032 calc_absolute_offset (w, &add_x, &add_y); 1032 calc_absolute_offset (w, &add_x, &add_y);
1033 1033
1034 return list4 (make_number (WINDOW_BOX_LEFT_EDGE_X (w) 1034 return list4i ((WINDOW_BOX_LEFT_EDGE_X (w)
1035 + WINDOW_LEFT_MARGIN_WIDTH (w) 1035 + WINDOW_LEFT_MARGIN_WIDTH (w)
1036 + WINDOW_LEFT_FRINGE_WIDTH (w) + add_x), 1036 + WINDOW_LEFT_FRINGE_WIDTH (w) + add_x),
1037 make_number (WINDOW_TOP_EDGE_Y (w) 1037 (WINDOW_TOP_EDGE_Y (w)
1038 + WINDOW_HEADER_LINE_HEIGHT (w) + add_y), 1038 + WINDOW_HEADER_LINE_HEIGHT (w) + add_y),
1039 make_number (WINDOW_BOX_RIGHT_EDGE_X (w) 1039 (WINDOW_BOX_RIGHT_EDGE_X (w)
1040 - WINDOW_RIGHT_MARGIN_WIDTH (w) 1040 - WINDOW_RIGHT_MARGIN_WIDTH (w)
1041 - WINDOW_RIGHT_FRINGE_WIDTH (w) + add_x), 1041 - WINDOW_RIGHT_FRINGE_WIDTH (w) + add_x),
1042 make_number (WINDOW_BOTTOM_EDGE_Y (w) 1042 (WINDOW_BOTTOM_EDGE_Y (w)
1043 - WINDOW_MODE_LINE_HEIGHT (w) + add_y)); 1043 - WINDOW_MODE_LINE_HEIGHT (w) + add_y));
1044} 1044}
1045 1045
1046/* Test if the character at column X, row Y is within window W. 1046/* Test if the character at column X, row Y is within window W.
@@ -1373,12 +1373,7 @@ The top left corner of the frame is considered to be row 0,
1373column 0. */) 1373column 0. */)
1374 (Lisp_Object x, Lisp_Object y, Lisp_Object frame) 1374 (Lisp_Object x, Lisp_Object y, Lisp_Object frame)
1375{ 1375{
1376 struct frame *f; 1376 struct frame *f = decode_live_frame (frame);
1377
1378 if (NILP (frame))
1379 frame = selected_frame;
1380 CHECK_LIVE_FRAME (frame);
1381 f = XFRAME (frame);
1382 1377
1383 /* Check that arguments are integers or floats. */ 1378 /* Check that arguments are integers or floats. */
1384 CHECK_NUMBER_OR_FLOAT (x); 1379 CHECK_NUMBER_OR_FLOAT (x);
@@ -1626,8 +1621,7 @@ display row, and VPOS is the row number (0-based) containing POS. */)
1626 { 1621 {
1627 Lisp_Object part = Qnil; 1622 Lisp_Object part = Qnil;
1628 if (!fully_p) 1623 if (!fully_p)
1629 part = list4 (make_number (rtop), make_number (rbot), 1624 part = list4i (rtop, rbot, rowh, vpos);
1630 make_number (rowh), make_number (vpos));
1631 in_window = Fcons (make_number (x), 1625 in_window = Fcons (make_number (x),
1632 Fcons (make_number (y), part)); 1626 Fcons (make_number (y), part));
1633 } 1627 }
@@ -1693,23 +1687,19 @@ Return nil if window display is not up-to-date. In that case, use
1693 if (!WINDOW_WANTS_HEADER_LINE_P (w)) 1687 if (!WINDOW_WANTS_HEADER_LINE_P (w))
1694 return Qnil; 1688 return Qnil;
1695 row = MATRIX_HEADER_LINE_ROW (w->current_matrix); 1689 row = MATRIX_HEADER_LINE_ROW (w->current_matrix);
1696 if (!row->enabled_p) 1690 return row->enabled_p ? list4i (row->height, 0, 0, 0) : Qnil;
1697 return Qnil;
1698 return list4 (make_number (row->height),
1699 make_number (0), make_number (0),
1700 make_number (0));
1701 } 1691 }
1702 1692
1703 if (EQ (line, Qmode_line)) 1693 if (EQ (line, Qmode_line))
1704 { 1694 {
1705 row = MATRIX_MODE_LINE_ROW (w->current_matrix); 1695 row = MATRIX_MODE_LINE_ROW (w->current_matrix);
1706 if (!row->enabled_p) 1696 return (row->enabled_p ?
1707 return Qnil; 1697 list4i (row->height,
1708 return list4 (make_number (row->height), 1698 0, /* not accurate */
1709 make_number (0), /* not accurate */ 1699 (WINDOW_HEADER_LINE_HEIGHT (w)
1710 make_number (WINDOW_HEADER_LINE_HEIGHT (w) 1700 + window_text_bottom_y (w)),
1711 + window_text_bottom_y (w)), 1701 0)
1712 make_number (0)); 1702 : Qnil);
1713 } 1703 }
1714 1704
1715 CHECK_NUMBER (line); 1705 CHECK_NUMBER (line);
@@ -1738,10 +1728,7 @@ Return nil if window display is not up-to-date. In that case, use
1738 1728
1739 found_row: 1729 found_row:
1740 crop = max (0, (row->y + row->height) - max_y); 1730 crop = max (0, (row->y + row->height) - max_y);
1741 return list4 (make_number (row->height + min (0, row->y) - crop), 1731 return list4i (row->height + min (0, row->y) - crop, i, row->y, crop);
1742 make_number (i),
1743 make_number (row->y),
1744 make_number (crop));
1745} 1732}
1746 1733
1747DEFUN ("window-dedicated-p", Fwindow_dedicated_p, Swindow_dedicated_p, 1734DEFUN ("window-dedicated-p", Fwindow_dedicated_p, Swindow_dedicated_p,
@@ -2146,10 +2133,10 @@ window_list (void)
2146{ 2133{
2147 if (!CONSP (Vwindow_list)) 2134 if (!CONSP (Vwindow_list))
2148 { 2135 {
2149 Lisp_Object tail; 2136 Lisp_Object tail, frame;
2150 2137
2151 Vwindow_list = Qnil; 2138 Vwindow_list = Qnil;
2152 for (tail = Vframe_list; CONSP (tail); tail = XCDR (tail)) 2139 FOR_EACH_FRAME (tail, frame)
2153 { 2140 {
2154 Lisp_Object args[2]; 2141 Lisp_Object args[2];
2155 2142
@@ -2157,7 +2144,7 @@ window_list (void)
2157 new windows at the front of args[1], which means we 2144 new windows at the front of args[1], which means we
2158 have to reverse this list at the end. */ 2145 have to reverse this list at the end. */
2159 args[1] = Qnil; 2146 args[1] = Qnil;
2160 foreach_window (XFRAME (XCAR (tail)), add_window_to_list, &args[1]); 2147 foreach_window (XFRAME (frame), add_window_to_list, &args[1]);
2161 args[0] = Vwindow_list; 2148 args[0] = Vwindow_list;
2162 args[1] = Fnreverse (args[1]); 2149 args[1] = Fnreverse (args[1]);
2163 Vwindow_list = Fnconc (2, args); 2150 Vwindow_list = Fnconc (2, args);
@@ -2252,11 +2239,9 @@ candidate_window_p (Lisp_Object window, Lisp_Object owindow, Lisp_Object minibuf
2252static void 2239static void
2253decode_next_window_args (Lisp_Object *window, Lisp_Object *minibuf, Lisp_Object *all_frames) 2240decode_next_window_args (Lisp_Object *window, Lisp_Object *minibuf, Lisp_Object *all_frames)
2254{ 2241{
2255 if (NILP (*window)) 2242 struct window *w = decode_live_window (*window);
2256 *window = selected_window;
2257 else
2258 CHECK_LIVE_WINDOW (*window);
2259 2243
2244 XSETWINDOW (*window, w);
2260 /* MINIBUF nil may or may not include minibuffers. Decide if it 2245 /* MINIBUF nil may or may not include minibuffers. Decide if it
2261 does. */ 2246 does. */
2262 if (NILP (*minibuf)) 2247 if (NILP (*minibuf))
@@ -2272,7 +2257,7 @@ decode_next_window_args (Lisp_Object *window, Lisp_Object *minibuf, Lisp_Object
2272 if (NILP (*all_frames)) 2257 if (NILP (*all_frames))
2273 *all_frames 2258 *all_frames
2274 = (!EQ (*minibuf, Qlambda) 2259 = (!EQ (*minibuf, Qlambda)
2275 ? FRAME_MINIBUF_WINDOW (XFRAME (XWINDOW (*window)->frame)) 2260 ? FRAME_MINIBUF_WINDOW (XFRAME (w->frame))
2276 : Qnil); 2261 : Qnil);
2277 else if (EQ (*all_frames, Qvisible)) 2262 else if (EQ (*all_frames, Qvisible))
2278 ; 2263 ;
@@ -3122,12 +3107,12 @@ run_window_configuration_change_hook (struct frame *f)
3122} 3107}
3123 3108
3124DEFUN ("run-window-configuration-change-hook", Frun_window_configuration_change_hook, 3109DEFUN ("run-window-configuration-change-hook", Frun_window_configuration_change_hook,
3125 Srun_window_configuration_change_hook, 1, 1, 0, 3110 Srun_window_configuration_change_hook, 0, 1, 0,
3126 doc: /* Run `window-configuration-change-hook' for FRAME. */) 3111 doc: /* Run `window-configuration-change-hook' for FRAME.
3112If FRAME is omitted or nil, it defaults to the selected frame. */)
3127 (Lisp_Object frame) 3113 (Lisp_Object frame)
3128{ 3114{
3129 CHECK_LIVE_FRAME (frame); 3115 run_window_configuration_change_hook (decode_live_frame (frame));
3130 run_window_configuration_change_hook (XFRAME (frame));
3131 return Qnil; 3116 return Qnil;
3132} 3117}
3133 3118
@@ -3654,10 +3639,12 @@ window_resize_apply (struct window *w, int horflag)
3654} 3639}
3655 3640
3656 3641
3657DEFUN ("window-resize-apply", Fwindow_resize_apply, Swindow_resize_apply, 1, 2, 0, 3642DEFUN ("window-resize-apply", Fwindow_resize_apply, Swindow_resize_apply, 0, 2, 0,
3658 doc: /* Apply requested size values for window-tree of FRAME. 3643 doc: /* Apply requested size values for window-tree of FRAME.
3659Optional argument HORIZONTAL omitted or nil means apply requested height 3644If FRAME is omitted or nil, it defaults to the selected frame.
3660values. HORIZONTAL non-nil means apply requested width values. 3645
3646Optional argument HORIZONTAL omitted or nil means apply requested
3647height values. HORIZONTAL non-nil means apply requested width values.
3661 3648
3662This function checks whether the requested values sum up to a valid 3649This function checks whether the requested values sum up to a valid
3663window layout, recursively assigns the new sizes of all child windows 3650window layout, recursively assigns the new sizes of all child windows
@@ -3668,17 +3655,10 @@ Note: This function does not check any of `window-fixed-size-p',
3668be applied on the Elisp level. */) 3655be applied on the Elisp level. */)
3669 (Lisp_Object frame, Lisp_Object horizontal) 3656 (Lisp_Object frame, Lisp_Object horizontal)
3670{ 3657{
3671 struct frame *f; 3658 struct frame *f = decode_live_frame (frame);
3672 struct window *r; 3659 struct window *r = XWINDOW (FRAME_ROOT_WINDOW (f));
3673 int horflag = !NILP (horizontal); 3660 int horflag = !NILP (horizontal);
3674 3661
3675 if (NILP (frame))
3676 frame = selected_frame;
3677 CHECK_LIVE_FRAME (frame);
3678
3679 f = XFRAME (frame);
3680 r = XWINDOW (FRAME_ROOT_WINDOW (f));
3681
3682 if (!window_resize_check (r, horflag) 3662 if (!window_resize_check (r, horflag)
3683 || ! EQ (r->new_total, 3663 || ! EQ (r->new_total,
3684 (horflag ? r->total_cols : r->total_lines))) 3664 (horflag ? r->total_cols : r->total_lines)))
@@ -3892,9 +3872,10 @@ set correctly. See the code of `split-window' for how this is done. */)
3892 3872
3893 make_parent_window (old, horflag); 3873 make_parent_window (old, horflag);
3894 p = XWINDOW (o->parent); 3874 p = XWINDOW (o->parent);
3895 /* Store t in the new parent's combination_limit slot to avoid 3875 if (EQ (Vwindow_combination_limit, Qt))
3896 that its children get merged into another window. */ 3876 /* Store t in the new parent's combination_limit slot to avoid
3897 wset_combination_limit (p, Qt); 3877 that its children get merged into another window. */
3878 wset_combination_limit (p, Qt);
3898 /* These get applied below. */ 3879 /* These get applied below. */
3899 wset_new_total (p, horflag ? o->total_cols : o->total_lines); 3880 wset_new_total (p, horflag ? o->total_cols : o->total_lines);
3900 wset_new_normal (p, new_normal); 3881 wset_new_normal (p, new_normal);
@@ -6161,12 +6142,7 @@ saved by this function. */)
6161 register int n_windows; 6142 register int n_windows;
6162 register struct save_window_data *data; 6143 register struct save_window_data *data;
6163 register int i; 6144 register int i;
6164 FRAME_PTR f; 6145 struct frame *f = decode_live_frame (frame);
6165
6166 if (NILP (frame))
6167 frame = selected_frame;
6168 CHECK_LIVE_FRAME (frame);
6169 f = XFRAME (frame);
6170 6146
6171 n_windows = count_windows (XWINDOW (FRAME_ROOT_WINDOW (f))); 6147 n_windows = count_windows (XWINDOW (FRAME_ROOT_WINDOW (f)));
6172 data = ALLOCATE_PSEUDOVECTOR (struct save_window_data, frame_cols, 6148 data = ALLOCATE_PSEUDOVECTOR (struct save_window_data, frame_cols,
@@ -6319,10 +6295,9 @@ Value is a list of the form (LEFT-WIDTH RIGHT-WIDTH OUTSIDE-MARGINS). */)
6319{ 6295{
6320 struct window *w = decode_live_window (window); 6296 struct window *w = decode_live_window (window);
6321 6297
6322 return Fcons (make_number (WINDOW_LEFT_FRINGE_WIDTH (w)), 6298 return list3 (make_number (WINDOW_LEFT_FRINGE_WIDTH (w)),
6323 Fcons (make_number (WINDOW_RIGHT_FRINGE_WIDTH (w)), 6299 make_number (WINDOW_RIGHT_FRINGE_WIDTH (w)),
6324 Fcons ((WINDOW_HAS_FRINGES_OUTSIDE_MARGINS (w) 6300 WINDOW_HAS_FRINGES_OUTSIDE_MARGINS (w) ? Qt : Qnil);
6325 ? Qt : Qnil), Qnil)));
6326} 6301}
6327 6302
6328 6303
@@ -6391,12 +6366,12 @@ value. */)
6391 (Lisp_Object window) 6366 (Lisp_Object window)
6392{ 6367{
6393 struct window *w = decode_live_window (window); 6368 struct window *w = decode_live_window (window);
6394 return Fcons (make_number ((WINDOW_CONFIG_SCROLL_BAR_WIDTH (w) 6369
6370 return list4 (make_number ((WINDOW_CONFIG_SCROLL_BAR_WIDTH (w)
6395 ? WINDOW_CONFIG_SCROLL_BAR_WIDTH (w) 6371 ? WINDOW_CONFIG_SCROLL_BAR_WIDTH (w)
6396 : WINDOW_SCROLL_BAR_AREA_WIDTH (w))), 6372 : WINDOW_SCROLL_BAR_AREA_WIDTH (w))),
6397 Fcons (make_number (WINDOW_SCROLL_BAR_COLS (w)), 6373 make_number (WINDOW_SCROLL_BAR_COLS (w)),
6398 Fcons (w->vertical_scroll_bar_type, 6374 w->vertical_scroll_bar_type, Qnil);
6399 Fcons (Qnil, Qnil))));
6400} 6375}
6401 6376
6402 6377