diff options
Diffstat (limited to 'src/window.c')
| -rw-r--r-- | src/window.c | 219 |
1 files changed, 95 insertions, 124 deletions
diff --git a/src/window.c b/src/window.c index c34e0d9300e..514119abef5 100644 --- a/src/window.c +++ b/src/window.c | |||
| @@ -245,7 +245,7 @@ decode_live_window (register Lisp_Object window) | |||
| 245 | return XWINDOW (window); | 245 | return XWINDOW (window); |
| 246 | } | 246 | } |
| 247 | 247 | ||
| 248 | static struct window * | 248 | struct window * |
| 249 | decode_any_window (register Lisp_Object window) | 249 | decode_any_window (register Lisp_Object window) |
| 250 | { | 250 | { |
| 251 | struct window *w; | 251 | struct window *w; |
| @@ -271,6 +271,15 @@ decode_valid_window (register Lisp_Object window) | |||
| 271 | return w; | 271 | return w; |
| 272 | } | 272 | } |
| 273 | 273 | ||
| 274 | /* Build a frequently used 4-integer (X Y W H) list. */ | ||
| 275 | |||
| 276 | static Lisp_Object | ||
| 277 | quad (EMACS_INT x, EMACS_INT y, EMACS_INT w, EMACS_INT h) | ||
| 278 | { | ||
| 279 | return list4 (make_number (x), make_number (y), | ||
| 280 | make_number (w), make_number (h)); | ||
| 281 | } | ||
| 282 | |||
| 274 | DEFUN ("windowp", Fwindowp, Swindowp, 1, 1, 0, | 283 | DEFUN ("windowp", Fwindowp, Swindowp, 1, 1, 0, |
| 275 | doc: /* Return t if OBJECT is a window and nil otherwise. */) | 284 | doc: /* Return t if OBJECT is a window and nil otherwise. */) |
| 276 | (Lisp_Object object) | 285 | (Lisp_Object object) |
| @@ -297,7 +306,7 @@ Internal windows and deleted windows are not live. */) | |||
| 297 | } | 306 | } |
| 298 | 307 | ||
| 299 | /* Frames and windows. */ | 308 | /* Frames and windows. */ |
| 300 | DEFUN ("window-frame", Fwindow_frame, Swindow_frame, 1, 1, 0, | 309 | DEFUN ("window-frame", Fwindow_frame, Swindow_frame, 0, 1, 0, |
| 301 | doc: /* Return the frame that window WINDOW is on. | 310 | doc: /* Return the frame that window WINDOW is on. |
| 302 | WINDOW must be a valid window and defaults to the selected one. */) | 311 | WINDOW must be a valid window and defaults to the selected one. */) |
| 303 | (Lisp_Object window) | 312 | (Lisp_Object window) |
| @@ -332,10 +341,7 @@ DEFUN ("minibuffer-window", Fminibuffer_window, Sminibuffer_window, 0, 1, 0, | |||
| 332 | If FRAME is omitted or nil, it defaults to the selected frame. */) | 341 | If FRAME is omitted or nil, it defaults to the selected frame. */) |
| 333 | (Lisp_Object frame) | 342 | (Lisp_Object frame) |
| 334 | { | 343 | { |
| 335 | if (NILP (frame)) | 344 | return FRAME_MINIBUF_WINDOW (decode_live_frame (frame)); |
| 336 | frame = selected_frame; | ||
| 337 | CHECK_LIVE_FRAME (frame); | ||
| 338 | return FRAME_MINIBUF_WINDOW (XFRAME (frame)); | ||
| 339 | } | 345 | } |
| 340 | 346 | ||
| 341 | DEFUN ("window-minibuffer-p", Fwindow_minibuffer_p, | 347 | DEFUN ("window-minibuffer-p", Fwindow_minibuffer_p, |
| @@ -557,7 +563,7 @@ Return nil for a window with no parent (e.g. a root window). */) | |||
| 557 | return decode_valid_window (window)->parent; | 563 | return decode_valid_window (window)->parent; |
| 558 | } | 564 | } |
| 559 | 565 | ||
| 560 | DEFUN ("window-top-child", Fwindow_top_child, Swindow_top_child, 1, 1, 0, | 566 | DEFUN ("window-top-child", Fwindow_top_child, Swindow_top_child, 0, 1, 0, |
| 561 | doc: /* Return the topmost child window of window WINDOW. | 567 | doc: /* Return the topmost child window of window WINDOW. |
| 562 | WINDOW must be a valid window and defaults to the selected one. | 568 | WINDOW must be a valid window and defaults to the selected one. |
| 563 | Return nil if WINDOW is a live window (live windows have no children). | 569 | Return nil if WINDOW is a live window (live windows have no children). |
| @@ -565,11 +571,10 @@ Return nil if WINDOW is an internal window whose children form a | |||
| 565 | horizontal combination. */) | 571 | horizontal combination. */) |
| 566 | (Lisp_Object window) | 572 | (Lisp_Object window) |
| 567 | { | 573 | { |
| 568 | CHECK_WINDOW (window); | ||
| 569 | return decode_valid_window (window)->vchild; | 574 | return decode_valid_window (window)->vchild; |
| 570 | } | 575 | } |
| 571 | 576 | ||
| 572 | DEFUN ("window-left-child", Fwindow_left_child, Swindow_left_child, 1, 1, 0, | 577 | DEFUN ("window-left-child", Fwindow_left_child, Swindow_left_child, 0, 1, 0, |
| 573 | doc: /* Return the leftmost child window of window WINDOW. | 578 | doc: /* Return the leftmost child window of window WINDOW. |
| 574 | WINDOW must be a valid window and defaults to the selected one. | 579 | WINDOW must be a valid window and defaults to the selected one. |
| 575 | Return nil if WINDOW is a live window (live windows have no children). | 580 | Return nil if WINDOW is a live window (live windows have no children). |
| @@ -577,7 +582,6 @@ Return nil if WINDOW is an internal window whose children form a | |||
| 577 | vertical combination. */) | 582 | vertical combination. */) |
| 578 | (Lisp_Object window) | 583 | (Lisp_Object window) |
| 579 | { | 584 | { |
| 580 | CHECK_WINDOW (window); | ||
| 581 | return decode_valid_window (window)->hchild; | 585 | return decode_valid_window (window)->hchild; |
| 582 | } | 586 | } |
| 583 | 587 | ||
| @@ -601,13 +605,16 @@ Return nil if WINDOW has no previous sibling. */) | |||
| 601 | 605 | ||
| 602 | DEFUN ("window-combination-limit", Fwindow_combination_limit, Swindow_combination_limit, 1, 1, 0, | 606 | DEFUN ("window-combination-limit", Fwindow_combination_limit, Swindow_combination_limit, 1, 1, 0, |
| 603 | doc: /* Return combination limit of window WINDOW. | 607 | doc: /* Return combination limit of window WINDOW. |
| 604 | WINDOW must be a valid window and defaults to the selected one. | ||
| 605 | If the return value is nil, child windows of WINDOW can be recombined with | 608 | If the return value is nil, child windows of WINDOW can be recombined with |
| 606 | WINDOW's siblings. A return value of t means that child windows of | 609 | WINDOW's siblings. A return value of t means that child windows of |
| 607 | WINDOW are never \(re-)combined with WINDOW's siblings. */) | 610 | WINDOW are never \(re-)combined with WINDOW's siblings. |
| 611 | |||
| 612 | WINDOW must be a valid window. The return value is meaningful for | ||
| 613 | internal windows only. */) | ||
| 608 | (Lisp_Object window) | 614 | (Lisp_Object window) |
| 609 | { | 615 | { |
| 610 | return decode_valid_window (window)->combination_limit; | 616 | CHECK_VALID_WINDOW (window); |
| 617 | return XWINDOW (window)->combination_limit; | ||
| 611 | } | 618 | } |
| 612 | 619 | ||
| 613 | DEFUN ("set-window-combination-limit", Fset_window_combination_limit, Sset_window_combination_limit, 2, 2, 0, | 620 | DEFUN ("set-window-combination-limit", Fset_window_combination_limit, Sset_window_combination_limit, 2, 2, 0, |
| @@ -775,8 +782,7 @@ area is only partially visible, that counts as a whole line; to | |||
| 775 | exclude partially-visible lines, use `window-text-height'. */) | 782 | exclude partially-visible lines, use `window-text-height'. */) |
| 776 | (Lisp_Object window) | 783 | (Lisp_Object window) |
| 777 | { | 784 | { |
| 778 | struct window *w = decode_live_window (window); | 785 | return make_number (window_body_lines (decode_live_window (window))); |
| 779 | return make_number (window_body_lines (w)); | ||
| 780 | } | 786 | } |
| 781 | 787 | ||
| 782 | DEFUN ("window-body-width", Fwindow_body_width, Swindow_body_width, 0, 1, 0, | 788 | DEFUN ("window-body-width", Fwindow_body_width, Swindow_body_width, 0, 1, 0, |
| @@ -788,8 +794,7 @@ marginal areas, or scroll bars. On a graphical display, the width is | |||
| 788 | expressed as an integer multiple of the default character width. */) | 794 | expressed as an integer multiple of the default character width. */) |
| 789 | (Lisp_Object window) | 795 | (Lisp_Object window) |
| 790 | { | 796 | { |
| 791 | struct window *w = decode_live_window (window); | 797 | return make_number (window_body_cols (decode_live_window (window))); |
| 792 | return make_number (window_body_cols (w)); | ||
| 793 | } | 798 | } |
| 794 | 799 | ||
| 795 | DEFUN ("window-hscroll", Fwindow_hscroll, Swindow_hscroll, 0, 1, 0, | 800 | DEFUN ("window-hscroll", Fwindow_hscroll, Swindow_hscroll, 0, 1, 0, |
| @@ -832,10 +837,8 @@ Note that if `automatic-hscrolling' is non-nil, you cannot scroll the | |||
| 832 | window so that the location of point moves off-window. */) | 837 | window so that the location of point moves off-window. */) |
| 833 | (Lisp_Object window, Lisp_Object ncol) | 838 | (Lisp_Object window, Lisp_Object ncol) |
| 834 | { | 839 | { |
| 835 | struct window *w = decode_live_window (window); | ||
| 836 | |||
| 837 | CHECK_NUMBER (ncol); | 840 | CHECK_NUMBER (ncol); |
| 838 | return set_window_hscroll (w, XINT (ncol)); | 841 | return set_window_hscroll (decode_live_window (window), XINT (ncol)); |
| 839 | } | 842 | } |
| 840 | 843 | ||
| 841 | DEFUN ("window-redisplay-end-trigger", Fwindow_redisplay_end_trigger, | 844 | DEFUN ("window-redisplay-end-trigger", Fwindow_redisplay_end_trigger, |
| @@ -880,11 +883,8 @@ header line, and/or mode line. For the edges of just the text area, use | |||
| 880 | { | 883 | { |
| 881 | register struct window *w = decode_valid_window (window); | 884 | register struct window *w = decode_valid_window (window); |
| 882 | 885 | ||
| 883 | return Fcons (make_number (WINDOW_LEFT_EDGE_COL (w)), | 886 | return quad (WINDOW_LEFT_EDGE_COL (w), WINDOW_TOP_EDGE_LINE (w), |
| 884 | Fcons (make_number (WINDOW_TOP_EDGE_LINE (w)), | 887 | WINDOW_RIGHT_EDGE_COL (w), WINDOW_BOTTOM_EDGE_LINE (w)); |
| 885 | Fcons (make_number (WINDOW_RIGHT_EDGE_COL (w)), | ||
| 886 | Fcons (make_number (WINDOW_BOTTOM_EDGE_LINE (w)), | ||
| 887 | Qnil)))); | ||
| 888 | } | 888 | } |
| 889 | 889 | ||
| 890 | DEFUN ("window-pixel-edges", Fwindow_pixel_edges, Swindow_pixel_edges, 0, 1, 0, | 890 | DEFUN ("window-pixel-edges", Fwindow_pixel_edges, Swindow_pixel_edges, 0, 1, 0, |
| @@ -903,11 +903,8 @@ of just the text area, use `window-inside-pixel-edges'. */) | |||
| 903 | { | 903 | { |
| 904 | register struct window *w = decode_valid_window (window); | 904 | register struct window *w = decode_valid_window (window); |
| 905 | 905 | ||
| 906 | return Fcons (make_number (WINDOW_LEFT_EDGE_X (w)), | 906 | return quad (WINDOW_LEFT_EDGE_X (w), WINDOW_TOP_EDGE_Y (w), |
| 907 | Fcons (make_number (WINDOW_TOP_EDGE_Y (w)), | 907 | WINDOW_RIGHT_EDGE_X (w), WINDOW_BOTTOM_EDGE_Y (w)); |
| 908 | Fcons (make_number (WINDOW_RIGHT_EDGE_X (w)), | ||
| 909 | Fcons (make_number (WINDOW_BOTTOM_EDGE_Y (w)), | ||
| 910 | Qnil)))); | ||
| 911 | } | 908 | } |
| 912 | 909 | ||
| 913 | static void | 910 | static void |
| @@ -949,13 +946,13 @@ of just the text area, use `window-inside-absolute-pixel-edges'. */) | |||
| 949 | { | 946 | { |
| 950 | register struct window *w = decode_valid_window (window); | 947 | register struct window *w = decode_valid_window (window); |
| 951 | int add_x, add_y; | 948 | int add_x, add_y; |
| 949 | |||
| 952 | calc_absolute_offset (w, &add_x, &add_y); | 950 | calc_absolute_offset (w, &add_x, &add_y); |
| 953 | 951 | ||
| 954 | return Fcons (make_number (WINDOW_LEFT_EDGE_X (w) + add_x), | 952 | return quad (WINDOW_LEFT_EDGE_X (w) + add_x, |
| 955 | Fcons (make_number (WINDOW_TOP_EDGE_Y (w) + add_y), | 953 | WINDOW_TOP_EDGE_Y (w) + add_y, |
| 956 | Fcons (make_number (WINDOW_RIGHT_EDGE_X (w) + add_x), | 954 | WINDOW_RIGHT_EDGE_X (w) + add_x, |
| 957 | Fcons (make_number (WINDOW_BOTTOM_EDGE_Y (w) + add_y), | 955 | WINDOW_BOTTOM_EDGE_Y (w) + add_y); |
| 958 | Qnil)))); | ||
| 959 | } | 956 | } |
| 960 | 957 | ||
| 961 | DEFUN ("window-inside-edges", Fwindow_inside_edges, Swindow_inside_edges, 0, 1, 0, | 958 | DEFUN ("window-inside-edges", Fwindow_inside_edges, Swindow_inside_edges, 0, 1, 0, |
| @@ -974,16 +971,16 @@ display margins, fringes, header line, and/or mode line. */) | |||
| 974 | { | 971 | { |
| 975 | register struct window *w = decode_live_window (window); | 972 | register struct window *w = decode_live_window (window); |
| 976 | 973 | ||
| 977 | return list4 (make_number (WINDOW_BOX_LEFT_EDGE_COL (w) | 974 | return quad (WINDOW_BOX_LEFT_EDGE_COL (w) |
| 978 | + WINDOW_LEFT_MARGIN_COLS (w) | 975 | + WINDOW_LEFT_MARGIN_COLS (w) |
| 979 | + WINDOW_LEFT_FRINGE_COLS (w)), | 976 | + WINDOW_LEFT_FRINGE_COLS (w), |
| 980 | make_number (WINDOW_TOP_EDGE_LINE (w) | 977 | WINDOW_TOP_EDGE_LINE (w) |
| 981 | + WINDOW_HEADER_LINE_LINES (w)), | 978 | + WINDOW_HEADER_LINE_LINES (w), |
| 982 | make_number (WINDOW_BOX_RIGHT_EDGE_COL (w) | 979 | WINDOW_BOX_RIGHT_EDGE_COL (w) |
| 983 | - WINDOW_RIGHT_MARGIN_COLS (w) | 980 | - WINDOW_RIGHT_MARGIN_COLS (w) |
| 984 | - WINDOW_RIGHT_FRINGE_COLS (w)), | 981 | - WINDOW_RIGHT_FRINGE_COLS (w), |
| 985 | make_number (WINDOW_BOTTOM_EDGE_LINE (w) | 982 | WINDOW_BOTTOM_EDGE_LINE (w) |
| 986 | - WINDOW_MODE_LINE_LINES (w))); | 983 | - WINDOW_MODE_LINE_LINES (w)); |
| 987 | } | 984 | } |
| 988 | 985 | ||
| 989 | DEFUN ("window-inside-pixel-edges", Fwindow_inside_pixel_edges, Swindow_inside_pixel_edges, 0, 1, 0, | 986 | DEFUN ("window-inside-pixel-edges", Fwindow_inside_pixel_edges, Swindow_inside_pixel_edges, 0, 1, 0, |
| @@ -1001,16 +998,16 @@ display margins, fringes, header line, and/or mode line. */) | |||
| 1001 | { | 998 | { |
| 1002 | register struct window *w = decode_live_window (window); | 999 | register struct window *w = decode_live_window (window); |
| 1003 | 1000 | ||
| 1004 | return list4 (make_number (WINDOW_BOX_LEFT_EDGE_X (w) | 1001 | return quad (WINDOW_BOX_LEFT_EDGE_X (w) |
| 1005 | + WINDOW_LEFT_MARGIN_WIDTH (w) | 1002 | + WINDOW_LEFT_MARGIN_WIDTH (w) |
| 1006 | + WINDOW_LEFT_FRINGE_WIDTH (w)), | 1003 | + WINDOW_LEFT_FRINGE_WIDTH (w), |
| 1007 | make_number (WINDOW_TOP_EDGE_Y (w) | 1004 | WINDOW_TOP_EDGE_Y (w) |
| 1008 | + WINDOW_HEADER_LINE_HEIGHT (w)), | 1005 | + WINDOW_HEADER_LINE_HEIGHT (w), |
| 1009 | make_number (WINDOW_BOX_RIGHT_EDGE_X (w) | 1006 | WINDOW_BOX_RIGHT_EDGE_X (w) |
| 1010 | - WINDOW_RIGHT_MARGIN_WIDTH (w) | 1007 | - WINDOW_RIGHT_MARGIN_WIDTH (w) |
| 1011 | - WINDOW_RIGHT_FRINGE_WIDTH (w)), | 1008 | - WINDOW_RIGHT_FRINGE_WIDTH (w), |
| 1012 | make_number (WINDOW_BOTTOM_EDGE_Y (w) | 1009 | WINDOW_BOTTOM_EDGE_Y (w) |
| 1013 | - WINDOW_MODE_LINE_HEIGHT (w))); | 1010 | - WINDOW_MODE_LINE_HEIGHT (w)); |
| 1014 | } | 1011 | } |
| 1015 | 1012 | ||
| 1016 | DEFUN ("window-inside-absolute-pixel-edges", | 1013 | DEFUN ("window-inside-absolute-pixel-edges", |
| @@ -1030,18 +1027,19 @@ display margins, fringes, header line, and/or mode line. */) | |||
| 1030 | { | 1027 | { |
| 1031 | register struct window *w = decode_live_window (window); | 1028 | register struct window *w = decode_live_window (window); |
| 1032 | int add_x, add_y; | 1029 | int add_x, add_y; |
| 1030 | |||
| 1033 | calc_absolute_offset (w, &add_x, &add_y); | 1031 | calc_absolute_offset (w, &add_x, &add_y); |
| 1034 | 1032 | ||
| 1035 | return list4 (make_number (WINDOW_BOX_LEFT_EDGE_X (w) | 1033 | return quad (WINDOW_BOX_LEFT_EDGE_X (w) |
| 1036 | + WINDOW_LEFT_MARGIN_WIDTH (w) | 1034 | + WINDOW_LEFT_MARGIN_WIDTH (w) |
| 1037 | + WINDOW_LEFT_FRINGE_WIDTH (w) + add_x), | 1035 | + WINDOW_LEFT_FRINGE_WIDTH (w) + add_x, |
| 1038 | make_number (WINDOW_TOP_EDGE_Y (w) | 1036 | WINDOW_TOP_EDGE_Y (w) |
| 1039 | + WINDOW_HEADER_LINE_HEIGHT (w) + add_y), | 1037 | + WINDOW_HEADER_LINE_HEIGHT (w) + add_y, |
| 1040 | make_number (WINDOW_BOX_RIGHT_EDGE_X (w) | 1038 | WINDOW_BOX_RIGHT_EDGE_X (w) |
| 1041 | - WINDOW_RIGHT_MARGIN_WIDTH (w) | 1039 | - WINDOW_RIGHT_MARGIN_WIDTH (w) |
| 1042 | - WINDOW_RIGHT_FRINGE_WIDTH (w) + add_x), | 1040 | - WINDOW_RIGHT_FRINGE_WIDTH (w) + add_x, |
| 1043 | make_number (WINDOW_BOTTOM_EDGE_Y (w) | 1041 | WINDOW_BOTTOM_EDGE_Y (w) |
| 1044 | - WINDOW_MODE_LINE_HEIGHT (w) + add_y)); | 1042 | - WINDOW_MODE_LINE_HEIGHT (w) + add_y); |
| 1045 | } | 1043 | } |
| 1046 | 1044 | ||
| 1047 | /* Test if the character at column X, row Y is within window W. | 1045 | /* Test if the character at column X, row Y is within window W. |
| @@ -1374,12 +1372,7 @@ The top left corner of the frame is considered to be row 0, | |||
| 1374 | column 0. */) | 1372 | column 0. */) |
| 1375 | (Lisp_Object x, Lisp_Object y, Lisp_Object frame) | 1373 | (Lisp_Object x, Lisp_Object y, Lisp_Object frame) |
| 1376 | { | 1374 | { |
| 1377 | struct frame *f; | 1375 | struct frame *f = decode_live_frame (frame); |
| 1378 | |||
| 1379 | if (NILP (frame)) | ||
| 1380 | frame = selected_frame; | ||
| 1381 | CHECK_LIVE_FRAME (frame); | ||
| 1382 | f = XFRAME (frame); | ||
| 1383 | 1376 | ||
| 1384 | /* Check that arguments are integers or floats. */ | 1377 | /* Check that arguments are integers or floats. */ |
| 1385 | CHECK_NUMBER_OR_FLOAT (x); | 1378 | CHECK_NUMBER_OR_FLOAT (x); |
| @@ -1627,8 +1620,7 @@ display row, and VPOS is the row number (0-based) containing POS. */) | |||
| 1627 | { | 1620 | { |
| 1628 | Lisp_Object part = Qnil; | 1621 | Lisp_Object part = Qnil; |
| 1629 | if (!fully_p) | 1622 | if (!fully_p) |
| 1630 | part = list4 (make_number (rtop), make_number (rbot), | 1623 | part = quad (rtop, rbot, rowh, vpos); |
| 1631 | make_number (rowh), make_number (vpos)); | ||
| 1632 | in_window = Fcons (make_number (x), | 1624 | in_window = Fcons (make_number (x), |
| 1633 | Fcons (make_number (y), part)); | 1625 | Fcons (make_number (y), part)); |
| 1634 | } | 1626 | } |
| @@ -1694,23 +1686,18 @@ Return nil if window display is not up-to-date. In that case, use | |||
| 1694 | if (!WINDOW_WANTS_HEADER_LINE_P (w)) | 1686 | if (!WINDOW_WANTS_HEADER_LINE_P (w)) |
| 1695 | return Qnil; | 1687 | return Qnil; |
| 1696 | row = MATRIX_HEADER_LINE_ROW (w->current_matrix); | 1688 | row = MATRIX_HEADER_LINE_ROW (w->current_matrix); |
| 1697 | if (!row->enabled_p) | 1689 | return row->enabled_p ? quad (row->height, 0, 0, 0) : Qnil; |
| 1698 | return Qnil; | ||
| 1699 | return list4 (make_number (row->height), | ||
| 1700 | make_number (0), make_number (0), | ||
| 1701 | make_number (0)); | ||
| 1702 | } | 1690 | } |
| 1703 | 1691 | ||
| 1704 | if (EQ (line, Qmode_line)) | 1692 | if (EQ (line, Qmode_line)) |
| 1705 | { | 1693 | { |
| 1706 | row = MATRIX_MODE_LINE_ROW (w->current_matrix); | 1694 | row = MATRIX_MODE_LINE_ROW (w->current_matrix); |
| 1707 | if (!row->enabled_p) | 1695 | return (row->enabled_p ? |
| 1708 | return Qnil; | 1696 | quad (row->height, |
| 1709 | return list4 (make_number (row->height), | 1697 | 0, /* not accurate */ |
| 1710 | make_number (0), /* not accurate */ | 1698 | WINDOW_HEADER_LINE_HEIGHT (w) |
| 1711 | make_number (WINDOW_HEADER_LINE_HEIGHT (w) | 1699 | + window_text_bottom_y (w), 0) |
| 1712 | + window_text_bottom_y (w)), | 1700 | : Qnil); |
| 1713 | make_number (0)); | ||
| 1714 | } | 1701 | } |
| 1715 | 1702 | ||
| 1716 | CHECK_NUMBER (line); | 1703 | CHECK_NUMBER (line); |
| @@ -1739,10 +1726,7 @@ Return nil if window display is not up-to-date. In that case, use | |||
| 1739 | 1726 | ||
| 1740 | found_row: | 1727 | found_row: |
| 1741 | crop = max (0, (row->y + row->height) - max_y); | 1728 | crop = max (0, (row->y + row->height) - max_y); |
| 1742 | return list4 (make_number (row->height + min (0, row->y) - crop), | 1729 | return quad (row->height + min (0, row->y) - crop, i, row->y, crop); |
| 1743 | make_number (i), | ||
| 1744 | make_number (row->y), | ||
| 1745 | make_number (crop)); | ||
| 1746 | } | 1730 | } |
| 1747 | 1731 | ||
| 1748 | DEFUN ("window-dedicated-p", Fwindow_dedicated_p, Swindow_dedicated_p, | 1732 | DEFUN ("window-dedicated-p", Fwindow_dedicated_p, Swindow_dedicated_p, |
| @@ -2253,11 +2237,9 @@ candidate_window_p (Lisp_Object window, Lisp_Object owindow, Lisp_Object minibuf | |||
| 2253 | static void | 2237 | static void |
| 2254 | decode_next_window_args (Lisp_Object *window, Lisp_Object *minibuf, Lisp_Object *all_frames) | 2238 | decode_next_window_args (Lisp_Object *window, Lisp_Object *minibuf, Lisp_Object *all_frames) |
| 2255 | { | 2239 | { |
| 2256 | if (NILP (*window)) | 2240 | struct window *w = decode_live_window (*window); |
| 2257 | *window = selected_window; | ||
| 2258 | else | ||
| 2259 | CHECK_LIVE_WINDOW (*window); | ||
| 2260 | 2241 | ||
| 2242 | XSETWINDOW (*window, w); | ||
| 2261 | /* MINIBUF nil may or may not include minibuffers. Decide if it | 2243 | /* MINIBUF nil may or may not include minibuffers. Decide if it |
| 2262 | does. */ | 2244 | does. */ |
| 2263 | if (NILP (*minibuf)) | 2245 | if (NILP (*minibuf)) |
| @@ -2273,7 +2255,7 @@ decode_next_window_args (Lisp_Object *window, Lisp_Object *minibuf, Lisp_Object | |||
| 2273 | if (NILP (*all_frames)) | 2255 | if (NILP (*all_frames)) |
| 2274 | *all_frames | 2256 | *all_frames |
| 2275 | = (!EQ (*minibuf, Qlambda) | 2257 | = (!EQ (*minibuf, Qlambda) |
| 2276 | ? FRAME_MINIBUF_WINDOW (XFRAME (XWINDOW (*window)->frame)) | 2258 | ? FRAME_MINIBUF_WINDOW (XFRAME (w->frame)) |
| 2277 | : Qnil); | 2259 | : Qnil); |
| 2278 | else if (EQ (*all_frames, Qvisible)) | 2260 | else if (EQ (*all_frames, Qvisible)) |
| 2279 | ; | 2261 | ; |
| @@ -3123,12 +3105,12 @@ run_window_configuration_change_hook (struct frame *f) | |||
| 3123 | } | 3105 | } |
| 3124 | 3106 | ||
| 3125 | DEFUN ("run-window-configuration-change-hook", Frun_window_configuration_change_hook, | 3107 | DEFUN ("run-window-configuration-change-hook", Frun_window_configuration_change_hook, |
| 3126 | Srun_window_configuration_change_hook, 1, 1, 0, | 3108 | Srun_window_configuration_change_hook, 0, 1, 0, |
| 3127 | doc: /* Run `window-configuration-change-hook' for FRAME. */) | 3109 | doc: /* Run `window-configuration-change-hook' for FRAME. |
| 3110 | If FRAME is omitted or nil, it defaults to the selected frame. */) | ||
| 3128 | (Lisp_Object frame) | 3111 | (Lisp_Object frame) |
| 3129 | { | 3112 | { |
| 3130 | CHECK_LIVE_FRAME (frame); | 3113 | run_window_configuration_change_hook (decode_live_frame (frame)); |
| 3131 | run_window_configuration_change_hook (XFRAME (frame)); | ||
| 3132 | return Qnil; | 3114 | return Qnil; |
| 3133 | } | 3115 | } |
| 3134 | 3116 | ||
| @@ -3655,10 +3637,12 @@ window_resize_apply (struct window *w, int horflag) | |||
| 3655 | } | 3637 | } |
| 3656 | 3638 | ||
| 3657 | 3639 | ||
| 3658 | DEFUN ("window-resize-apply", Fwindow_resize_apply, Swindow_resize_apply, 1, 2, 0, | 3640 | DEFUN ("window-resize-apply", Fwindow_resize_apply, Swindow_resize_apply, 0, 2, 0, |
| 3659 | doc: /* Apply requested size values for window-tree of FRAME. | 3641 | doc: /* Apply requested size values for window-tree of FRAME. |
| 3660 | Optional argument HORIZONTAL omitted or nil means apply requested height | 3642 | If FRAME is omitted or nil, it defaults to the selected frame. |
| 3661 | values. HORIZONTAL non-nil means apply requested width values. | 3643 | |
| 3644 | Optional argument HORIZONTAL omitted or nil means apply requested | ||
| 3645 | height values. HORIZONTAL non-nil means apply requested width values. | ||
| 3662 | 3646 | ||
| 3663 | This function checks whether the requested values sum up to a valid | 3647 | This function checks whether the requested values sum up to a valid |
| 3664 | window layout, recursively assigns the new sizes of all child windows | 3648 | window layout, recursively assigns the new sizes of all child windows |
| @@ -3669,17 +3653,10 @@ Note: This function does not check any of `window-fixed-size-p', | |||
| 3669 | be applied on the Elisp level. */) | 3653 | be applied on the Elisp level. */) |
| 3670 | (Lisp_Object frame, Lisp_Object horizontal) | 3654 | (Lisp_Object frame, Lisp_Object horizontal) |
| 3671 | { | 3655 | { |
| 3672 | struct frame *f; | 3656 | struct frame *f = decode_live_frame (frame); |
| 3673 | struct window *r; | 3657 | struct window *r = XWINDOW (FRAME_ROOT_WINDOW (f)); |
| 3674 | int horflag = !NILP (horizontal); | 3658 | int horflag = !NILP (horizontal); |
| 3675 | 3659 | ||
| 3676 | if (NILP (frame)) | ||
| 3677 | frame = selected_frame; | ||
| 3678 | CHECK_LIVE_FRAME (frame); | ||
| 3679 | |||
| 3680 | f = XFRAME (frame); | ||
| 3681 | r = XWINDOW (FRAME_ROOT_WINDOW (f)); | ||
| 3682 | |||
| 3683 | if (!window_resize_check (r, horflag) | 3660 | if (!window_resize_check (r, horflag) |
| 3684 | || ! EQ (r->new_total, | 3661 | || ! EQ (r->new_total, |
| 3685 | (horflag ? r->total_cols : r->total_lines))) | 3662 | (horflag ? r->total_cols : r->total_lines))) |
| @@ -6165,12 +6142,7 @@ saved by this function. */) | |||
| 6165 | register int n_windows; | 6142 | register int n_windows; |
| 6166 | register struct save_window_data *data; | 6143 | register struct save_window_data *data; |
| 6167 | register int i; | 6144 | register int i; |
| 6168 | FRAME_PTR f; | 6145 | struct frame *f = decode_live_frame (frame); |
| 6169 | |||
| 6170 | if (NILP (frame)) | ||
| 6171 | frame = selected_frame; | ||
| 6172 | CHECK_LIVE_FRAME (frame); | ||
| 6173 | f = XFRAME (frame); | ||
| 6174 | 6146 | ||
| 6175 | n_windows = count_windows (XWINDOW (FRAME_ROOT_WINDOW (f))); | 6147 | n_windows = count_windows (XWINDOW (FRAME_ROOT_WINDOW (f))); |
| 6176 | data = ALLOCATE_PSEUDOVECTOR (struct save_window_data, frame_cols, | 6148 | data = ALLOCATE_PSEUDOVECTOR (struct save_window_data, frame_cols, |
| @@ -6323,10 +6295,9 @@ Value is a list of the form (LEFT-WIDTH RIGHT-WIDTH OUTSIDE-MARGINS). */) | |||
| 6323 | { | 6295 | { |
| 6324 | struct window *w = decode_live_window (window); | 6296 | struct window *w = decode_live_window (window); |
| 6325 | 6297 | ||
| 6326 | return Fcons (make_number (WINDOW_LEFT_FRINGE_WIDTH (w)), | 6298 | return list3 (make_number (WINDOW_LEFT_FRINGE_WIDTH (w)), |
| 6327 | Fcons (make_number (WINDOW_RIGHT_FRINGE_WIDTH (w)), | 6299 | make_number (WINDOW_RIGHT_FRINGE_WIDTH (w)), |
| 6328 | Fcons ((WINDOW_HAS_FRINGES_OUTSIDE_MARGINS (w) | 6300 | WINDOW_HAS_FRINGES_OUTSIDE_MARGINS (w) ? Qt : Qnil); |
| 6329 | ? Qt : Qnil), Qnil))); | ||
| 6330 | } | 6301 | } |
| 6331 | 6302 | ||
| 6332 | 6303 | ||
| @@ -6395,12 +6366,12 @@ value. */) | |||
| 6395 | (Lisp_Object window) | 6366 | (Lisp_Object window) |
| 6396 | { | 6367 | { |
| 6397 | struct window *w = decode_live_window (window); | 6368 | struct window *w = decode_live_window (window); |
| 6398 | return Fcons (make_number ((WINDOW_CONFIG_SCROLL_BAR_WIDTH (w) | 6369 | |
| 6370 | return list4 (make_number ((WINDOW_CONFIG_SCROLL_BAR_WIDTH (w) | ||
| 6399 | ? WINDOW_CONFIG_SCROLL_BAR_WIDTH (w) | 6371 | ? WINDOW_CONFIG_SCROLL_BAR_WIDTH (w) |
| 6400 | : WINDOW_SCROLL_BAR_AREA_WIDTH (w))), | 6372 | : WINDOW_SCROLL_BAR_AREA_WIDTH (w))), |
| 6401 | Fcons (make_number (WINDOW_SCROLL_BAR_COLS (w)), | 6373 | make_number (WINDOW_SCROLL_BAR_COLS (w)), |
| 6402 | Fcons (w->vertical_scroll_bar_type, | 6374 | w->vertical_scroll_bar_type, Qnil); |
| 6403 | Fcons (Qnil, Qnil)))); | ||
| 6404 | } | 6375 | } |
| 6405 | 6376 | ||
| 6406 | 6377 | ||