aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDmitry Antipov2012-11-06 10:27:20 +0400
committerDmitry Antipov2012-11-06 10:27:20 +0400
commit89bc059271bd3d7c62314a05664b111705c4bec9 (patch)
tree3ffa8c0a6137da8029b1e0adae0d6bc173258403 /src
parent8e2417bfc0d0b3cfb5c47e388c7dd7e1276bd54c (diff)
downloademacs-89bc059271bd3d7c62314a05664b111705c4bec9.tar.gz
emacs-89bc059271bd3d7c62314a05664b111705c4bec9.zip
* window.c (quad): New function.
(Fwindow_edges, Fwindow_pixel_edges, Fwindow_inside_edges) (Fwindow_absolute_pixel_edges, Fwindow_inside_absolute_pixel_edges) (Fwindow_inside_pixel_edges, Fpos_visible_in_window_p) (Fwindow_line_height): Use it. (Fwindow_fringes): Use list3. (Fwindow_scroll_bars): Use list4. (Fwindow_frame, Fwindow_top_child, Fwindow_left_child) (Fwindow_combination_limit): Allow zero number of arguments.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog12
-rw-r--r--src/window.c150
2 files changed, 82 insertions, 80 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 752f14d7185..1daeb7bc0b6 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,15 @@
12012-11-06 Dmitry Antipov <dmantipov@yandex.ru>
2
3 * window.c (quad): New function.
4 (Fwindow_edges, Fwindow_pixel_edges, Fwindow_inside_edges)
5 (Fwindow_absolute_pixel_edges, Fwindow_inside_absolute_pixel_edges)
6 (Fwindow_inside_pixel_edges, Fpos_visible_in_window_p)
7 (Fwindow_line_height): Use it.
8 (Fwindow_fringes): Use list3.
9 (Fwindow_scroll_bars): Use list4.
10 (Fwindow_frame, Fwindow_top_child, Fwindow_left_child)
11 (Fwindow_combination_limit): Allow zero number of arguments.
12
12012-11-05 Eli Zaretskii <eliz@gnu.org> 132012-11-05 Eli Zaretskii <eliz@gnu.org>
2 14
3 * makefile.w32-in ($(BLD)/w32fns.$(O)): Depend on $(NT_INC)/unistd.h. 15 * makefile.w32-in ($(BLD)/w32fns.$(O)): Depend on $(NT_INC)/unistd.h.
diff --git a/src/window.c b/src/window.c
index 766765cfa09..75a8d42d8d1 100644
--- a/src/window.c
+++ b/src/window.c
@@ -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
276quad (ptrdiff_t x, ptrdiff_t y, ptrdiff_t w, ptrdiff_t 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)
@@ -556,7 +565,7 @@ Return nil for a window with no parent (e.g. a root window). */)
556 return decode_valid_window (window)->parent; 565 return decode_valid_window (window)->parent;
557} 566}
558 567
559DEFUN ("window-top-child", Fwindow_top_child, Swindow_top_child, 1, 1, 0, 568DEFUN ("window-top-child", Fwindow_top_child, Swindow_top_child, 0, 1, 0,
560 doc: /* Return the topmost child window of window WINDOW. 569 doc: /* Return the topmost child window of window WINDOW.
561WINDOW must be a valid window and defaults to the selected one. 570WINDOW must be a valid window and defaults to the selected one.
562Return nil if WINDOW is a live window (live windows have no children). 571Return nil if WINDOW is a live window (live windows have no children).
@@ -564,11 +573,10 @@ Return nil if WINDOW is an internal window whose children form a
564horizontal combination. */) 573horizontal combination. */)
565 (Lisp_Object window) 574 (Lisp_Object window)
566{ 575{
567 CHECK_WINDOW (window);
568 return decode_valid_window (window)->vchild; 576 return decode_valid_window (window)->vchild;
569} 577}
570 578
571DEFUN ("window-left-child", Fwindow_left_child, Swindow_left_child, 1, 1, 0, 579DEFUN ("window-left-child", Fwindow_left_child, Swindow_left_child, 0, 1, 0,
572 doc: /* Return the leftmost child window of window WINDOW. 580 doc: /* Return the leftmost child window of window WINDOW.
573WINDOW must be a valid window and defaults to the selected one. 581WINDOW must be a valid window and defaults to the selected one.
574Return nil if WINDOW is a live window (live windows have no children). 582Return nil if WINDOW is a live window (live windows have no children).
@@ -576,7 +584,6 @@ Return nil if WINDOW is an internal window whose children form a
576vertical combination. */) 584vertical combination. */)
577 (Lisp_Object window) 585 (Lisp_Object window)
578{ 586{
579 CHECK_WINDOW (window);
580 return decode_valid_window (window)->hchild; 587 return decode_valid_window (window)->hchild;
581} 588}
582 589
@@ -598,7 +605,7 @@ Return nil if WINDOW has no previous sibling. */)
598 return decode_valid_window (window)->prev; 605 return decode_valid_window (window)->prev;
599} 606}
600 607
601DEFUN ("window-combination-limit", Fwindow_combination_limit, Swindow_combination_limit, 1, 1, 0, 608DEFUN ("window-combination-limit", Fwindow_combination_limit, Swindow_combination_limit, 0, 1, 0,
602 doc: /* Return combination limit of window WINDOW. 609 doc: /* Return combination limit of window WINDOW.
603WINDOW must be a valid window and defaults to the selected one. 610WINDOW 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 611If the return value is nil, child windows of WINDOW can be recombined with
@@ -829,10 +836,8 @@ Note that if `automatic-hscrolling' is non-nil, you cannot scroll the
829window so that the location of point moves off-window. */) 836window so that the location of point moves off-window. */)
830 (Lisp_Object window, Lisp_Object ncol) 837 (Lisp_Object window, Lisp_Object ncol)
831{ 838{
832 struct window *w = decode_live_window (window);
833
834 CHECK_NUMBER (ncol); 839 CHECK_NUMBER (ncol);
835 return set_window_hscroll (w, XINT (ncol)); 840 return set_window_hscroll (decode_live_window (window), XINT (ncol));
836} 841}
837 842
838DEFUN ("window-redisplay-end-trigger", Fwindow_redisplay_end_trigger, 843DEFUN ("window-redisplay-end-trigger", Fwindow_redisplay_end_trigger,
@@ -877,11 +882,8 @@ header line, and/or mode line. For the edges of just the text area, use
877{ 882{
878 register struct window *w = decode_valid_window (window); 883 register struct window *w = decode_valid_window (window);
879 884
880 return Fcons (make_number (WINDOW_LEFT_EDGE_COL (w)), 885 return quad (WINDOW_LEFT_EDGE_COL (w), WINDOW_TOP_EDGE_LINE (w),
881 Fcons (make_number (WINDOW_TOP_EDGE_LINE (w)), 886 WINDOW_RIGHT_EDGE_COL (w), WINDOW_BOTTOM_EDGE_LINE (w));
882 Fcons (make_number (WINDOW_RIGHT_EDGE_COL (w)),
883 Fcons (make_number (WINDOW_BOTTOM_EDGE_LINE (w)),
884 Qnil))));
885} 887}
886 888
887DEFUN ("window-pixel-edges", Fwindow_pixel_edges, Swindow_pixel_edges, 0, 1, 0, 889DEFUN ("window-pixel-edges", Fwindow_pixel_edges, Swindow_pixel_edges, 0, 1, 0,
@@ -900,11 +902,8 @@ of just the text area, use `window-inside-pixel-edges'. */)
900{ 902{
901 register struct window *w = decode_valid_window (window); 903 register struct window *w = decode_valid_window (window);
902 904
903 return Fcons (make_number (WINDOW_LEFT_EDGE_X (w)), 905 return quad (WINDOW_LEFT_EDGE_X (w), WINDOW_TOP_EDGE_Y (w),
904 Fcons (make_number (WINDOW_TOP_EDGE_Y (w)), 906 WINDOW_RIGHT_EDGE_X (w), WINDOW_BOTTOM_EDGE_Y (w));
905 Fcons (make_number (WINDOW_RIGHT_EDGE_X (w)),
906 Fcons (make_number (WINDOW_BOTTOM_EDGE_Y (w)),
907 Qnil))));
908} 907}
909 908
910static void 909static void
@@ -946,13 +945,13 @@ of just the text area, use `window-inside-absolute-pixel-edges'. */)
946{ 945{
947 register struct window *w = decode_valid_window (window); 946 register struct window *w = decode_valid_window (window);
948 int add_x, add_y; 947 int add_x, add_y;
948
949 calc_absolute_offset (w, &add_x, &add_y); 949 calc_absolute_offset (w, &add_x, &add_y);
950 950
951 return Fcons (make_number (WINDOW_LEFT_EDGE_X (w) + add_x), 951 return quad (WINDOW_LEFT_EDGE_X (w) + add_x,
952 Fcons (make_number (WINDOW_TOP_EDGE_Y (w) + add_y), 952 WINDOW_TOP_EDGE_Y (w) + add_y,
953 Fcons (make_number (WINDOW_RIGHT_EDGE_X (w) + add_x), 953 WINDOW_RIGHT_EDGE_X (w) + add_x,
954 Fcons (make_number (WINDOW_BOTTOM_EDGE_Y (w) + add_y), 954 WINDOW_BOTTOM_EDGE_Y (w) + add_y);
955 Qnil))));
956} 955}
957 956
958DEFUN ("window-inside-edges", Fwindow_inside_edges, Swindow_inside_edges, 0, 1, 0, 957DEFUN ("window-inside-edges", Fwindow_inside_edges, Swindow_inside_edges, 0, 1, 0,
@@ -971,16 +970,16 @@ display margins, fringes, header line, and/or mode line. */)
971{ 970{
972 register struct window *w = decode_live_window (window); 971 register struct window *w = decode_live_window (window);
973 972
974 return list4 (make_number (WINDOW_BOX_LEFT_EDGE_COL (w) 973 return quad (WINDOW_BOX_LEFT_EDGE_COL (w)
975 + WINDOW_LEFT_MARGIN_COLS (w) 974 + WINDOW_LEFT_MARGIN_COLS (w)
976 + WINDOW_LEFT_FRINGE_COLS (w)), 975 + WINDOW_LEFT_FRINGE_COLS (w),
977 make_number (WINDOW_TOP_EDGE_LINE (w) 976 WINDOW_TOP_EDGE_LINE (w)
978 + WINDOW_HEADER_LINE_LINES (w)), 977 + WINDOW_HEADER_LINE_LINES (w),
979 make_number (WINDOW_BOX_RIGHT_EDGE_COL (w) 978 WINDOW_BOX_RIGHT_EDGE_COL (w)
980 - WINDOW_RIGHT_MARGIN_COLS (w) 979 - WINDOW_RIGHT_MARGIN_COLS (w)
981 - WINDOW_RIGHT_FRINGE_COLS (w)), 980 - WINDOW_RIGHT_FRINGE_COLS (w),
982 make_number (WINDOW_BOTTOM_EDGE_LINE (w) 981 WINDOW_BOTTOM_EDGE_LINE (w)
983 - WINDOW_MODE_LINE_LINES (w))); 982 - WINDOW_MODE_LINE_LINES (w));
984} 983}
985 984
986DEFUN ("window-inside-pixel-edges", Fwindow_inside_pixel_edges, Swindow_inside_pixel_edges, 0, 1, 0, 985DEFUN ("window-inside-pixel-edges", Fwindow_inside_pixel_edges, Swindow_inside_pixel_edges, 0, 1, 0,
@@ -998,16 +997,16 @@ display margins, fringes, header line, and/or mode line. */)
998{ 997{
999 register struct window *w = decode_live_window (window); 998 register struct window *w = decode_live_window (window);
1000 999
1001 return list4 (make_number (WINDOW_BOX_LEFT_EDGE_X (w) 1000 return quad (WINDOW_BOX_LEFT_EDGE_X (w)
1002 + WINDOW_LEFT_MARGIN_WIDTH (w) 1001 + WINDOW_LEFT_MARGIN_WIDTH (w)
1003 + WINDOW_LEFT_FRINGE_WIDTH (w)), 1002 + WINDOW_LEFT_FRINGE_WIDTH (w),
1004 make_number (WINDOW_TOP_EDGE_Y (w) 1003 WINDOW_TOP_EDGE_Y (w)
1005 + WINDOW_HEADER_LINE_HEIGHT (w)), 1004 + WINDOW_HEADER_LINE_HEIGHT (w),
1006 make_number (WINDOW_BOX_RIGHT_EDGE_X (w) 1005 WINDOW_BOX_RIGHT_EDGE_X (w)
1007 - WINDOW_RIGHT_MARGIN_WIDTH (w) 1006 - WINDOW_RIGHT_MARGIN_WIDTH (w)
1008 - WINDOW_RIGHT_FRINGE_WIDTH (w)), 1007 - WINDOW_RIGHT_FRINGE_WIDTH (w),
1009 make_number (WINDOW_BOTTOM_EDGE_Y (w) 1008 WINDOW_BOTTOM_EDGE_Y (w)
1010 - WINDOW_MODE_LINE_HEIGHT (w))); 1009 - WINDOW_MODE_LINE_HEIGHT (w));
1011} 1010}
1012 1011
1013DEFUN ("window-inside-absolute-pixel-edges", 1012DEFUN ("window-inside-absolute-pixel-edges",
@@ -1027,18 +1026,19 @@ display margins, fringes, header line, and/or mode line. */)
1027{ 1026{
1028 register struct window *w = decode_live_window (window); 1027 register struct window *w = decode_live_window (window);
1029 int add_x, add_y; 1028 int add_x, add_y;
1029
1030 calc_absolute_offset (w, &add_x, &add_y); 1030 calc_absolute_offset (w, &add_x, &add_y);
1031 1031
1032 return list4 (make_number (WINDOW_BOX_LEFT_EDGE_X (w) 1032 return quad (WINDOW_BOX_LEFT_EDGE_X (w)
1033 + WINDOW_LEFT_MARGIN_WIDTH (w) 1033 + WINDOW_LEFT_MARGIN_WIDTH (w)
1034 + WINDOW_LEFT_FRINGE_WIDTH (w) + add_x), 1034 + WINDOW_LEFT_FRINGE_WIDTH (w) + add_x,
1035 make_number (WINDOW_TOP_EDGE_Y (w) 1035 WINDOW_TOP_EDGE_Y (w)
1036 + WINDOW_HEADER_LINE_HEIGHT (w) + add_y), 1036 + WINDOW_HEADER_LINE_HEIGHT (w) + add_y,
1037 make_number (WINDOW_BOX_RIGHT_EDGE_X (w) 1037 WINDOW_BOX_RIGHT_EDGE_X (w)
1038 - WINDOW_RIGHT_MARGIN_WIDTH (w) 1038 - WINDOW_RIGHT_MARGIN_WIDTH (w)
1039 - WINDOW_RIGHT_FRINGE_WIDTH (w) + add_x), 1039 - WINDOW_RIGHT_FRINGE_WIDTH (w) + add_x,
1040 make_number (WINDOW_BOTTOM_EDGE_Y (w) 1040 WINDOW_BOTTOM_EDGE_Y (w)
1041 - WINDOW_MODE_LINE_HEIGHT (w) + add_y)); 1041 - WINDOW_MODE_LINE_HEIGHT (w) + add_y);
1042} 1042}
1043 1043
1044/* Test if the character at column X, row Y is within window W. 1044/* Test if the character at column X, row Y is within window W.
@@ -1624,8 +1624,7 @@ display row, and VPOS is the row number (0-based) containing POS. */)
1624 { 1624 {
1625 Lisp_Object part = Qnil; 1625 Lisp_Object part = Qnil;
1626 if (!fully_p) 1626 if (!fully_p)
1627 part = list4 (make_number (rtop), make_number (rbot), 1627 part = quad (rtop, rbot, rowh, vpos);
1628 make_number (rowh), make_number (vpos));
1629 in_window = Fcons (make_number (x), 1628 in_window = Fcons (make_number (x),
1630 Fcons (make_number (y), part)); 1629 Fcons (make_number (y), part));
1631 } 1630 }
@@ -1691,23 +1690,18 @@ Return nil if window display is not up-to-date. In that case, use
1691 if (!WINDOW_WANTS_HEADER_LINE_P (w)) 1690 if (!WINDOW_WANTS_HEADER_LINE_P (w))
1692 return Qnil; 1691 return Qnil;
1693 row = MATRIX_HEADER_LINE_ROW (w->current_matrix); 1692 row = MATRIX_HEADER_LINE_ROW (w->current_matrix);
1694 if (!row->enabled_p) 1693 return row->enabled_p ? quad (row->height, 0, 0, 0) : Qnil;
1695 return Qnil;
1696 return list4 (make_number (row->height),
1697 make_number (0), make_number (0),
1698 make_number (0));
1699 } 1694 }
1700 1695
1701 if (EQ (line, Qmode_line)) 1696 if (EQ (line, Qmode_line))
1702 { 1697 {
1703 row = MATRIX_MODE_LINE_ROW (w->current_matrix); 1698 row = MATRIX_MODE_LINE_ROW (w->current_matrix);
1704 if (!row->enabled_p) 1699 return (row->enabled_p ?
1705 return Qnil; 1700 quad (row->height,
1706 return list4 (make_number (row->height), 1701 0, /* not accurate */
1707 make_number (0), /* not accurate */ 1702 WINDOW_HEADER_LINE_HEIGHT (w)
1708 make_number (WINDOW_HEADER_LINE_HEIGHT (w) 1703 + window_text_bottom_y (w), 0)
1709 + window_text_bottom_y (w)), 1704 : Qnil);
1710 make_number (0));
1711 } 1705 }
1712 1706
1713 CHECK_NUMBER (line); 1707 CHECK_NUMBER (line);
@@ -1736,10 +1730,7 @@ Return nil if window display is not up-to-date. In that case, use
1736 1730
1737 found_row: 1731 found_row:
1738 crop = max (0, (row->y + row->height) - max_y); 1732 crop = max (0, (row->y + row->height) - max_y);
1739 return list4 (make_number (row->height + min (0, row->y) - crop), 1733 return quad (row->height + min (0, row->y) - crop, i, row->y, crop);
1740 make_number (i),
1741 make_number (row->y),
1742 make_number (crop));
1743} 1734}
1744 1735
1745DEFUN ("window-dedicated-p", Fwindow_dedicated_p, Swindow_dedicated_p, 1736DEFUN ("window-dedicated-p", Fwindow_dedicated_p, Swindow_dedicated_p,
@@ -6315,10 +6306,9 @@ Value is a list of the form (LEFT-WIDTH RIGHT-WIDTH OUTSIDE-MARGINS). */)
6315{ 6306{
6316 struct window *w = decode_live_window (window); 6307 struct window *w = decode_live_window (window);
6317 6308
6318 return Fcons (make_number (WINDOW_LEFT_FRINGE_WIDTH (w)), 6309 return list3 (make_number (WINDOW_LEFT_FRINGE_WIDTH (w)),
6319 Fcons (make_number (WINDOW_RIGHT_FRINGE_WIDTH (w)), 6310 make_number (WINDOW_RIGHT_FRINGE_WIDTH (w)),
6320 Fcons ((WINDOW_HAS_FRINGES_OUTSIDE_MARGINS (w) 6311 WINDOW_HAS_FRINGES_OUTSIDE_MARGINS (w) ? Qt : Qnil);
6321 ? Qt : Qnil), Qnil)));
6322} 6312}
6323 6313
6324 6314
@@ -6387,12 +6377,12 @@ value. */)
6387 (Lisp_Object window) 6377 (Lisp_Object window)
6388{ 6378{
6389 struct window *w = decode_live_window (window); 6379 struct window *w = decode_live_window (window);
6390 return Fcons (make_number ((WINDOW_CONFIG_SCROLL_BAR_WIDTH (w) 6380
6381 return list4 (make_number ((WINDOW_CONFIG_SCROLL_BAR_WIDTH (w)
6391 ? WINDOW_CONFIG_SCROLL_BAR_WIDTH (w) 6382 ? WINDOW_CONFIG_SCROLL_BAR_WIDTH (w)
6392 : WINDOW_SCROLL_BAR_AREA_WIDTH (w))), 6383 : WINDOW_SCROLL_BAR_AREA_WIDTH (w))),
6393 Fcons (make_number (WINDOW_SCROLL_BAR_COLS (w)), 6384 make_number (WINDOW_SCROLL_BAR_COLS (w)),
6394 Fcons (w->vertical_scroll_bar_type, 6385 w->vertical_scroll_bar_type, Qnil);
6395 Fcons (Qnil, Qnil))));
6396} 6386}
6397 6387
6398 6388