Mercurial > emacs
comparison src/xdisp.c @ 51209:880539128b51
Make (many) trivial substitutions for renamed and
new macros in dispextern.h, frame.h and window.h.
(window_box_width): Adapt to per-window fringes and scroll bars,
and new fringe vs. display margin position. Note that returned
value is no longer guaranteed to be a whole multiple of the frame
column width, since per-window fringes may now be any width.
(window_box_left_offset): New function like window_box_left, but
value is relative to left border of window (rather than frame).
(window_box_right_offset): New function like window_box_right,
but value is relative to left border of window.
(window_box_left): Adapt to per-window fringes and scroll bars,
and new fringe vs. display margin position. Simplify by using
WINDOW_LEFT_EDGE_X and window_box_left_offset.
(window_box): Allow null args for unnecessary return values;
change/simplify relevant callers.
(x_y_to_hpos_vpos): Adapt to per-window fringes and scroll bars,
and new fringe vs. display margin position. Use
window_box_left_offset and window_box_right_offset
(get_glyph_string_clip_rect): Adapt to per-window fringes and
scroll bars, and new fringe vs. display margin position. Use
WINDOW_LEFT_EDGE_X and WINDOW_TOTAL_WIDTH.
(draw_fringe_bitmap): Rework to handle per-window fringes and new
fringe vs. display margin position.
(hscroll_window_tree): Use window_box_width instead of window_box.
(redisplay_window): Adapt to per-window scroll bars.
(draw_glyphs): Rework to handle per-window fringes and scroll
bars, and new fringe vs. display margin position. Use
WINDOW_LEFT_EDGE_X, WINDOW_TOTAL_WIDTH, and window_box_left.
(x_clear_end_of_line): Adapt to per-window fringes and scroll
bars, and new fringe vs. display margin position. Fix bug which
increased total width of full_width rows by width of scroll bars
although window's total width already includes that.
(x_fix_overlapping_area): Simplify using window_box_left_offset.
(expose_area): Simplify using window_box_left_offset.
(x_draw_vertical_border): Handle per-window scroll bar settings,
mixing windows with left, right and no scroll bars.
author | Kim F. Storm <storm@cua.dk> |
---|---|
date | Sat, 24 May 2003 22:08:54 +0000 |
parents | b4f5f0f32f01 |
children | 998639def2d1 |
comparison
equal
deleted
inserted
replaced
51208:86d74f5ea803 | 51209:880539128b51 |
---|---|
422 | 422 |
423 static EMACS_INT scroll_conservatively; | 423 static EMACS_INT scroll_conservatively; |
424 | 424 |
425 /* Recenter the window whenever point gets within this many lines of | 425 /* Recenter the window whenever point gets within this many lines of |
426 the top or bottom of the window. This value is translated into a | 426 the top or bottom of the window. This value is translated into a |
427 pixel value by multiplying it with CANON_Y_UNIT, which means that | 427 pixel value by multiplying it with FRAME_LINE_HEIGHT, which means |
428 there is really a fixed pixel height scroll margin. */ | 428 that there is really a fixed pixel height scroll margin. */ |
429 | 429 |
430 EMACS_INT scroll_margin; | 430 EMACS_INT scroll_margin; |
431 | 431 |
432 /* Number of windows showing the buffer of the selected window (or | 432 /* Number of windows showing the buffer of the selected window (or |
433 another buffer with the same base buffer). keyboard.c refers to | 433 another buffer with the same base buffer). keyboard.c refers to |
911 INLINE int | 911 INLINE int |
912 window_text_bottom_y (w) | 912 window_text_bottom_y (w) |
913 struct window *w; | 913 struct window *w; |
914 { | 914 { |
915 struct frame *f = XFRAME (w->frame); | 915 struct frame *f = XFRAME (w->frame); |
916 int height = XFASTINT (w->height) * CANON_Y_UNIT (f); | 916 int height = WINDOW_TOTAL_HEIGHT (w); |
917 | 917 |
918 if (WINDOW_WANTS_MODELINE_P (w)) | 918 if (WINDOW_WANTS_MODELINE_P (w)) |
919 height -= CURRENT_MODE_LINE_HEIGHT (w); | 919 height -= CURRENT_MODE_LINE_HEIGHT (w); |
920 return height; | 920 return height; |
921 } | 921 } |
922 | |
923 | 922 |
924 /* Return the pixel width of display area AREA of window W. AREA < 0 | 923 /* Return the pixel width of display area AREA of window W. AREA < 0 |
925 means return the total width of W, not including fringes to | 924 means return the total width of W, not including fringes to |
926 the left and right of the window. */ | 925 the left and right of the window. */ |
927 | 926 |
928 INLINE int | 927 INLINE int |
929 window_box_width (w, area) | 928 window_box_width (w, area) |
930 struct window *w; | 929 struct window *w; |
931 int area; | 930 int area; |
932 { | 931 { |
933 struct frame *f = XFRAME (w->frame); | 932 int cols = XFASTINT (w->total_cols); |
934 int width = XFASTINT (w->width); | 933 int pixels = 0; |
935 | 934 |
936 if (!w->pseudo_window_p) | 935 if (!w->pseudo_window_p) |
937 { | 936 { |
938 width -= FRAME_SCROLL_BAR_WIDTH (f) + FRAME_FRINGE_COLS (f); | 937 cols -= WINDOW_SCROLL_BAR_COLS (w); |
939 | 938 |
940 if (area == TEXT_AREA) | 939 if (area == TEXT_AREA) |
941 { | 940 { |
942 if (INTEGERP (w->left_margin_width)) | 941 if (INTEGERP (w->left_margin_cols)) |
943 width -= XFASTINT (w->left_margin_width); | 942 cols -= XFASTINT (w->left_margin_cols); |
944 if (INTEGERP (w->right_margin_width)) | 943 if (INTEGERP (w->right_margin_cols)) |
945 width -= XFASTINT (w->right_margin_width); | 944 cols -= XFASTINT (w->right_margin_cols); |
945 pixels = -WINDOW_TOTAL_FRINGE_WIDTH (w); | |
946 } | 946 } |
947 else if (area == LEFT_MARGIN_AREA) | 947 else if (area == LEFT_MARGIN_AREA) |
948 width = (INTEGERP (w->left_margin_width) | 948 { |
949 ? XFASTINT (w->left_margin_width) : 0); | 949 cols = (INTEGERP (w->left_margin_cols) |
950 ? XFASTINT (w->left_margin_cols) : 0); | |
951 pixels = 0; | |
952 } | |
950 else if (area == RIGHT_MARGIN_AREA) | 953 else if (area == RIGHT_MARGIN_AREA) |
951 width = (INTEGERP (w->right_margin_width) | 954 { |
952 ? XFASTINT (w->right_margin_width) : 0); | 955 cols = (INTEGERP (w->right_margin_cols) |
953 } | 956 ? XFASTINT (w->right_margin_cols) : 0); |
954 | 957 pixels = 0; |
955 return width * CANON_X_UNIT (f); | 958 } |
959 } | |
960 | |
961 return cols * WINDOW_FRAME_COLUMN_WIDTH (w) + pixels; | |
956 } | 962 } |
957 | 963 |
958 | 964 |
959 /* Return the pixel height of the display area of window W, not | 965 /* Return the pixel height of the display area of window W, not |
960 including mode lines of W, if any. */ | 966 including mode lines of W, if any. */ |
962 INLINE int | 968 INLINE int |
963 window_box_height (w) | 969 window_box_height (w) |
964 struct window *w; | 970 struct window *w; |
965 { | 971 { |
966 struct frame *f = XFRAME (w->frame); | 972 struct frame *f = XFRAME (w->frame); |
967 int height = XFASTINT (w->height) * CANON_Y_UNIT (f); | 973 int height = WINDOW_TOTAL_HEIGHT (w); |
968 | 974 |
969 xassert (height >= 0); | 975 xassert (height >= 0); |
970 | 976 |
971 /* Note: the code below that determines the mode-line/header-line | 977 /* Note: the code below that determines the mode-line/header-line |
972 height is essentially the same as that contained in the macro | 978 height is essentially the same as that contained in the macro |
1001 /* With a very small font and a mode-line that's taller than | 1007 /* With a very small font and a mode-line that's taller than |
1002 default, we might end up with a negative height. */ | 1008 default, we might end up with a negative height. */ |
1003 return max (0, height); | 1009 return max (0, height); |
1004 } | 1010 } |
1005 | 1011 |
1012 /* Return the window-relative coordinate of the left edge of display | |
1013 area AREA of window W. AREA < 0 means return the left edge of the | |
1014 whole window, to the right of the left fringe of W. */ | |
1015 | |
1016 INLINE int | |
1017 window_box_left_offset (w, area) | |
1018 struct window *w; | |
1019 int area; | |
1020 { | |
1021 int x; | |
1022 | |
1023 if (w->pseudo_window_p) | |
1024 return 0; | |
1025 | |
1026 x = WINDOW_LEFT_SCROLL_BAR_AREA_WIDTH (w); | |
1027 | |
1028 if (area == TEXT_AREA) | |
1029 x += (WINDOW_LEFT_FRINGE_WIDTH (w) | |
1030 + window_box_width (w, LEFT_MARGIN_AREA)); | |
1031 else if (area == RIGHT_MARGIN_AREA) | |
1032 x += (WINDOW_LEFT_FRINGE_WIDTH (w) | |
1033 + window_box_width (w, LEFT_MARGIN_AREA) | |
1034 + window_box_width (w, TEXT_AREA) | |
1035 + (WINDOW_HAS_FRINGES_OUTSIDE_MARGINS (w) | |
1036 ? 0 | |
1037 : WINDOW_RIGHT_FRINGE_WIDTH (w))); | |
1038 else if (area == LEFT_MARGIN_AREA | |
1039 && WINDOW_HAS_FRINGES_OUTSIDE_MARGINS (w)) | |
1040 x += WINDOW_LEFT_FRINGE_WIDTH (w); | |
1041 | |
1042 return x; | |
1043 } | |
1044 | |
1045 | |
1046 /* Return the window-relative coordinate of the right edge of display | |
1047 area AREA of window W. AREA < 0 means return the left edge of the | |
1048 whole window, to the left of the right fringe of W. */ | |
1049 | |
1050 INLINE int | |
1051 window_box_right_offset (w, area) | |
1052 struct window *w; | |
1053 int area; | |
1054 { | |
1055 return window_box_left_offset (w, area) + window_box_width (w, area); | |
1056 } | |
1006 | 1057 |
1007 /* Return the frame-relative coordinate of the left edge of display | 1058 /* Return the frame-relative coordinate of the left edge of display |
1008 area AREA of window W. AREA < 0 means return the left edge of the | 1059 area AREA of window W. AREA < 0 means return the left edge of the |
1009 whole window, to the right of the left fringe of W. */ | 1060 whole window, to the right of the left fringe of W. */ |
1010 | 1061 |
1012 window_box_left (w, area) | 1063 window_box_left (w, area) |
1013 struct window *w; | 1064 struct window *w; |
1014 int area; | 1065 int area; |
1015 { | 1066 { |
1016 struct frame *f = XFRAME (w->frame); | 1067 struct frame *f = XFRAME (w->frame); |
1017 int x = FRAME_INTERNAL_BORDER_WIDTH_SAFE (f); | 1068 int x; |
1018 | 1069 |
1019 if (!w->pseudo_window_p) | 1070 if (w->pseudo_window_p) |
1020 { | 1071 return FRAME_INTERNAL_BORDER_WIDTH (f); |
1021 x += (WINDOW_LEFT_MARGIN (w) * CANON_X_UNIT (f) | 1072 |
1022 + FRAME_LEFT_FRINGE_WIDTH (f)); | 1073 x = (WINDOW_LEFT_EDGE_X (w) |
1023 | 1074 + window_box_left_offset (w, area)); |
1024 if (area == TEXT_AREA) | |
1025 x += window_box_width (w, LEFT_MARGIN_AREA); | |
1026 else if (area == RIGHT_MARGIN_AREA) | |
1027 x += (window_box_width (w, LEFT_MARGIN_AREA) | |
1028 + window_box_width (w, TEXT_AREA)); | |
1029 } | |
1030 | 1075 |
1031 return x; | 1076 return x; |
1032 } | 1077 } |
1033 | 1078 |
1034 | 1079 |
1041 struct window *w; | 1086 struct window *w; |
1042 int area; | 1087 int area; |
1043 { | 1088 { |
1044 return window_box_left (w, area) + window_box_width (w, area); | 1089 return window_box_left (w, area) + window_box_width (w, area); |
1045 } | 1090 } |
1046 | |
1047 | 1091 |
1048 /* Get the bounding box of the display area AREA of window W, without | 1092 /* Get the bounding box of the display area AREA of window W, without |
1049 mode lines, in frame-relative coordinates. AREA < 0 means the | 1093 mode lines, in frame-relative coordinates. AREA < 0 means the |
1050 whole window, not including the left and right fringes of | 1094 whole window, not including the left and right fringes of |
1051 the window. Return in *BOX_X and *BOX_Y the frame-relative pixel | 1095 the window. Return in *BOX_X and *BOX_Y the frame-relative pixel |
1056 window_box (w, area, box_x, box_y, box_width, box_height) | 1100 window_box (w, area, box_x, box_y, box_width, box_height) |
1057 struct window *w; | 1101 struct window *w; |
1058 int area; | 1102 int area; |
1059 int *box_x, *box_y, *box_width, *box_height; | 1103 int *box_x, *box_y, *box_width, *box_height; |
1060 { | 1104 { |
1061 struct frame *f = XFRAME (w->frame); | 1105 if (box_width) |
1062 | 1106 *box_width = window_box_width (w, area); |
1063 *box_width = window_box_width (w, area); | 1107 if (box_height) |
1064 *box_height = window_box_height (w); | 1108 *box_height = window_box_height (w); |
1065 *box_x = window_box_left (w, area); | 1109 if (box_x) |
1066 *box_y = (FRAME_INTERNAL_BORDER_WIDTH_SAFE (f) | 1110 *box_x = window_box_left (w, area); |
1067 + XFASTINT (w->top) * CANON_Y_UNIT (f)); | 1111 if (box_y) |
1068 if (WINDOW_WANTS_HEADER_LINE_P (w)) | 1112 { |
1069 *box_y += CURRENT_HEADER_LINE_HEIGHT (w); | 1113 *box_y = WINDOW_TOP_EDGE_Y (w); |
1114 if (WINDOW_WANTS_HEADER_LINE_P (w)) | |
1115 *box_y += CURRENT_HEADER_LINE_HEIGHT (w); | |
1116 } | |
1070 } | 1117 } |
1071 | 1118 |
1072 | 1119 |
1073 /* Get the bounding box of the display area AREA of window W, without | 1120 /* Get the bounding box of the display area AREA of window W, without |
1074 mode lines. AREA < 0 means the whole window, not including the | 1121 mode lines. AREA < 0 means the whole window, not including the |
1182 /* Note that we may overshoot because of invisible text. */ | 1229 /* Note that we may overshoot because of invisible text. */ |
1183 if (IT_CHARPOS (it) >= charpos) | 1230 if (IT_CHARPOS (it) >= charpos) |
1184 { | 1231 { |
1185 int top_y = it.current_y; | 1232 int top_y = it.current_y; |
1186 int bottom_y = line_bottom_y (&it); | 1233 int bottom_y = line_bottom_y (&it); |
1187 int window_top_y = WINDOW_DISPLAY_HEADER_LINE_HEIGHT (w); | 1234 int window_top_y = WINDOW_HEADER_LINE_HEIGHT (w); |
1188 | 1235 |
1189 if (top_y < window_top_y) | 1236 if (top_y < window_top_y) |
1190 visible_p = bottom_y > window_top_y; | 1237 visible_p = bottom_y > window_top_y; |
1191 else if (top_y < it.last_visible_y) | 1238 else if (top_y < it.last_visible_y) |
1192 { | 1239 { |
1419 { | 1466 { |
1420 | 1467 |
1421 #ifdef HAVE_WINDOW_SYSTEM | 1468 #ifdef HAVE_WINDOW_SYSTEM |
1422 if (FRAME_WINDOW_P (f)) | 1469 if (FRAME_WINDOW_P (f)) |
1423 { | 1470 { |
1424 /* Arrange for the division in PIXEL_TO_CHAR_COL etc. to round down | 1471 /* Arrange for the division in FRAME_PIXEL_X_TO_COL etc. to round down |
1425 even for negative values. */ | 1472 even for negative values. */ |
1426 if (pix_x < 0) | 1473 if (pix_x < 0) |
1427 pix_x -= FONT_WIDTH (FRAME_FONT (f)) - 1; | 1474 pix_x -= FRAME_COLUMN_WIDTH (f) - 1; |
1428 if (pix_y < 0) | 1475 if (pix_y < 0) |
1429 pix_y -= FRAME_X_OUTPUT(f)->line_height - 1; | 1476 pix_y -= FRAME_LINE_HEIGHT (f) - 1; |
1430 | 1477 |
1431 pix_x = PIXEL_TO_CHAR_COL (f, pix_x); | 1478 pix_x = FRAME_PIXEL_X_TO_COL (f, pix_x); |
1432 pix_y = PIXEL_TO_CHAR_ROW (f, pix_y); | 1479 pix_y = FRAME_PIXEL_Y_TO_LINE (f, pix_y); |
1433 | 1480 |
1434 if (bounds) | 1481 if (bounds) |
1435 STORE_NATIVE_RECT (*bounds, | 1482 STORE_NATIVE_RECT (*bounds, |
1436 CHAR_TO_PIXEL_COL (f, pix_x), | 1483 FRAME_COL_TO_PIXEL_X (f, pix_x), |
1437 CHAR_TO_PIXEL_ROW (f, pix_y), | 1484 FRAME_LINE_TO_PIXEL_Y (f, pix_y), |
1438 FONT_WIDTH (FRAME_FONT (f)) - 1, | 1485 FRAME_COLUMN_WIDTH (f) - 1, |
1439 FRAME_X_OUTPUT (f)->line_height - 1); | 1486 FRAME_LINE_HEIGHT (f) - 1); |
1440 | 1487 |
1441 if (!noclip) | 1488 if (!noclip) |
1442 { | 1489 { |
1443 if (pix_x < 0) | 1490 if (pix_x < 0) |
1444 pix_x = 0; | 1491 pix_x = 0; |
1445 else if (pix_x > FRAME_WINDOW_WIDTH (f)) | 1492 else if (pix_x > FRAME_TOTAL_COLS (f)) |
1446 pix_x = FRAME_WINDOW_WIDTH (f); | 1493 pix_x = FRAME_TOTAL_COLS (f); |
1447 | 1494 |
1448 if (pix_y < 0) | 1495 if (pix_y < 0) |
1449 pix_y = 0; | 1496 pix_y = 0; |
1450 else if (pix_y > f->height) | 1497 else if (pix_y > FRAME_LINES (f)) |
1451 pix_y = f->height; | 1498 pix_y = FRAME_LINES (f); |
1452 } | 1499 } |
1453 } | 1500 } |
1454 #endif | 1501 #endif |
1455 | 1502 |
1456 *x = pix_x; | 1503 *x = pix_x; |
1528 int *hpos, *vpos, *area; | 1575 int *hpos, *vpos, *area; |
1529 int buffer_only_p; | 1576 int buffer_only_p; |
1530 { | 1577 { |
1531 struct glyph *glyph, *end; | 1578 struct glyph *glyph, *end; |
1532 struct glyph_row *row = NULL; | 1579 struct glyph_row *row = NULL; |
1533 int x0, i, left_area_width; | 1580 int x0, i; |
1534 | 1581 |
1535 /* Find row containing Y. Give up if some row is not enabled. */ | 1582 /* Find row containing Y. Give up if some row is not enabled. */ |
1536 for (i = 0; i < w->current_matrix->nrows; ++i) | 1583 for (i = 0; i < w->current_matrix->nrows; ++i) |
1537 { | 1584 { |
1538 row = MATRIX_ROW (w->current_matrix, i); | 1585 row = MATRIX_ROW (w->current_matrix, i); |
1555 *area = TEXT_AREA; | 1602 *area = TEXT_AREA; |
1556 x0 = 0; | 1603 x0 = 0; |
1557 } | 1604 } |
1558 else | 1605 else |
1559 { | 1606 { |
1560 left_area_width = window_box_width (w, LEFT_MARGIN_AREA); | 1607 if (x < window_box_left_offset (w, TEXT_AREA)) |
1561 if (x < left_area_width) | |
1562 { | 1608 { |
1563 *area = LEFT_MARGIN_AREA; | 1609 *area = LEFT_MARGIN_AREA; |
1564 x0 = 0; | 1610 x0 = window_box_left_offset (w, LEFT_MARGIN_AREA); |
1565 } | 1611 } |
1566 else if (x < left_area_width + window_box_width (w, TEXT_AREA)) | 1612 else if (x < window_box_right_offset (w, TEXT_AREA)) |
1567 { | 1613 { |
1568 *area = TEXT_AREA; | 1614 *area = TEXT_AREA; |
1569 x0 = row->x + left_area_width; | 1615 x0 = window_box_left_offset (w, TEXT_AREA); |
1570 } | 1616 } |
1571 else | 1617 else |
1572 { | 1618 { |
1573 *area = RIGHT_MARGIN_AREA; | 1619 *area = RIGHT_MARGIN_AREA; |
1574 x0 = left_area_width + window_box_width (w, TEXT_AREA); | 1620 x0 = window_box_left_offset (w, RIGHT_MARGIN_AREA); |
1575 } | 1621 } |
1576 } | 1622 } |
1577 | 1623 |
1578 /* Find glyph containing X. */ | 1624 /* Find glyph containing X. */ |
1579 glyph = row->glyphs[*area]; | 1625 glyph = row->glyphs[*area]; |
1612 if (w->pseudo_window_p) | 1658 if (w->pseudo_window_p) |
1613 { | 1659 { |
1614 /* A pseudo-window is always full-width, and starts at the | 1660 /* A pseudo-window is always full-width, and starts at the |
1615 left edge of the frame, plus a frame border. */ | 1661 left edge of the frame, plus a frame border. */ |
1616 struct frame *f = XFRAME (w->frame); | 1662 struct frame *f = XFRAME (w->frame); |
1617 *x -= FRAME_INTERNAL_BORDER_WIDTH_SAFE (f); | 1663 *x -= FRAME_INTERNAL_BORDER_WIDTH (f); |
1618 *y = FRAME_TO_WINDOW_PIXEL_Y (w, *y); | 1664 *y = FRAME_TO_WINDOW_PIXEL_Y (w, *y); |
1619 } | 1665 } |
1620 else | 1666 else |
1621 { | 1667 { |
1622 *x = FRAME_TO_WINDOW_PIXEL_X (w, *x); | 1668 *x -= WINDOW_LEFT_EDGE_X (w); |
1623 *y = FRAME_TO_WINDOW_PIXEL_Y (w, *y); | 1669 *y = FRAME_TO_WINDOW_PIXEL_Y (w, *y); |
1624 } | 1670 } |
1625 } | 1671 } |
1626 | 1672 |
1627 /* EXPORT: | 1673 /* EXPORT: |
1634 { | 1680 { |
1635 XRectangle r; | 1681 XRectangle r; |
1636 | 1682 |
1637 if (s->row->full_width_p) | 1683 if (s->row->full_width_p) |
1638 { | 1684 { |
1639 /* Draw full-width. X coordinates are relative to S->w->left. */ | 1685 /* Draw full-width. X coordinates are relative to S->w->left_col. */ |
1640 int canon_x = CANON_X_UNIT (s->f); | 1686 r.x = WINDOW_LEFT_EDGE_X (s->w); |
1641 | 1687 r.width = WINDOW_TOTAL_WIDTH (s->w); |
1642 r.x = WINDOW_LEFT_MARGIN (s->w) * canon_x; | |
1643 r.width = XFASTINT (s->w->width) * canon_x; | |
1644 | |
1645 if (FRAME_HAS_VERTICAL_SCROLL_BARS (s->f)) | |
1646 { | |
1647 int width = FRAME_SCROLL_BAR_WIDTH (s->f) * canon_x; | |
1648 if (FRAME_HAS_VERTICAL_SCROLL_BARS_ON_LEFT (s->f)) | |
1649 r.x -= width; | |
1650 } | |
1651 | |
1652 r.x += FRAME_INTERNAL_BORDER_WIDTH (s->f); | |
1653 | 1688 |
1654 /* Unless displaying a mode or menu bar line, which are always | 1689 /* Unless displaying a mode or menu bar line, which are always |
1655 fully visible, clip to the visible part of the row. */ | 1690 fully visible, clip to the visible part of the row. */ |
1656 if (s->w->pseudo_window_p) | 1691 if (s->w->pseudo_window_p) |
1657 r.height = s->row->visible_height; | 1692 r.height = s->row->visible_height; |
1659 r.height = s->height; | 1694 r.height = s->height; |
1660 } | 1695 } |
1661 else | 1696 else |
1662 { | 1697 { |
1663 /* This is a text line that may be partially visible. */ | 1698 /* This is a text line that may be partially visible. */ |
1664 r.x = WINDOW_AREA_TO_FRAME_PIXEL_X (s->w, s->area, 0); | 1699 r.x = window_box_left (s->w, s->area); |
1665 r.width = window_box_width (s->w, s->area); | 1700 r.width = window_box_width (s->w, s->area); |
1666 r.height = s->row->visible_height; | 1701 r.height = s->row->visible_height; |
1667 } | 1702 } |
1668 | 1703 |
1669 /* If S draws overlapping rows, it's sufficient to use the top and | 1704 /* If S draws overlapping rows, it's sufficient to use the top and |
1670 bottom of the window for clipping because this glyph string | 1705 bottom of the window for clipping because this glyph string |
1671 intentionally draws over other lines. */ | 1706 intentionally draws over other lines. */ |
1672 if (s->for_overlaps_p) | 1707 if (s->for_overlaps_p) |
1673 { | 1708 { |
1674 r.y = WINDOW_DISPLAY_HEADER_LINE_HEIGHT (s->w); | 1709 r.y = WINDOW_HEADER_LINE_HEIGHT (s->w); |
1675 r.height = window_text_bottom_y (s->w) - r.y; | 1710 r.height = window_text_bottom_y (s->w) - r.y; |
1676 } | 1711 } |
1677 else | 1712 else |
1678 { | 1713 { |
1679 /* Don't use S->y for clipping because it doesn't take partially | 1714 /* Don't use S->y for clipping because it doesn't take partially |
1680 visible lines into account. For example, it can be negative for | 1715 visible lines into account. For example, it can be negative for |
1681 partially visible lines at the top of a window. */ | 1716 partially visible lines at the top of a window. */ |
1682 if (!s->row->full_width_p | 1717 if (!s->row->full_width_p |
1683 && MATRIX_ROW_PARTIALLY_VISIBLE_AT_TOP_P (s->w, s->row)) | 1718 && MATRIX_ROW_PARTIALLY_VISIBLE_AT_TOP_P (s->w, s->row)) |
1684 r.y = WINDOW_DISPLAY_HEADER_LINE_HEIGHT (s->w); | 1719 r.y = WINDOW_HEADER_LINE_HEIGHT (s->w); |
1685 else | 1720 else |
1686 r.y = max (0, s->row->y); | 1721 r.y = max (0, s->row->y); |
1687 | 1722 |
1688 /* If drawing a tool-bar window, draw it over the internal border | 1723 /* If drawing a tool-bar window, draw it over the internal border |
1689 at the top of the window. */ | 1724 at the top of the window. */ |
2085 start of this total display area. */ | 2120 start of this total display area. */ |
2086 if (base_face_id != DEFAULT_FACE_ID) | 2121 if (base_face_id != DEFAULT_FACE_ID) |
2087 { | 2122 { |
2088 /* Mode lines, menu bar in terminal frames. */ | 2123 /* Mode lines, menu bar in terminal frames. */ |
2089 it->first_visible_x = 0; | 2124 it->first_visible_x = 0; |
2090 it->last_visible_x = XFASTINT (w->width) * CANON_X_UNIT (it->f); | 2125 it->last_visible_x = WINDOW_TOTAL_WIDTH (w); |
2091 } | 2126 } |
2092 else | 2127 else |
2093 { | 2128 { |
2094 it->first_visible_x | 2129 it->first_visible_x |
2095 = XFASTINT (it->w->hscroll) * CANON_X_UNIT (it->f); | 2130 = XFASTINT (it->w->hscroll) * FRAME_COLUMN_WIDTH (it->f); |
2096 it->last_visible_x = (it->first_visible_x | 2131 it->last_visible_x = (it->first_visible_x |
2097 + window_box_width (w, TEXT_AREA)); | 2132 + window_box_width (w, TEXT_AREA)); |
2098 | 2133 |
2099 /* If we truncate lines, leave room for the truncator glyph(s) at | 2134 /* If we truncate lines, leave room for the truncator glyph(s) at |
2100 the right margin. Otherwise, leave room for the continuation | 2135 the right margin. Otherwise, leave room for the continuation |
2107 else | 2142 else |
2108 it->last_visible_x -= it->continuation_pixel_width; | 2143 it->last_visible_x -= it->continuation_pixel_width; |
2109 } | 2144 } |
2110 | 2145 |
2111 it->header_line_p = WINDOW_WANTS_HEADER_LINE_P (w); | 2146 it->header_line_p = WINDOW_WANTS_HEADER_LINE_P (w); |
2112 it->current_y = WINDOW_DISPLAY_HEADER_LINE_HEIGHT (w) + w->vscroll; | 2147 it->current_y = WINDOW_HEADER_LINE_HEIGHT (w) + w->vscroll; |
2113 } | 2148 } |
2114 | 2149 |
2115 /* Leave room for a border glyph. */ | 2150 /* Leave room for a border glyph. */ |
2116 if (!FRAME_WINDOW_P (it->f) | 2151 if (!FRAME_WINDOW_P (it->f) |
2117 && !WINDOW_RIGHTMOST_P (it->w)) | 2152 && !WINDOW_RIGHTMOST_P (it->w)) |
5794 int start_pos = IT_CHARPOS (*it); | 5829 int start_pos = IT_CHARPOS (*it); |
5795 | 5830 |
5796 xassert (dy >= 0); | 5831 xassert (dy >= 0); |
5797 | 5832 |
5798 /* Estimate how many newlines we must move back. */ | 5833 /* Estimate how many newlines we must move back. */ |
5799 nlines = max (1, dy / CANON_Y_UNIT (it->f)); | 5834 nlines = max (1, dy / FRAME_LINE_HEIGHT (it->f)); |
5800 | 5835 |
5801 /* Set the iterator's position that many lines back. */ | 5836 /* Set the iterator's position that many lines back. */ |
5802 while (nlines-- && IT_CHARPOS (*it) > BEGV) | 5837 while (nlines-- && IT_CHARPOS (*it) > BEGV) |
5803 back_to_previous_visible_line_start (it); | 5838 back_to_previous_visible_line_start (it); |
5804 | 5839 |
7105 | 7140 |
7106 if (!FRAME_MINIBUF_ONLY_P (f)) | 7141 if (!FRAME_MINIBUF_ONLY_P (f)) |
7107 { | 7142 { |
7108 struct it it; | 7143 struct it it; |
7109 struct window *root = XWINDOW (FRAME_ROOT_WINDOW (f)); | 7144 struct window *root = XWINDOW (FRAME_ROOT_WINDOW (f)); |
7110 int total_height = XFASTINT (root->height) + XFASTINT (w->height); | 7145 int total_height = WINDOW_TOTAL_LINES (root) + WINDOW_TOTAL_LINES (w); |
7111 int height, max_height; | 7146 int height, max_height; |
7112 int unit = CANON_Y_UNIT (f); | 7147 int unit = FRAME_LINE_HEIGHT (f); |
7113 struct text_pos start; | 7148 struct text_pos start; |
7114 struct buffer *old_current_buffer = NULL; | 7149 struct buffer *old_current_buffer = NULL; |
7115 | 7150 |
7116 if (current_buffer != XBUFFER (w->buffer)) | 7151 if (current_buffer != XBUFFER (w->buffer)) |
7117 { | 7152 { |
7121 | 7156 |
7122 init_iterator (&it, w, BEGV, BEGV_BYTE, NULL, DEFAULT_FACE_ID); | 7157 init_iterator (&it, w, BEGV, BEGV_BYTE, NULL, DEFAULT_FACE_ID); |
7123 | 7158 |
7124 /* Compute the max. number of lines specified by the user. */ | 7159 /* Compute the max. number of lines specified by the user. */ |
7125 if (FLOATP (Vmax_mini_window_height)) | 7160 if (FLOATP (Vmax_mini_window_height)) |
7126 max_height = XFLOATINT (Vmax_mini_window_height) * FRAME_HEIGHT (f); | 7161 max_height = XFLOATINT (Vmax_mini_window_height) * FRAME_LINES (f); |
7127 else if (INTEGERP (Vmax_mini_window_height)) | 7162 else if (INTEGERP (Vmax_mini_window_height)) |
7128 max_height = XINT (Vmax_mini_window_height); | 7163 max_height = XINT (Vmax_mini_window_height); |
7129 else | 7164 else |
7130 max_height = total_height / 4; | 7165 max_height = total_height / 4; |
7131 | 7166 |
7162 | 7197 |
7163 if (EQ (Vresize_mini_windows, Qgrow_only)) | 7198 if (EQ (Vresize_mini_windows, Qgrow_only)) |
7164 { | 7199 { |
7165 /* Let it grow only, until we display an empty message, in which | 7200 /* Let it grow only, until we display an empty message, in which |
7166 case the window shrinks again. */ | 7201 case the window shrinks again. */ |
7167 if (height > XFASTINT (w->height)) | 7202 if (height > WINDOW_TOTAL_LINES (w)) |
7168 { | 7203 { |
7169 int old_height = XFASTINT (w->height); | 7204 int old_height = WINDOW_TOTAL_LINES (w); |
7170 freeze_window_starts (f, 1); | 7205 freeze_window_starts (f, 1); |
7171 grow_mini_window (w, height - XFASTINT (w->height)); | 7206 grow_mini_window (w, height - WINDOW_TOTAL_LINES (w)); |
7172 window_height_changed_p = XFASTINT (w->height) != old_height; | 7207 window_height_changed_p = WINDOW_TOTAL_LINES (w) != old_height; |
7173 } | 7208 } |
7174 else if (height < XFASTINT (w->height) | 7209 else if (height < WINDOW_TOTAL_LINES (w) |
7175 && (exact_p || BEGV == ZV)) | 7210 && (exact_p || BEGV == ZV)) |
7176 { | 7211 { |
7177 int old_height = XFASTINT (w->height); | 7212 int old_height = WINDOW_TOTAL_LINES (w); |
7178 freeze_window_starts (f, 0); | 7213 freeze_window_starts (f, 0); |
7179 shrink_mini_window (w); | 7214 shrink_mini_window (w); |
7180 window_height_changed_p = XFASTINT (w->height) != old_height; | 7215 window_height_changed_p = WINDOW_TOTAL_LINES (w) != old_height; |
7181 } | 7216 } |
7182 } | 7217 } |
7183 else | 7218 else |
7184 { | 7219 { |
7185 /* Always resize to exact size needed. */ | 7220 /* Always resize to exact size needed. */ |
7186 if (height > XFASTINT (w->height)) | 7221 if (height > WINDOW_TOTAL_LINES (w)) |
7187 { | 7222 { |
7188 int old_height = XFASTINT (w->height); | 7223 int old_height = WINDOW_TOTAL_LINES (w); |
7189 freeze_window_starts (f, 1); | 7224 freeze_window_starts (f, 1); |
7190 grow_mini_window (w, height - XFASTINT (w->height)); | 7225 grow_mini_window (w, height - WINDOW_TOTAL_LINES (w)); |
7191 window_height_changed_p = XFASTINT (w->height) != old_height; | 7226 window_height_changed_p = WINDOW_TOTAL_LINES (w) != old_height; |
7192 } | 7227 } |
7193 else if (height < XFASTINT (w->height)) | 7228 else if (height < WINDOW_TOTAL_LINES (w)) |
7194 { | 7229 { |
7195 int old_height = XFASTINT (w->height); | 7230 int old_height = WINDOW_TOTAL_LINES (w); |
7196 freeze_window_starts (f, 0); | 7231 freeze_window_starts (f, 0); |
7197 shrink_mini_window (w); | 7232 shrink_mini_window (w); |
7198 | 7233 |
7199 if (height) | 7234 if (height) |
7200 { | 7235 { |
7201 freeze_window_starts (f, 1); | 7236 freeze_window_starts (f, 1); |
7202 grow_mini_window (w, height - XFASTINT (w->height)); | 7237 grow_mini_window (w, height - WINDOW_TOTAL_LINES (w)); |
7203 } | 7238 } |
7204 | 7239 |
7205 window_height_changed_p = XFASTINT (w->height) != old_height; | 7240 window_height_changed_p = WINDOW_TOTAL_LINES (w) != old_height; |
7206 } | 7241 } |
7207 } | 7242 } |
7208 | 7243 |
7209 if (old_current_buffer) | 7244 if (old_current_buffer) |
7210 set_buffer_internal (old_current_buffer); | 7245 set_buffer_internal (old_current_buffer); |
8103 { | 8138 { |
8104 #ifdef USE_GTK | 8139 #ifdef USE_GTK |
8105 int do_update = FRAME_EXTERNAL_TOOL_BAR(f); | 8140 int do_update = FRAME_EXTERNAL_TOOL_BAR(f); |
8106 #else | 8141 #else |
8107 int do_update = WINDOWP (f->tool_bar_window) | 8142 int do_update = WINDOWP (f->tool_bar_window) |
8108 && XFASTINT (XWINDOW (f->tool_bar_window)->height) > 0; | 8143 && WINDOW_TOTAL_LINES (XWINDOW (f->tool_bar_window)) > 0; |
8109 #endif | 8144 #endif |
8110 | 8145 |
8111 if (do_update) | 8146 if (do_update) |
8112 { | 8147 { |
8113 Lisp_Object window; | 8148 Lisp_Object window; |
8436 | 8471 |
8437 /* Initialize an iterator for iteration over | 8472 /* Initialize an iterator for iteration over |
8438 F->desired_tool_bar_string in the tool-bar window of frame F. */ | 8473 F->desired_tool_bar_string in the tool-bar window of frame F. */ |
8439 init_iterator (&it, w, -1, -1, w->desired_matrix->rows, TOOL_BAR_FACE_ID); | 8474 init_iterator (&it, w, -1, -1, w->desired_matrix->rows, TOOL_BAR_FACE_ID); |
8440 it.first_visible_x = 0; | 8475 it.first_visible_x = 0; |
8441 it.last_visible_x = FRAME_WINDOW_WIDTH (f) * CANON_X_UNIT (f); | 8476 it.last_visible_x = FRAME_TOTAL_COLS (f) * FRAME_COLUMN_WIDTH (f); |
8442 reseat_to_string (&it, NULL, f->desired_tool_bar_string, 0, 0, 0, -1); | 8477 reseat_to_string (&it, NULL, f->desired_tool_bar_string, 0, 0, 0, -1); |
8443 | 8478 |
8444 while (!ITERATOR_AT_END_P (&it)) | 8479 while (!ITERATOR_AT_END_P (&it)) |
8445 { | 8480 { |
8446 it.glyph_row = w->desired_matrix->rows; | 8481 it.glyph_row = w->desired_matrix->rows; |
8447 clear_glyph_row (it.glyph_row); | 8482 clear_glyph_row (it.glyph_row); |
8448 display_tool_bar_line (&it); | 8483 display_tool_bar_line (&it); |
8449 } | 8484 } |
8450 | 8485 |
8451 return (it.current_y + CANON_Y_UNIT (f) - 1) / CANON_Y_UNIT (f); | 8486 return (it.current_y + FRAME_LINE_HEIGHT (f) - 1) / FRAME_LINE_HEIGHT (f); |
8452 } | 8487 } |
8453 | 8488 |
8454 | 8489 |
8455 DEFUN ("tool-bar-lines-needed", Ftool_bar_lines_needed, Stool_bar_lines_needed, | 8490 DEFUN ("tool-bar-lines-needed", Ftool_bar_lines_needed, Stool_bar_lines_needed, |
8456 0, 1, 0, | 8491 0, 1, 0, |
8468 CHECK_FRAME (frame); | 8503 CHECK_FRAME (frame); |
8469 f = XFRAME (frame); | 8504 f = XFRAME (frame); |
8470 | 8505 |
8471 if (WINDOWP (f->tool_bar_window) | 8506 if (WINDOWP (f->tool_bar_window) |
8472 || (w = XWINDOW (f->tool_bar_window), | 8507 || (w = XWINDOW (f->tool_bar_window), |
8473 XFASTINT (w->height) > 0)) | 8508 WINDOW_TOTAL_LINES (w) > 0)) |
8474 { | 8509 { |
8475 update_tool_bar (f, 1); | 8510 update_tool_bar (f, 1); |
8476 if (f->n_tool_bar_items) | 8511 if (f->n_tool_bar_items) |
8477 { | 8512 { |
8478 build_desired_tool_bar_string (f); | 8513 build_desired_tool_bar_string (f); |
8506 do anything. This means you must start with tool-bar-lines | 8541 do anything. This means you must start with tool-bar-lines |
8507 non-zero to get the auto-sizing effect. Or in other words, you | 8542 non-zero to get the auto-sizing effect. Or in other words, you |
8508 can turn off tool-bars by specifying tool-bar-lines zero. */ | 8543 can turn off tool-bars by specifying tool-bar-lines zero. */ |
8509 if (!WINDOWP (f->tool_bar_window) | 8544 if (!WINDOWP (f->tool_bar_window) |
8510 || (w = XWINDOW (f->tool_bar_window), | 8545 || (w = XWINDOW (f->tool_bar_window), |
8511 XFASTINT (w->height) == 0)) | 8546 WINDOW_TOTAL_LINES (w) == 0)) |
8512 return 0; | 8547 return 0; |
8513 | 8548 |
8514 /* Set up an iterator for the tool-bar window. */ | 8549 /* Set up an iterator for the tool-bar window. */ |
8515 init_iterator (&it, w, -1, -1, w->desired_matrix->rows, TOOL_BAR_FACE_ID); | 8550 init_iterator (&it, w, -1, -1, w->desired_matrix->rows, TOOL_BAR_FACE_ID); |
8516 it.first_visible_x = 0; | 8551 it.first_visible_x = 0; |
8517 it.last_visible_x = FRAME_WINDOW_WIDTH (f) * CANON_X_UNIT (f); | 8552 it.last_visible_x = FRAME_TOTAL_COLS (f) * FRAME_COLUMN_WIDTH (f); |
8518 row = it.glyph_row; | 8553 row = it.glyph_row; |
8519 | 8554 |
8520 /* Build a string that represents the contents of the tool-bar. */ | 8555 /* Build a string that represents the contents of the tool-bar. */ |
8521 build_desired_tool_bar_string (f); | 8556 build_desired_tool_bar_string (f); |
8522 reseat_to_string (&it, NULL, f->desired_tool_bar_string, 0, 0, 0, -1); | 8557 reseat_to_string (&it, NULL, f->desired_tool_bar_string, 0, 0, 0, -1); |
8539 if (IT_STRING_CHARPOS (it) < it.end_charpos) | 8574 if (IT_STRING_CHARPOS (it) < it.end_charpos) |
8540 change_height_p = 1; | 8575 change_height_p = 1; |
8541 | 8576 |
8542 /* If there are blank lines at the end, except for a partially | 8577 /* If there are blank lines at the end, except for a partially |
8543 visible blank line at the end that is smaller than | 8578 visible blank line at the end that is smaller than |
8544 CANON_Y_UNIT, change the tool-bar's height. */ | 8579 FRAME_LINE_HEIGHT, change the tool-bar's height. */ |
8545 row = it.glyph_row - 1; | 8580 row = it.glyph_row - 1; |
8546 if (!row->displays_text_p | 8581 if (!row->displays_text_p |
8547 && row->height >= CANON_Y_UNIT (f)) | 8582 && row->height >= FRAME_LINE_HEIGHT (f)) |
8548 change_height_p = 1; | 8583 change_height_p = 1; |
8549 | 8584 |
8550 /* If row displays tool-bar items, but is partially visible, | 8585 /* If row displays tool-bar items, but is partially visible, |
8551 change the tool-bar's height. */ | 8586 change the tool-bar's height. */ |
8552 if (row->displays_text_p | 8587 if (row->displays_text_p |
8555 | 8590 |
8556 /* Resize windows as needed by changing the `tool-bar-lines' | 8591 /* Resize windows as needed by changing the `tool-bar-lines' |
8557 frame parameter. */ | 8592 frame parameter. */ |
8558 if (change_height_p | 8593 if (change_height_p |
8559 && (nlines = tool_bar_lines_needed (f), | 8594 && (nlines = tool_bar_lines_needed (f), |
8560 nlines != XFASTINT (w->height))) | 8595 nlines != WINDOW_TOTAL_LINES (w))) |
8561 { | 8596 { |
8562 extern Lisp_Object Qtool_bar_lines; | 8597 extern Lisp_Object Qtool_bar_lines; |
8563 Lisp_Object frame; | 8598 Lisp_Object frame; |
8564 int old_height = XFASTINT (w->height); | 8599 int old_height = WINDOW_TOTAL_LINES (w); |
8565 | 8600 |
8566 XSETFRAME (frame, f); | 8601 XSETFRAME (frame, f); |
8567 clear_glyph_matrix (w->desired_matrix); | 8602 clear_glyph_matrix (w->desired_matrix); |
8568 Fmodify_frame_parameters (frame, | 8603 Fmodify_frame_parameters (frame, |
8569 Fcons (Fcons (Qtool_bar_lines, | 8604 Fcons (Fcons (Qtool_bar_lines, |
8570 make_number (nlines)), | 8605 make_number (nlines)), |
8571 Qnil)); | 8606 Qnil)); |
8572 if (XFASTINT (w->height) != old_height) | 8607 if (WINDOW_TOTAL_LINES (w) != old_height) |
8573 fonts_changed_p = 1; | 8608 fonts_changed_p = 1; |
8574 } | 8609 } |
8575 } | 8610 } |
8576 | 8611 |
8577 return change_height_p; | 8612 return change_height_p; |
8780 /* If tool-bar item is not enabled, don't highlight it. */ | 8815 /* If tool-bar item is not enabled, don't highlight it. */ |
8781 enabled_p = AREF (f->tool_bar_items, prop_idx + TOOL_BAR_ITEM_ENABLED_P); | 8816 enabled_p = AREF (f->tool_bar_items, prop_idx + TOOL_BAR_ITEM_ENABLED_P); |
8782 if (!NILP (enabled_p)) | 8817 if (!NILP (enabled_p)) |
8783 { | 8818 { |
8784 /* Compute the x-position of the glyph. In front and past the | 8819 /* Compute the x-position of the glyph. In front and past the |
8785 image is a space. We include this is the highlighted area. */ | 8820 image is a space. We include this in the highlighted area. */ |
8786 row = MATRIX_ROW (w->current_matrix, vpos); | 8821 row = MATRIX_ROW (w->current_matrix, vpos); |
8787 for (i = x = 0; i < hpos; ++i) | 8822 for (i = x = 0; i < hpos; ++i) |
8788 x += row->glyphs[TEXT_AREA][i].pixel_width; | 8823 x += row->glyphs[TEXT_AREA][i].pixel_width; |
8789 | 8824 |
8790 /* Record this as the current active region. */ | 8825 /* Record this as the current active region. */ |
8907 /* Clear left fringe if no bitmap to draw or if bitmap doesn't fill | 8942 /* Clear left fringe if no bitmap to draw or if bitmap doesn't fill |
8908 the fringe. */ | 8943 the fringe. */ |
8909 p.bx = -1; | 8944 p.bx = -1; |
8910 if (left_p) | 8945 if (left_p) |
8911 { | 8946 { |
8912 if (p.wd > FRAME_X_LEFT_FRINGE_WIDTH (f)) | 8947 int wd = WINDOW_LEFT_FRINGE_WIDTH (w); |
8913 p.wd = FRAME_X_LEFT_FRINGE_WIDTH (f); | 8948 int x = window_box_left (w, (WINDOW_HAS_FRINGES_OUTSIDE_MARGINS (w) |
8914 p.x = (WINDOW_TO_FRAME_PIXEL_X (w, 0) | 8949 ? LEFT_MARGIN_AREA |
8915 - p.wd | 8950 : TEXT_AREA)); |
8916 - (FRAME_X_LEFT_FRINGE_WIDTH (f) - p.wd) / 2); | 8951 if (p.wd > wd) |
8917 if (p.wd < FRAME_X_LEFT_FRINGE_WIDTH (f) || row->height > p.h) | 8952 p.wd = wd; |
8953 p.x = x - p.wd - (wd - p.wd) / 2; | |
8954 | |
8955 if (p.wd < wd || row->height > p.h) | |
8918 { | 8956 { |
8919 /* If W has a vertical border to its left, don't draw over it. */ | 8957 /* If W has a vertical border to its left, don't draw over it. */ |
8920 int border = ((XFASTINT (w->left) > 0 | 8958 wd -= ((!WINDOW_LEFTMOST_P (w) |
8921 && !FRAME_HAS_VERTICAL_SCROLL_BARS (f)) | 8959 && !WINDOW_HAS_VERTICAL_SCROLL_BAR (w)) |
8922 ? 1 : 0); | 8960 ? 1 : 0); |
8923 p.bx = (window_box_left (w, -1) | 8961 p.bx = x - wd; |
8924 - FRAME_X_LEFT_FRINGE_WIDTH (f) | 8962 p.nx = wd; |
8925 + border); | |
8926 p.nx = (FRAME_X_LEFT_FRINGE_WIDTH (f) - border); | |
8927 } | 8963 } |
8928 } | 8964 } |
8929 else | 8965 else |
8930 { | 8966 { |
8931 if (p.wd > FRAME_X_RIGHT_FRINGE_WIDTH (f)) | 8967 int x = window_box_right (w, |
8932 p.wd = FRAME_X_RIGHT_FRINGE_WIDTH (f); | 8968 (WINDOW_HAS_FRINGES_OUTSIDE_MARGINS (w) |
8933 p.x = (window_box_right (w, -1) | 8969 ? RIGHT_MARGIN_AREA |
8934 + (FRAME_X_RIGHT_FRINGE_WIDTH (f) - p.wd) / 2); | 8970 : TEXT_AREA)); |
8971 int wd = WINDOW_RIGHT_FRINGE_WIDTH (w); | |
8972 if (p.wd > wd) | |
8973 p.wd = wd; | |
8974 p.x = x + (wd - p.wd) / 2; | |
8935 /* Clear right fringe if no bitmap to draw of if bitmap doesn't fill | 8975 /* Clear right fringe if no bitmap to draw of if bitmap doesn't fill |
8936 the fringe. */ | 8976 the fringe. */ |
8937 if (p.wd < FRAME_X_RIGHT_FRINGE_WIDTH (f) || row->height > p.h) | 8977 if (p.wd < wd || row->height > p.h) |
8938 { | 8978 { |
8939 p.bx = window_box_right (w, -1); | 8979 p.bx = x; |
8940 p.nx = FRAME_X_RIGHT_FRINGE_WIDTH (f); | 8980 p.nx = wd; |
8941 } | 8981 } |
8942 } | 8982 } |
8943 | 8983 |
8944 if (p.bx >= 0) | 8984 if (p.bx >= 0) |
8945 { | 8985 { |
8946 int header_line_height = WINDOW_DISPLAY_HEADER_LINE_HEIGHT (w); | 8986 int header_line_height = WINDOW_HEADER_LINE_HEIGHT (w); |
8947 | 8987 |
8948 p.by = WINDOW_TO_FRAME_PIXEL_Y (w, max (header_line_height, row->y)); | 8988 p.by = WINDOW_TO_FRAME_PIXEL_Y (w, max (header_line_height, row->y)); |
8949 p.ny = row->visible_height; | 8989 p.ny = row->visible_height; |
8950 } | 8990 } |
8951 | 8991 |
8971 /* If row is completely invisible, because of vscrolling, we | 9011 /* If row is completely invisible, because of vscrolling, we |
8972 don't have to draw anything. */ | 9012 don't have to draw anything. */ |
8973 if (row->visible_height <= 0) | 9013 if (row->visible_height <= 0) |
8974 return; | 9014 return; |
8975 | 9015 |
8976 if (FRAME_X_LEFT_FRINGE_WIDTH (f) != 0) | 9016 if (WINDOW_LEFT_FRINGE_WIDTH (w) != 0) |
8977 { | 9017 { |
8978 /* Decide which bitmap to draw in the left fringe. */ | 9018 /* Decide which bitmap to draw in the left fringe. */ |
8979 if (row->overlay_arrow_p) | 9019 if (row->overlay_arrow_p) |
8980 bitmap = OVERLAY_ARROW_BITMAP; | 9020 bitmap = OVERLAY_ARROW_BITMAP; |
8981 else if (row->truncated_on_left_p) | 9021 else if (row->truncated_on_left_p) |
8988 bitmap = NO_FRINGE_BITMAP; | 9028 bitmap = NO_FRINGE_BITMAP; |
8989 | 9029 |
8990 draw_fringe_bitmap (w, row, bitmap, 1); | 9030 draw_fringe_bitmap (w, row, bitmap, 1); |
8991 } | 9031 } |
8992 | 9032 |
8993 if (FRAME_X_RIGHT_FRINGE_WIDTH (f) != 0) | 9033 if (WINDOW_RIGHT_FRINGE_WIDTH (w) != 0) |
8994 { | 9034 { |
8995 /* Decide which bitmap to draw in the right fringe. */ | 9035 /* Decide which bitmap to draw in the right fringe. */ |
8996 if (row->truncated_on_right_p) | 9036 if (row->truncated_on_right_p) |
8997 bitmap = RIGHT_TRUNCATION_BITMAP; | 9037 bitmap = RIGHT_TRUNCATION_BITMAP; |
8998 else if (row->continued_p) | 9038 else if (row->continued_p) |
8999 bitmap = CONTINUED_LINE_BITMAP; | 9039 bitmap = CONTINUED_LINE_BITMAP; |
9000 else if (row->indicate_empty_line_p && FRAME_X_LEFT_FRINGE_WIDTH (f) == 0) | 9040 else if (row->indicate_empty_line_p && WINDOW_LEFT_FRINGE_WIDTH (w) == 0) |
9001 bitmap = ZV_LINE_BITMAP; | 9041 bitmap = ZV_LINE_BITMAP; |
9002 else | 9042 else |
9003 bitmap = NO_FRINGE_BITMAP; | 9043 bitmap = NO_FRINGE_BITMAP; |
9004 | 9044 |
9005 draw_fringe_bitmap (w, row, bitmap, 0); | 9045 draw_fringe_bitmap (w, row, bitmap, 0); |
9012 void | 9052 void |
9013 compute_fringe_widths (f, redraw) | 9053 compute_fringe_widths (f, redraw) |
9014 struct frame *f; | 9054 struct frame *f; |
9015 int redraw; | 9055 int redraw; |
9016 { | 9056 { |
9017 int o_left = FRAME_X_LEFT_FRINGE_WIDTH (f); | 9057 int o_left = FRAME_LEFT_FRINGE_WIDTH (f); |
9018 int o_right = FRAME_X_RIGHT_FRINGE_WIDTH (f); | 9058 int o_right = FRAME_RIGHT_FRINGE_WIDTH (f); |
9019 int o_cols = FRAME_X_FRINGE_COLS (f); | 9059 int o_cols = FRAME_FRINGE_COLS (f); |
9020 | 9060 |
9021 Lisp_Object left_fringe = Fassq (Qleft_fringe, f->param_alist); | 9061 Lisp_Object left_fringe = Fassq (Qleft_fringe, f->param_alist); |
9022 Lisp_Object right_fringe = Fassq (Qright_fringe, f->param_alist); | 9062 Lisp_Object right_fringe = Fassq (Qright_fringe, f->param_alist); |
9023 int left_fringe_width, right_fringe_width; | 9063 int left_fringe_width, right_fringe_width; |
9024 | 9064 |
9035 if (left_fringe_width || right_fringe_width) | 9075 if (left_fringe_width || right_fringe_width) |
9036 { | 9076 { |
9037 int left_wid = left_fringe_width >= 0 ? left_fringe_width : -left_fringe_width; | 9077 int left_wid = left_fringe_width >= 0 ? left_fringe_width : -left_fringe_width; |
9038 int right_wid = right_fringe_width >= 0 ? right_fringe_width : -right_fringe_width; | 9078 int right_wid = right_fringe_width >= 0 ? right_fringe_width : -right_fringe_width; |
9039 int conf_wid = left_wid + right_wid; | 9079 int conf_wid = left_wid + right_wid; |
9040 int font_wid = FONT_WIDTH (FRAME_FONT (f)); | 9080 int font_wid = FRAME_COLUMN_WIDTH (f); |
9041 int cols = (left_wid + right_wid + font_wid-1) / font_wid; | 9081 int cols = (left_wid + right_wid + font_wid-1) / font_wid; |
9042 int real_wid = cols * font_wid; | 9082 int real_wid = cols * font_wid; |
9043 if (left_wid && right_wid) | 9083 if (left_wid && right_wid) |
9044 { | 9084 { |
9045 if (left_fringe_width < 0) | 9085 if (left_fringe_width < 0) |
9046 { | 9086 { |
9047 /* Left fringe width is fixed, adjust right fringe if necessary */ | 9087 /* Left fringe width is fixed, adjust right fringe if necessary */ |
9048 FRAME_X_LEFT_FRINGE_WIDTH (f) = left_wid; | 9088 FRAME_LEFT_FRINGE_WIDTH (f) = left_wid; |
9049 FRAME_X_RIGHT_FRINGE_WIDTH (f) = real_wid - left_wid; | 9089 FRAME_RIGHT_FRINGE_WIDTH (f) = real_wid - left_wid; |
9050 } | 9090 } |
9051 else if (right_fringe_width < 0) | 9091 else if (right_fringe_width < 0) |
9052 { | 9092 { |
9053 /* Right fringe width is fixed, adjust left fringe if necessary */ | 9093 /* Right fringe width is fixed, adjust left fringe if necessary */ |
9054 FRAME_X_LEFT_FRINGE_WIDTH (f) = real_wid - right_wid; | 9094 FRAME_LEFT_FRINGE_WIDTH (f) = real_wid - right_wid; |
9055 FRAME_X_RIGHT_FRINGE_WIDTH (f) = right_wid; | 9095 FRAME_RIGHT_FRINGE_WIDTH (f) = right_wid; |
9056 } | 9096 } |
9057 else | 9097 else |
9058 { | 9098 { |
9059 /* Adjust both fringes with an equal amount. | 9099 /* Adjust both fringes with an equal amount. |
9060 Note that we are doing integer arithmetic here, so don't | 9100 Note that we are doing integer arithmetic here, so don't |
9061 lose a pixel if the total width is an odd number. */ | 9101 lose a pixel if the total width is an odd number. */ |
9062 int fill = real_wid - conf_wid; | 9102 int fill = real_wid - conf_wid; |
9063 FRAME_X_LEFT_FRINGE_WIDTH (f) = left_wid + fill/2; | 9103 FRAME_LEFT_FRINGE_WIDTH (f) = left_wid + fill/2; |
9064 FRAME_X_RIGHT_FRINGE_WIDTH (f) = right_wid + fill - fill/2; | 9104 FRAME_RIGHT_FRINGE_WIDTH (f) = right_wid + fill - fill/2; |
9065 } | 9105 } |
9066 } | 9106 } |
9067 else if (left_fringe_width) | 9107 else if (left_fringe_width) |
9068 { | 9108 { |
9069 FRAME_X_LEFT_FRINGE_WIDTH (f) = real_wid; | 9109 FRAME_LEFT_FRINGE_WIDTH (f) = real_wid; |
9070 FRAME_X_RIGHT_FRINGE_WIDTH (f) = 0; | 9110 FRAME_RIGHT_FRINGE_WIDTH (f) = 0; |
9071 } | 9111 } |
9072 else | 9112 else |
9073 { | 9113 { |
9074 FRAME_X_LEFT_FRINGE_WIDTH (f) = 0; | 9114 FRAME_LEFT_FRINGE_WIDTH (f) = 0; |
9075 FRAME_X_RIGHT_FRINGE_WIDTH (f) = real_wid; | 9115 FRAME_RIGHT_FRINGE_WIDTH (f) = real_wid; |
9076 } | 9116 } |
9077 FRAME_X_FRINGE_COLS (f) = cols; | 9117 FRAME_FRINGE_COLS (f) = cols; |
9078 FRAME_X_FRINGE_WIDTH (f) = real_wid; | |
9079 } | 9118 } |
9080 else | 9119 else |
9081 { | 9120 { |
9082 FRAME_X_LEFT_FRINGE_WIDTH (f) = 0; | 9121 FRAME_LEFT_FRINGE_WIDTH (f) = 0; |
9083 FRAME_X_RIGHT_FRINGE_WIDTH (f) = 0; | 9122 FRAME_RIGHT_FRINGE_WIDTH (f) = 0; |
9084 FRAME_X_FRINGE_COLS (f) = 0; | 9123 FRAME_FRINGE_COLS (f) = 0; |
9085 FRAME_X_FRINGE_WIDTH (f) = 0; | |
9086 } | 9124 } |
9087 | 9125 |
9088 if (redraw && FRAME_VISIBLE_P (f)) | 9126 if (redraw && FRAME_VISIBLE_P (f)) |
9089 if (o_left != FRAME_X_LEFT_FRINGE_WIDTH (f) || | 9127 if (o_left != FRAME_LEFT_FRINGE_WIDTH (f) || |
9090 o_right != FRAME_X_RIGHT_FRINGE_WIDTH (f) || | 9128 o_right != FRAME_RIGHT_FRINGE_WIDTH (f) || |
9091 o_cols != FRAME_X_FRINGE_COLS (f)) | 9129 o_cols != FRAME_FRINGE_COLS (f)) |
9092 redraw_frame (f); | 9130 redraw_frame (f); |
9093 } | 9131 } |
9094 | 9132 |
9095 #endif /* HAVE_WINDOW_SYSTEM */ | 9133 #endif /* HAVE_WINDOW_SYSTEM */ |
9096 | 9134 |
9144 hscrolled_p |= hscroll_window_tree (w->hchild); | 9182 hscrolled_p |= hscroll_window_tree (w->hchild); |
9145 else if (WINDOWP (w->vchild)) | 9183 else if (WINDOWP (w->vchild)) |
9146 hscrolled_p |= hscroll_window_tree (w->vchild); | 9184 hscrolled_p |= hscroll_window_tree (w->vchild); |
9147 else if (w->cursor.vpos >= 0) | 9185 else if (w->cursor.vpos >= 0) |
9148 { | 9186 { |
9149 int h_margin, text_area_x, text_area_y; | 9187 int h_margin; |
9150 int text_area_width, text_area_height; | 9188 int text_area_width; |
9151 struct glyph_row *current_cursor_row | 9189 struct glyph_row *current_cursor_row |
9152 = MATRIX_ROW (w->current_matrix, w->cursor.vpos); | 9190 = MATRIX_ROW (w->current_matrix, w->cursor.vpos); |
9153 struct glyph_row *desired_cursor_row | 9191 struct glyph_row *desired_cursor_row |
9154 = MATRIX_ROW (w->desired_matrix, w->cursor.vpos); | 9192 = MATRIX_ROW (w->desired_matrix, w->cursor.vpos); |
9155 struct glyph_row *cursor_row | 9193 struct glyph_row *cursor_row |
9156 = (desired_cursor_row->enabled_p | 9194 = (desired_cursor_row->enabled_p |
9157 ? desired_cursor_row | 9195 ? desired_cursor_row |
9158 : current_cursor_row); | 9196 : current_cursor_row); |
9159 | 9197 |
9160 window_box (w, TEXT_AREA, &text_area_x, &text_area_y, | 9198 text_area_width = window_box_width (w, TEXT_AREA); |
9161 &text_area_width, &text_area_height); | |
9162 | 9199 |
9163 /* Scroll when cursor is inside this scroll margin. */ | 9200 /* Scroll when cursor is inside this scroll margin. */ |
9164 h_margin = hscroll_margin * CANON_X_UNIT (XFRAME (w->frame)); | 9201 h_margin = hscroll_margin * WINDOW_FRAME_COLUMN_WIDTH (w); |
9165 | 9202 |
9166 if ((XFASTINT (w->hscroll) | 9203 if ((XFASTINT (w->hscroll) |
9167 && w->cursor.x <= h_margin) | 9204 && w->cursor.x <= h_margin) |
9168 || (cursor_row->enabled_p | 9205 || (cursor_row->enabled_p |
9169 && cursor_row->truncated_on_right_p | 9206 && cursor_row->truncated_on_right_p |
9196 current_buffer = saved_current_buffer; | 9233 current_buffer = saved_current_buffer; |
9197 | 9234 |
9198 /* Position cursor in window. */ | 9235 /* Position cursor in window. */ |
9199 if (!hscroll_relative_p && hscroll_step_abs == 0) | 9236 if (!hscroll_relative_p && hscroll_step_abs == 0) |
9200 hscroll = max (0, it.current_x - text_area_width / 2) | 9237 hscroll = max (0, it.current_x - text_area_width / 2) |
9201 / CANON_X_UNIT (it.f); | 9238 / FRAME_COLUMN_WIDTH (it.f); |
9202 else if (w->cursor.x >= text_area_width - h_margin) | 9239 else if (w->cursor.x >= text_area_width - h_margin) |
9203 { | 9240 { |
9204 if (hscroll_relative_p) | 9241 if (hscroll_relative_p) |
9205 wanted_x = text_area_width * (1 - hscroll_step_rel) | 9242 wanted_x = text_area_width * (1 - hscroll_step_rel) |
9206 - h_margin; | 9243 - h_margin; |
9207 else | 9244 else |
9208 wanted_x = text_area_width | 9245 wanted_x = text_area_width |
9209 - hscroll_step_abs * CANON_X_UNIT (it.f) | 9246 - hscroll_step_abs * FRAME_COLUMN_WIDTH (it.f) |
9210 - h_margin; | 9247 - h_margin; |
9211 hscroll | 9248 hscroll |
9212 = max (0, it.current_x - wanted_x) / CANON_X_UNIT (it.f); | 9249 = max (0, it.current_x - wanted_x) / FRAME_COLUMN_WIDTH (it.f); |
9213 } | 9250 } |
9214 else | 9251 else |
9215 { | 9252 { |
9216 if (hscroll_relative_p) | 9253 if (hscroll_relative_p) |
9217 wanted_x = text_area_width * hscroll_step_rel | 9254 wanted_x = text_area_width * hscroll_step_rel |
9218 + h_margin; | 9255 + h_margin; |
9219 else | 9256 else |
9220 wanted_x = hscroll_step_abs * CANON_X_UNIT (it.f) | 9257 wanted_x = hscroll_step_abs * FRAME_COLUMN_WIDTH (it.f) |
9221 + h_margin; | 9258 + h_margin; |
9222 hscroll | 9259 hscroll |
9223 = max (0, it.current_x - wanted_x) / CANON_X_UNIT (it.f); | 9260 = max (0, it.current_x - wanted_x) / FRAME_COLUMN_WIDTH (it.f); |
9224 } | 9261 } |
9225 hscroll = max (hscroll, XFASTINT (w->min_hscroll)); | 9262 hscroll = max (hscroll, XFASTINT (w->min_hscroll)); |
9226 | 9263 |
9227 /* Don't call Fset_window_hscroll if value hasn't | 9264 /* Don't call Fset_window_hscroll if value hasn't |
9228 changed because it will prevent redisplay | 9265 changed because it will prevent redisplay |
9867 else if (/* Cursor position hasn't changed. */ | 9904 else if (/* Cursor position hasn't changed. */ |
9868 PT == XFASTINT (w->last_point) | 9905 PT == XFASTINT (w->last_point) |
9869 /* Make sure the cursor was last displayed | 9906 /* Make sure the cursor was last displayed |
9870 in this window. Otherwise we have to reposition it. */ | 9907 in this window. Otherwise we have to reposition it. */ |
9871 && 0 <= w->cursor.vpos | 9908 && 0 <= w->cursor.vpos |
9872 && XINT (w->height) > w->cursor.vpos) | 9909 && WINDOW_TOTAL_LINES (w) > w->cursor.vpos) |
9873 { | 9910 { |
9874 if (!must_finish) | 9911 if (!must_finish) |
9875 { | 9912 { |
9876 do_pending_window_change (1); | 9913 do_pending_window_change (1); |
9877 | 9914 |
10271 if (accurate_p) | 10308 if (accurate_p) |
10272 { | 10309 { |
10273 w->window_end_valid = w->buffer; | 10310 w->window_end_valid = w->buffer; |
10274 #if 0 /* This is incorrect with variable-height lines. */ | 10311 #if 0 /* This is incorrect with variable-height lines. */ |
10275 xassert (XINT (w->window_end_vpos) | 10312 xassert (XINT (w->window_end_vpos) |
10276 < (XINT (w->height) | 10313 < (WINDOW_TOTAL_LINES (w) |
10277 - (WINDOW_WANTS_MODELINE_P (w) ? 1 : 0))); | 10314 - (WINDOW_WANTS_MODELINE_P (w) ? 1 : 0))); |
10278 #endif | 10315 #endif |
10279 w->update_mode_line = Qnil; | 10316 w->update_mode_line = Qnil; |
10280 } | 10317 } |
10281 } | 10318 } |
10734 | 10771 |
10735 /* Compute scroll margin height in pixels. We scroll when point is | 10772 /* Compute scroll margin height in pixels. We scroll when point is |
10736 within this distance from the top or bottom of the window. */ | 10773 within this distance from the top or bottom of the window. */ |
10737 if (scroll_margin > 0) | 10774 if (scroll_margin > 0) |
10738 { | 10775 { |
10739 this_scroll_margin = min (scroll_margin, XINT (w->height) / 4); | 10776 this_scroll_margin = min (scroll_margin, WINDOW_TOTAL_LINES (w) / 4); |
10740 this_scroll_margin *= CANON_Y_UNIT (f); | 10777 this_scroll_margin *= FRAME_LINE_HEIGHT (f); |
10741 } | 10778 } |
10742 else | 10779 else |
10743 this_scroll_margin = 0; | 10780 this_scroll_margin = 0; |
10744 | 10781 |
10745 /* Compute how much we should try to scroll maximally to bring point | 10782 /* Compute how much we should try to scroll maximally to bring point |
10753 but no scroll_step is set. Choose an arbitrary one. Maybe | 10790 but no scroll_step is set. Choose an arbitrary one. Maybe |
10754 there should be a variable for this. */ | 10791 there should be a variable for this. */ |
10755 scroll_max = 10; | 10792 scroll_max = 10; |
10756 else | 10793 else |
10757 scroll_max = 0; | 10794 scroll_max = 0; |
10758 scroll_max *= CANON_Y_UNIT (f); | 10795 scroll_max *= FRAME_LINE_HEIGHT (f); |
10759 | 10796 |
10760 /* Decide whether we have to scroll down. Start at the window end | 10797 /* Decide whether we have to scroll down. Start at the window end |
10761 and move this_scroll_margin up to find the position of the scroll | 10798 and move this_scroll_margin up to find the position of the scroll |
10762 margin. */ | 10799 margin. */ |
10763 window_end = Fwindow_end (window, Qt); | 10800 window_end = Fwindow_end (window, Qt); |
10804 | 10841 |
10805 if (scroll_conservatively) | 10842 if (scroll_conservatively) |
10806 /* Set AMOUNT_TO_SCROLL to at least one line, | 10843 /* Set AMOUNT_TO_SCROLL to at least one line, |
10807 and at most scroll_conservatively lines. */ | 10844 and at most scroll_conservatively lines. */ |
10808 amount_to_scroll | 10845 amount_to_scroll |
10809 = min (max (dy, CANON_Y_UNIT (f)), | 10846 = min (max (dy, FRAME_LINE_HEIGHT (f)), |
10810 CANON_Y_UNIT (f) * scroll_conservatively); | 10847 FRAME_LINE_HEIGHT (f) * scroll_conservatively); |
10811 else if (scroll_step || temp_scroll_step) | 10848 else if (scroll_step || temp_scroll_step) |
10812 amount_to_scroll = scroll_max; | 10849 amount_to_scroll = scroll_max; |
10813 else | 10850 else |
10814 { | 10851 { |
10815 aggressive = current_buffer->scroll_up_aggressively; | 10852 aggressive = current_buffer->scroll_up_aggressively; |
10816 height = (WINDOW_DISPLAY_HEIGHT_NO_MODE_LINE (w) | 10853 height = WINDOW_BOX_TEXT_HEIGHT (w); |
10817 - WINDOW_DISPLAY_HEADER_LINE_HEIGHT (w)); | |
10818 if (NUMBERP (aggressive)) | 10854 if (NUMBERP (aggressive)) |
10819 amount_to_scroll = XFLOATINT (aggressive) * height; | 10855 amount_to_scroll = XFLOATINT (aggressive) * height; |
10820 } | 10856 } |
10821 | 10857 |
10822 if (amount_to_scroll <= 0) | 10858 if (amount_to_scroll <= 0) |
10864 /* Compute new window start. */ | 10900 /* Compute new window start. */ |
10865 start_display (&it, w, startp); | 10901 start_display (&it, w, startp); |
10866 | 10902 |
10867 if (scroll_conservatively) | 10903 if (scroll_conservatively) |
10868 amount_to_scroll = | 10904 amount_to_scroll = |
10869 max (dy, CANON_Y_UNIT (f) * max (scroll_step, temp_scroll_step)); | 10905 max (dy, FRAME_LINE_HEIGHT (f) * max (scroll_step, temp_scroll_step)); |
10870 else if (scroll_step || temp_scroll_step) | 10906 else if (scroll_step || temp_scroll_step) |
10871 amount_to_scroll = scroll_max; | 10907 amount_to_scroll = scroll_max; |
10872 else | 10908 else |
10873 { | 10909 { |
10874 aggressive = current_buffer->scroll_down_aggressively; | 10910 aggressive = current_buffer->scroll_down_aggressively; |
10875 height = (WINDOW_DISPLAY_HEIGHT_NO_MODE_LINE (w) | 10911 height = WINDOW_BOX_TEXT_HEIGHT (w); |
10876 - WINDOW_DISPLAY_HEADER_LINE_HEIGHT (w)); | |
10877 if (NUMBERP (aggressive)) | 10912 if (NUMBERP (aggressive)) |
10878 amount_to_scroll = XFLOATINT (aggressive) * height; | 10913 amount_to_scroll = XFLOATINT (aggressive) * height; |
10879 } | 10914 } |
10880 | 10915 |
10881 if (amount_to_scroll <= 0) | 10916 if (amount_to_scroll <= 0) |
10961 reseat_at_previous_visible_line_start (&it); | 10996 reseat_at_previous_visible_line_start (&it); |
10962 | 10997 |
10963 /* If the line start is "too far" away from the window start, | 10998 /* If the line start is "too far" away from the window start, |
10964 say it takes too much time to compute a new window start. */ | 10999 say it takes too much time to compute a new window start. */ |
10965 if (CHARPOS (start_pos) - IT_CHARPOS (it) | 11000 if (CHARPOS (start_pos) - IT_CHARPOS (it) |
10966 < XFASTINT (w->height) * XFASTINT (w->width)) | 11001 < WINDOW_TOTAL_LINES (w) * WINDOW_TOTAL_COLS (w)) |
10967 { | 11002 { |
10968 int min_distance, distance; | 11003 int min_distance, distance; |
10969 | 11004 |
10970 /* Move forward by display lines to find the new window | 11005 /* Move forward by display lines to find the new window |
10971 start. If window width was enlarged, the new start can | 11006 start. If window width was enlarged, the new start can |
11079 #endif | 11114 #endif |
11080 | 11115 |
11081 /* Scroll if point within this distance from the top or bottom | 11116 /* Scroll if point within this distance from the top or bottom |
11082 of the window. This is a pixel value. */ | 11117 of the window. This is a pixel value. */ |
11083 this_scroll_margin = max (0, scroll_margin); | 11118 this_scroll_margin = max (0, scroll_margin); |
11084 this_scroll_margin = min (this_scroll_margin, XFASTINT (w->height) / 4); | 11119 this_scroll_margin = min (this_scroll_margin, WINDOW_TOTAL_LINES (w) / 4); |
11085 this_scroll_margin *= CANON_Y_UNIT (f); | 11120 this_scroll_margin *= FRAME_LINE_HEIGHT (f); |
11086 | 11121 |
11087 /* Start with the row the cursor was displayed during the last | 11122 /* Start with the row the cursor was displayed during the last |
11088 not paused redisplay. Give up if that row is not valid. */ | 11123 not paused redisplay. Give up if that row is not valid. */ |
11089 if (w->last_cursor.vpos < 0 | 11124 if (w->last_cursor.vpos < 0 |
11090 || w->last_cursor.vpos >= w->current_matrix->nrows) | 11125 || w->last_cursor.vpos >= w->current_matrix->nrows) |
11940 because the loop in redisplay_internal expects that. */ | 11975 because the loop in redisplay_internal expects that. */ |
11941 need_larger_matrices: | 11976 need_larger_matrices: |
11942 ; | 11977 ; |
11943 finish_scroll_bars: | 11978 finish_scroll_bars: |
11944 | 11979 |
11945 if (FRAME_HAS_VERTICAL_SCROLL_BARS (f)) | 11980 if (WINDOW_HAS_VERTICAL_SCROLL_BAR (w)) |
11946 { | 11981 { |
11947 /* Set the thumb's position and size. */ | 11982 /* Set the thumb's position and size. */ |
11948 set_vertical_scroll_bar (w); | 11983 set_vertical_scroll_bar (w); |
11949 | 11984 |
11950 /* Note that we actually used the scroll bar attached to this | 11985 /* Note that we actually used the scroll bar attached to this |
12175 /* Disable lines that must be updated. */ | 12210 /* Disable lines that must be updated. */ |
12176 for (i = 0; i < it.vpos; ++i) | 12211 for (i = 0; i < it.vpos; ++i) |
12177 (start_row + i)->enabled_p = 0; | 12212 (start_row + i)->enabled_p = 0; |
12178 | 12213 |
12179 /* Re-compute Y positions. */ | 12214 /* Re-compute Y positions. */ |
12180 min_y = WINDOW_DISPLAY_HEADER_LINE_HEIGHT (w); | 12215 min_y = WINDOW_HEADER_LINE_HEIGHT (w); |
12181 max_y = it.last_visible_y; | 12216 max_y = it.last_visible_y; |
12182 for (row = start_row + nrows_scrolled; | 12217 for (row = start_row + nrows_scrolled; |
12183 row < bottom_row; | 12218 row < bottom_row; |
12184 ++row) | 12219 ++row) |
12185 { | 12220 { |
12290 nrows_scrolled = (MATRIX_ROW_VPOS (first_reusable_row, w->current_matrix) | 12325 nrows_scrolled = (MATRIX_ROW_VPOS (first_reusable_row, w->current_matrix) |
12291 - start_vpos); | 12326 - start_vpos); |
12292 it.vpos = (MATRIX_ROW_VPOS (first_row_to_display, w->current_matrix) | 12327 it.vpos = (MATRIX_ROW_VPOS (first_row_to_display, w->current_matrix) |
12293 - nrows_scrolled); | 12328 - nrows_scrolled); |
12294 it.current_y = (first_row_to_display->y - first_reusable_row->y | 12329 it.current_y = (first_row_to_display->y - first_reusable_row->y |
12295 + WINDOW_DISPLAY_HEADER_LINE_HEIGHT (w)); | 12330 + WINDOW_HEADER_LINE_HEIGHT (w)); |
12296 | 12331 |
12297 /* Display lines beginning with first_row_to_display in the | 12332 /* Display lines beginning with first_row_to_display in the |
12298 desired matrix. Set last_text_row to the last row displayed | 12333 desired matrix. Set last_text_row to the last row displayed |
12299 that displays text. */ | 12334 that displays text. */ |
12300 it.glyph_row = MATRIX_ROW (w->desired_matrix, it.vpos); | 12335 it.glyph_row = MATRIX_ROW (w->desired_matrix, it.vpos); |
12321 w->cursor.y -= first_reusable_row->y; | 12356 w->cursor.y -= first_reusable_row->y; |
12322 } | 12357 } |
12323 | 12358 |
12324 /* Scroll the display. */ | 12359 /* Scroll the display. */ |
12325 run.current_y = first_reusable_row->y; | 12360 run.current_y = first_reusable_row->y; |
12326 run.desired_y = WINDOW_DISPLAY_HEADER_LINE_HEIGHT (w); | 12361 run.desired_y = WINDOW_HEADER_LINE_HEIGHT (w); |
12327 run.height = it.last_visible_y - run.current_y; | 12362 run.height = it.last_visible_y - run.current_y; |
12328 dy = run.current_y - run.desired_y; | 12363 dy = run.current_y - run.desired_y; |
12329 | 12364 |
12330 if (run.height) | 12365 if (run.height) |
12331 { | 12366 { |
12338 update_end (f); | 12373 update_end (f); |
12339 } | 12374 } |
12340 | 12375 |
12341 /* Adjust Y positions of reused rows. */ | 12376 /* Adjust Y positions of reused rows. */ |
12342 bottom_row = MATRIX_BOTTOM_TEXT_ROW (w->current_matrix, w); | 12377 bottom_row = MATRIX_BOTTOM_TEXT_ROW (w->current_matrix, w); |
12343 min_y = WINDOW_DISPLAY_HEADER_LINE_HEIGHT (w); | 12378 min_y = WINDOW_HEADER_LINE_HEIGHT (w); |
12344 max_y = it.last_visible_y; | 12379 max_y = it.last_visible_y; |
12345 for (row = first_reusable_row; row < first_row_to_display; ++row) | 12380 for (row = first_reusable_row; row < first_row_to_display; ++row) |
12346 { | 12381 { |
12347 row->y -= dy; | 12382 row->y -= dy; |
12348 row->visible_height = row->height; | 12383 row->visible_height = row->height; |
12590 have, by definition, to be the same as glyph pointers in the | 12625 have, by definition, to be the same as glyph pointers in the |
12591 corresponding frame matrix. Note that frame matrices have no | 12626 corresponding frame matrix. Note that frame matrices have no |
12592 marginal areas (see build_frame_matrix). */ | 12627 marginal areas (see build_frame_matrix). */ |
12593 window_row = w->current_matrix->rows; | 12628 window_row = w->current_matrix->rows; |
12594 window_row_end = window_row + w->current_matrix->nrows; | 12629 window_row_end = window_row + w->current_matrix->nrows; |
12595 frame_row = f->current_matrix->rows + XFASTINT (w->top); | 12630 frame_row = f->current_matrix->rows + WINDOW_TOP_EDGE_LINE (w); |
12596 while (window_row < window_row_end) | 12631 while (window_row < window_row_end) |
12597 { | 12632 { |
12598 struct glyph *start = window_row->glyphs[LEFT_MARGIN_AREA]; | 12633 struct glyph *start = window_row->glyphs[LEFT_MARGIN_AREA]; |
12599 struct glyph *end = window_row->glyphs[LAST_AREA]; | 12634 struct glyph *end = window_row->glyphs[LAST_AREA]; |
12600 | 12635 |
13131 /* Don't let the cursor end in the scroll margins. */ | 13166 /* Don't let the cursor end in the scroll margins. */ |
13132 { | 13167 { |
13133 int this_scroll_margin, cursor_height; | 13168 int this_scroll_margin, cursor_height; |
13134 | 13169 |
13135 this_scroll_margin = max (0, scroll_margin); | 13170 this_scroll_margin = max (0, scroll_margin); |
13136 this_scroll_margin = min (this_scroll_margin, | 13171 this_scroll_margin = min (this_scroll_margin, WINDOW_TOTAL_LINES (w) / 4); |
13137 XFASTINT (w->height) / 4); | 13172 this_scroll_margin *= FRAME_LINE_HEIGHT (it.f); |
13138 this_scroll_margin *= CANON_Y_UNIT (it.f); | |
13139 cursor_height = MATRIX_ROW (w->desired_matrix, w->cursor.vpos)->height; | 13173 cursor_height = MATRIX_ROW (w->desired_matrix, w->cursor.vpos)->height; |
13140 | 13174 |
13141 if ((w->cursor.y < this_scroll_margin | 13175 if ((w->cursor.y < this_scroll_margin |
13142 && CHARPOS (start) > BEGV) | 13176 && CHARPOS (start) > BEGV) |
13143 /* Don't take scroll margin into account at the bottom because | 13177 /* Don't take scroll margin into account at the bottom because |
13168 { | 13202 { |
13169 /* Terminal frame. In this case, dvpos gives the number of | 13203 /* Terminal frame. In this case, dvpos gives the number of |
13170 lines to scroll by; dvpos < 0 means scroll up. */ | 13204 lines to scroll by; dvpos < 0 means scroll up. */ |
13171 int first_unchanged_at_end_vpos | 13205 int first_unchanged_at_end_vpos |
13172 = MATRIX_ROW_VPOS (first_unchanged_at_end_row, w->current_matrix); | 13206 = MATRIX_ROW_VPOS (first_unchanged_at_end_row, w->current_matrix); |
13173 int from = XFASTINT (w->top) + first_unchanged_at_end_vpos; | 13207 int from = WINDOW_TOP_EDGE_LINE (w) + first_unchanged_at_end_vpos; |
13174 int end = (XFASTINT (w->top) | 13208 int end = (WINDOW_TOP_EDGE_LINE (w) |
13175 + (WINDOW_WANTS_HEADER_LINE_P (w) ? 1 : 0) | 13209 + (WINDOW_WANTS_HEADER_LINE_P (w) ? 1 : 0) |
13176 + window_internal_height (w)); | 13210 + window_internal_height (w)); |
13177 | 13211 |
13178 /* Perform the operation on the screen. */ | 13212 /* Perform the operation on the screen. */ |
13179 if (dvpos > 0) | 13213 if (dvpos > 0) |
13859 place the cursor on it. If so, the row's height hasn't been | 13893 place the cursor on it. If so, the row's height hasn't been |
13860 computed yet. */ | 13894 computed yet. */ |
13861 if (row->height == 0) | 13895 if (row->height == 0) |
13862 { | 13896 { |
13863 if (it->max_ascent + it->max_descent == 0) | 13897 if (it->max_ascent + it->max_descent == 0) |
13864 it->max_descent = it->max_phys_descent = CANON_Y_UNIT (it->f); | 13898 it->max_descent = it->max_phys_descent = FRAME_LINE_HEIGHT (it->f); |
13865 row->ascent = it->max_ascent; | 13899 row->ascent = it->max_ascent; |
13866 row->height = it->max_ascent + it->max_descent; | 13900 row->height = it->max_ascent + it->max_descent; |
13867 row->phys_ascent = it->max_phys_ascent; | 13901 row->phys_ascent = it->max_phys_ascent; |
13868 row->phys_height = it->max_phys_ascent + it->max_phys_descent; | 13902 row->phys_height = it->max_phys_ascent + it->max_phys_descent; |
13869 } | 13903 } |
13890 } | 13924 } |
13891 | 13925 |
13892 /* Compute how much of the line is visible. */ | 13926 /* Compute how much of the line is visible. */ |
13893 row->visible_height = row->height; | 13927 row->visible_height = row->height; |
13894 | 13928 |
13895 min_y = WINDOW_DISPLAY_HEADER_LINE_HEIGHT (it->w); | 13929 min_y = WINDOW_HEADER_LINE_HEIGHT (it->w); |
13896 max_y = WINDOW_DISPLAY_HEIGHT_NO_MODE_LINE (it->w); | 13930 max_y = WINDOW_BOX_HEIGHT_NO_MODE_LINE (it->w); |
13897 | 13931 |
13898 if (row->y < min_y) | 13932 if (row->y < min_y) |
13899 row->visible_height -= min_y - row->y; | 13933 row->visible_height -= min_y - row->y; |
13900 if (row->y + row->height > max_y) | 13934 if (row->y + row->height > max_y) |
13901 row->visible_height -= row->y + row->height - max_y; | 13935 row->visible_height -= row->y + row->height - max_y; |
14647 | 14681 |
14648 #ifdef USE_X_TOOLKIT | 14682 #ifdef USE_X_TOOLKIT |
14649 xassert (!FRAME_WINDOW_P (f)); | 14683 xassert (!FRAME_WINDOW_P (f)); |
14650 init_iterator (&it, w, -1, -1, f->desired_matrix->rows, MENU_FACE_ID); | 14684 init_iterator (&it, w, -1, -1, f->desired_matrix->rows, MENU_FACE_ID); |
14651 it.first_visible_x = 0; | 14685 it.first_visible_x = 0; |
14652 it.last_visible_x = FRAME_WINDOW_WIDTH (f) * CANON_X_UNIT (f); | 14686 it.last_visible_x = FRAME_TOTAL_COLS (f) * FRAME_COLUMN_WIDTH (f); |
14653 #else /* not USE_X_TOOLKIT */ | 14687 #else /* not USE_X_TOOLKIT */ |
14654 if (FRAME_WINDOW_P (f)) | 14688 if (FRAME_WINDOW_P (f)) |
14655 { | 14689 { |
14656 /* Menu bar lines are displayed in the desired matrix of the | 14690 /* Menu bar lines are displayed in the desired matrix of the |
14657 dummy window menu_bar_window. */ | 14691 dummy window menu_bar_window. */ |
14659 xassert (WINDOWP (f->menu_bar_window)); | 14693 xassert (WINDOWP (f->menu_bar_window)); |
14660 menu_w = XWINDOW (f->menu_bar_window); | 14694 menu_w = XWINDOW (f->menu_bar_window); |
14661 init_iterator (&it, menu_w, -1, -1, menu_w->desired_matrix->rows, | 14695 init_iterator (&it, menu_w, -1, -1, menu_w->desired_matrix->rows, |
14662 MENU_FACE_ID); | 14696 MENU_FACE_ID); |
14663 it.first_visible_x = 0; | 14697 it.first_visible_x = 0; |
14664 it.last_visible_x = FRAME_WINDOW_WIDTH (f) * CANON_X_UNIT (f); | 14698 it.last_visible_x = FRAME_TOTAL_COLS (f) * FRAME_COLUMN_WIDTH (f); |
14665 } | 14699 } |
14666 else | 14700 else |
14667 { | 14701 { |
14668 /* This is a TTY frame, i.e. character hpos/vpos are used as | 14702 /* This is a TTY frame, i.e. character hpos/vpos are used as |
14669 pixel x/y. */ | 14703 pixel x/y. */ |
14670 init_iterator (&it, w, -1, -1, f->desired_matrix->rows, | 14704 init_iterator (&it, w, -1, -1, f->desired_matrix->rows, |
14671 MENU_FACE_ID); | 14705 MENU_FACE_ID); |
14672 it.first_visible_x = 0; | 14706 it.first_visible_x = 0; |
14673 it.last_visible_x = FRAME_WIDTH (f); | 14707 it.last_visible_x = FRAME_COLS (f); |
14674 } | 14708 } |
14675 #endif /* not USE_X_TOOLKIT */ | 14709 #endif /* not USE_X_TOOLKIT */ |
14676 | 14710 |
14677 if (! mode_line_inverse_video) | 14711 if (! mode_line_inverse_video) |
14678 /* Force the menu-bar to be displayed in the default face. */ | 14712 /* Force the menu-bar to be displayed in the default face. */ |
15740 { | 15774 { |
15741 int startpos = XMARKER (w->start)->charpos; | 15775 int startpos = XMARKER (w->start)->charpos; |
15742 int startpos_byte = marker_byte_position (w->start); | 15776 int startpos_byte = marker_byte_position (w->start); |
15743 int line, linepos, linepos_byte, topline; | 15777 int line, linepos, linepos_byte, topline; |
15744 int nlines, junk; | 15778 int nlines, junk; |
15745 int height = XFASTINT (w->height); | 15779 int height = WINDOW_TOTAL_LINES (w); |
15746 | 15780 |
15747 /* If we decided that this buffer isn't suitable for line numbers, | 15781 /* If we decided that this buffer isn't suitable for line numbers, |
15748 don't forget that too fast. */ | 15782 don't forget that too fast. */ |
15749 if (EQ (w->base_line_pos, w->buffer)) | 15783 if (EQ (w->base_line_pos, w->buffer)) |
15750 goto no_value; | 15784 goto no_value; |
17266 end of the drawing area. */ | 17300 end of the drawing area. */ |
17267 if (row->full_width_p) | 17301 if (row->full_width_p) |
17268 { | 17302 { |
17269 /* X is relative to the left edge of W, without scroll bars | 17303 /* X is relative to the left edge of W, without scroll bars |
17270 or fringes. */ | 17304 or fringes. */ |
17271 int window_left_x = WINDOW_LEFT_MARGIN (w) * CANON_X_UNIT (f); | 17305 x += WINDOW_LEFT_EDGE_X (w); |
17272 | 17306 last_x = WINDOW_LEFT_EDGE_X (w) + WINDOW_TOTAL_WIDTH (w); |
17273 x += window_left_x; | |
17274 area_width = XFASTINT (w->width) * CANON_X_UNIT (f); | |
17275 last_x = window_left_x + area_width; | |
17276 | |
17277 if (FRAME_HAS_VERTICAL_SCROLL_BARS (f)) | |
17278 { | |
17279 int width = FRAME_SCROLL_BAR_WIDTH (f) * CANON_X_UNIT (f); | |
17280 if (FRAME_HAS_VERTICAL_SCROLL_BARS_ON_RIGHT (f)) | |
17281 last_x += width; | |
17282 else | |
17283 x -= width; | |
17284 } | |
17285 | |
17286 x += FRAME_INTERNAL_BORDER_WIDTH (f); | |
17287 /* ++KFS: W32 and MAC versions had -= in next line (bug??) */ | |
17288 last_x += FRAME_INTERNAL_BORDER_WIDTH (f); | |
17289 } | 17307 } |
17290 else | 17308 else |
17291 { | 17309 { |
17292 x = WINDOW_AREA_TO_FRAME_PIXEL_X (w, area, x); | 17310 int area_left = window_box_left (w, area); |
17311 x += area_left; | |
17293 area_width = window_box_width (w, area); | 17312 area_width = window_box_width (w, area); |
17294 last_x = WINDOW_AREA_TO_FRAME_PIXEL_X (w, area, area_width); | 17313 last_x = area_left + area_width; |
17295 } | 17314 } |
17296 | 17315 |
17297 /* Build a doubly-linked list of glyph_string structures between | 17316 /* Build a doubly-linked list of glyph_string structures between |
17298 head and tail from what we have to draw. Note that the macro | 17317 head and tail from what we have to draw. Note that the macro |
17299 BUILD_GLYPH_STRINGS will modify its start parameter. That's | 17318 BUILD_GLYPH_STRINGS will modify its start parameter. That's |
17394 && !overlaps_p) | 17413 && !overlaps_p) |
17395 { | 17414 { |
17396 int x0 = head ? head->x : x; | 17415 int x0 = head ? head->x : x; |
17397 int x1 = tail ? tail->x + tail->background_width : x; | 17416 int x1 = tail ? tail->x + tail->background_width : x; |
17398 | 17417 |
17399 x0 = FRAME_TO_WINDOW_PIXEL_X (w, x0); | 17418 int text_left = window_box_left (w, TEXT_AREA); |
17400 x1 = FRAME_TO_WINDOW_PIXEL_X (w, x1); | 17419 x0 -= text_left; |
17401 | 17420 x1 -= text_left; |
17402 /* ++KFS: W32 and MAC versions had following test here: | 17421 |
17403 if (!row->full_width_p && XFASTINT (w->left_margin_width) != 0) | 17422 notice_overwritten_cursor (w, TEXT_AREA, x0, x1, |
17404 */ | |
17405 | |
17406 if (XFASTINT (w->left_margin_width) != 0) | |
17407 { | |
17408 int left_area_width = window_box_width (w, LEFT_MARGIN_AREA); | |
17409 x0 -= left_area_width; | |
17410 x1 -= left_area_width; | |
17411 } | |
17412 | |
17413 notice_overwritten_cursor (w, area, x0, x1, | |
17414 row->y, MATRIX_ROW_BOTTOM_Y (row)); | 17423 row->y, MATRIX_ROW_BOTTOM_Y (row)); |
17415 } | 17424 } |
17416 | 17425 |
17417 /* Value is the x-position up to which drawn, relative to AREA of W. | 17426 /* Value is the x-position up to which drawn, relative to AREA of W. |
17418 This doesn't include parts drawn because of overhangs. */ | 17427 This doesn't include parts drawn because of overhangs. */ |
17419 x_reached = FRAME_TO_WINDOW_PIXEL_X (w, x_reached); | 17428 if (row->full_width_p) |
17420 if (!row->full_width_p) | 17429 x_reached = FRAME_TO_WINDOW_PIXEL_X (w, x_reached); |
17421 { | 17430 else |
17422 /* ++KFS: W32 and MAC versions only had this test here: | 17431 x_reached -= window_box_left (w, area); |
17423 if (area > LEFT_MARGIN_AREA) | |
17424 */ | |
17425 | |
17426 if (area > LEFT_MARGIN_AREA && XFASTINT (w->left_margin_width) != 0) | |
17427 x_reached -= window_box_width (w, LEFT_MARGIN_AREA); | |
17428 if (area > TEXT_AREA) | |
17429 x_reached -= window_box_width (w, TEXT_AREA); | |
17430 } | |
17431 | 17432 |
17432 RELEASE_HDC (hdc, f); | 17433 RELEASE_HDC (hdc, f); |
17433 | 17434 |
17434 return x_reached; | 17435 return x_reached; |
17435 } | 17436 } |
17693 | 17694 |
17694 /* Compute the width of the stretch. */ | 17695 /* Compute the width of the stretch. */ |
17695 if (prop = Fplist_get (plist, QCwidth), | 17696 if (prop = Fplist_get (plist, QCwidth), |
17696 NUMVAL (prop) > 0) | 17697 NUMVAL (prop) > 0) |
17697 /* Absolute width `:width WIDTH' specified and valid. */ | 17698 /* Absolute width `:width WIDTH' specified and valid. */ |
17698 width = NUMVAL (prop) * CANON_X_UNIT (it->f); | 17699 width = NUMVAL (prop) * FRAME_COLUMN_WIDTH (it->f); |
17699 else if (prop = Fplist_get (plist, QCrelative_width), | 17700 else if (prop = Fplist_get (plist, QCrelative_width), |
17700 NUMVAL (prop) > 0) | 17701 NUMVAL (prop) > 0) |
17701 { | 17702 { |
17702 /* Relative width `:relative-width FACTOR' specified and valid. | 17703 /* Relative width `:relative-width FACTOR' specified and valid. |
17703 Compute the width of the characters having the `glyph' | 17704 Compute the width of the characters having the `glyph' |
17720 x_produce_glyphs (&it2); | 17721 x_produce_glyphs (&it2); |
17721 width = NUMVAL (prop) * it2.pixel_width; | 17722 width = NUMVAL (prop) * it2.pixel_width; |
17722 } | 17723 } |
17723 else if (prop = Fplist_get (plist, QCalign_to), | 17724 else if (prop = Fplist_get (plist, QCalign_to), |
17724 NUMVAL (prop) > 0) | 17725 NUMVAL (prop) > 0) |
17725 width = NUMVAL (prop) * CANON_X_UNIT (it->f) - it->current_x; | 17726 width = NUMVAL (prop) * FRAME_COLUMN_WIDTH (it->f) - it->current_x; |
17726 else | 17727 else |
17727 /* Nothing specified -> width defaults to canonical char width. */ | 17728 /* Nothing specified -> width defaults to canonical char width. */ |
17728 width = CANON_X_UNIT (it->f); | 17729 width = FRAME_COLUMN_WIDTH (it->f); |
17729 | 17730 |
17730 /* Compute height. */ | 17731 /* Compute height. */ |
17731 if (prop = Fplist_get (plist, QCheight), | 17732 if (prop = Fplist_get (plist, QCheight), |
17732 NUMVAL (prop) > 0) | 17733 NUMVAL (prop) > 0) |
17733 height = NUMVAL (prop) * CANON_Y_UNIT (it->f); | 17734 height = NUMVAL (prop) * FRAME_LINE_HEIGHT (it->f); |
17734 else if (prop = Fplist_get (plist, QCrelative_height), | 17735 else if (prop = Fplist_get (plist, QCrelative_height), |
17735 NUMVAL (prop) > 0) | 17736 NUMVAL (prop) > 0) |
17736 height = FONT_HEIGHT (font) * NUMVAL (prop); | 17737 height = FONT_HEIGHT (font) * NUMVAL (prop); |
17737 else | 17738 else |
17738 height = FONT_HEIGHT (font); | 17739 height = FONT_HEIGHT (font); |
17955 it->descent += face->box_line_width; | 17956 it->descent += face->box_line_width; |
17956 } | 17957 } |
17957 } | 17958 } |
17958 else if (it->char_to_display == '\t') | 17959 else if (it->char_to_display == '\t') |
17959 { | 17960 { |
17960 int tab_width = it->tab_width * CANON_X_UNIT (it->f); | 17961 int tab_width = it->tab_width * FRAME_COLUMN_WIDTH (it->f); |
17961 int x = it->current_x + it->continuation_lines_width; | 17962 int x = it->current_x + it->continuation_lines_width; |
17962 int next_tab_x = ((1 + x + tab_width - 1) / tab_width) * tab_width; | 17963 int next_tab_x = ((1 + x + tab_width - 1) / tab_width) * tab_width; |
17963 | 17964 |
17964 /* If the distance from the current position to the next tab | 17965 /* If the distance from the current position to the next tab |
17965 stop is less than a canonical character width, use the | 17966 stop is less than a canonical character width, use the |
17966 tab stop after that. */ | 17967 tab stop after that. */ |
17967 if (next_tab_x - x < CANON_X_UNIT (it->f)) | 17968 if (next_tab_x - x < FRAME_COLUMN_WIDTH (it->f)) |
17968 next_tab_x += tab_width; | 17969 next_tab_x += tab_width; |
17969 | 17970 |
17970 it->pixel_width = next_tab_x - x; | 17971 it->pixel_width = next_tab_x - x; |
17971 it->nglyphs = 1; | 17972 it->nglyphs = 1; |
17972 it->ascent = it->phys_ascent = FONT_BASE (font) + boff; | 17973 it->ascent = it->phys_ascent = FONT_BASE (font) + boff; |
17997 if (font_not_found_p || !pcm) | 17998 if (font_not_found_p || !pcm) |
17998 { | 17999 { |
17999 int charset = CHAR_CHARSET (it->char_to_display); | 18000 int charset = CHAR_CHARSET (it->char_to_display); |
18000 | 18001 |
18001 it->glyph_not_available_p = 1; | 18002 it->glyph_not_available_p = 1; |
18002 it->pixel_width = (FONT_WIDTH (FRAME_FONT (it->f)) | 18003 it->pixel_width = (FRAME_COLUMN_WIDTH (it->f) |
18003 * CHARSET_WIDTH (charset)); | 18004 * CHARSET_WIDTH (charset)); |
18004 it->phys_ascent = FONT_BASE (font) + boff; | 18005 it->phys_ascent = FONT_BASE (font) + boff; |
18005 it->phys_descent = FONT_DESCENT (font) - boff; | 18006 it->phys_descent = FONT_DESCENT (font) - boff; |
18006 } | 18007 } |
18007 else | 18008 else |
18453 | 18454 |
18454 xassert (updated_window && updated_row); | 18455 xassert (updated_window && updated_row); |
18455 f = XFRAME (w->frame); | 18456 f = XFRAME (w->frame); |
18456 | 18457 |
18457 if (updated_row->full_width_p) | 18458 if (updated_row->full_width_p) |
18458 { | 18459 max_x = WINDOW_TOTAL_WIDTH (w); |
18459 max_x = XFASTINT (w->width) * CANON_X_UNIT (f); | |
18460 if (FRAME_HAS_VERTICAL_SCROLL_BARS (f) | |
18461 && !w->pseudo_window_p) | |
18462 max_x += FRAME_SCROLL_BAR_WIDTH (f) * CANON_X_UNIT (f); | |
18463 } | |
18464 else | 18460 else |
18465 max_x = window_box_width (w, updated_area); | 18461 max_x = window_box_width (w, updated_area); |
18466 max_y = window_text_bottom_y (w); | 18462 max_y = window_text_bottom_y (w); |
18467 | 18463 |
18468 /* TO_X == 0 means don't do anything. TO_X < 0 means clear to end | 18464 /* TO_X == 0 means don't do anything. TO_X < 0 means clear to end |
18491 from_x = WINDOW_TO_FRAME_PIXEL_X (w, from_x); | 18487 from_x = WINDOW_TO_FRAME_PIXEL_X (w, from_x); |
18492 to_x = WINDOW_TO_FRAME_PIXEL_X (w, to_x); | 18488 to_x = WINDOW_TO_FRAME_PIXEL_X (w, to_x); |
18493 } | 18489 } |
18494 else | 18490 else |
18495 { | 18491 { |
18496 from_x = WINDOW_AREA_TO_FRAME_PIXEL_X (w, updated_area, from_x); | 18492 int area_left = window_box_left (w, updated_area); |
18497 to_x = WINDOW_AREA_TO_FRAME_PIXEL_X (w, updated_area, to_x); | 18493 from_x += area_left; |
18498 } | 18494 to_x += area_left; |
18499 | 18495 } |
18500 min_y = WINDOW_DISPLAY_HEADER_LINE_HEIGHT (w); | 18496 |
18497 min_y = WINDOW_HEADER_LINE_HEIGHT (w); | |
18501 from_y = WINDOW_TO_FRAME_PIXEL_Y (w, max (min_y, output_cursor.y)); | 18498 from_y = WINDOW_TO_FRAME_PIXEL_Y (w, max (min_y, output_cursor.y)); |
18502 to_y = WINDOW_TO_FRAME_PIXEL_Y (w, to_y); | 18499 to_y = WINDOW_TO_FRAME_PIXEL_Y (w, to_y); |
18503 | 18500 |
18504 /* Prevent inadvertently clearing to end of the X window. */ | 18501 /* Prevent inadvertently clearing to end of the X window. */ |
18505 if (to_x > from_x && to_y > from_y) | 18502 if (to_x > from_x && to_y > from_y) |
18781 { | 18778 { |
18782 int i, x; | 18779 int i, x; |
18783 | 18780 |
18784 BLOCK_INPUT; | 18781 BLOCK_INPUT; |
18785 | 18782 |
18786 if (area == LEFT_MARGIN_AREA) | 18783 x = window_box_left_offset (w, area); |
18787 x = 0; | 18784 if (area == TEXT_AREA) |
18788 else if (area == TEXT_AREA) | 18785 x += row->x; |
18789 x = row->x + window_box_width (w, LEFT_MARGIN_AREA); | |
18790 else | |
18791 x = (window_box_width (w, LEFT_MARGIN_AREA) | |
18792 + window_box_width (w, TEXT_AREA)); | |
18793 | 18786 |
18794 for (i = 0; i < row->used[area];) | 18787 for (i = 0; i < row->used[area];) |
18795 { | 18788 { |
18796 if (row->glyphs[area][i].overlaps_vertically_p) | 18789 if (row->glyphs[area][i].overlaps_vertically_p) |
18797 { | 18790 { |
18926 | 18919 |
18927 /* Maybe clear the display under the cursor. */ | 18920 /* Maybe clear the display under the cursor. */ |
18928 if (w->phys_cursor_type == HOLLOW_BOX_CURSOR) | 18921 if (w->phys_cursor_type == HOLLOW_BOX_CURSOR) |
18929 { | 18922 { |
18930 int x, y; | 18923 int x, y; |
18931 int header_line_height = WINDOW_DISPLAY_HEADER_LINE_HEIGHT (w); | 18924 int header_line_height = WINDOW_HEADER_LINE_HEIGHT (w); |
18932 | 18925 |
18933 cursor_glyph = get_phys_cursor_glyph (w); | 18926 cursor_glyph = get_phys_cursor_glyph (w); |
18934 if (cursor_glyph == NULL) | 18927 if (cursor_glyph == NULL) |
18935 goto mark_cursor_off; | 18928 goto mark_cursor_off; |
18936 | 18929 |
19592 dpyinfo->mouse_face_deferred_gc = 1; | 19585 dpyinfo->mouse_face_deferred_gc = 1; |
19593 return; | 19586 return; |
19594 } | 19587 } |
19595 | 19588 |
19596 /* Which window is that in? */ | 19589 /* Which window is that in? */ |
19597 window = window_from_coordinates (f, x, y, &part, 1); | 19590 window = window_from_coordinates (f, x, y, &part, 0, 0, 1); |
19598 | 19591 |
19599 /* If we were displaying active text in another window, clear that. */ | 19592 /* If we were displaying active text in another window, clear that. */ |
19600 if (! EQ (window, dpyinfo->mouse_face_window)) | 19593 if (! EQ (window, dpyinfo->mouse_face_window)) |
19601 clear_mouse_face (dpyinfo); | 19594 clear_mouse_face (dpyinfo); |
19602 | 19595 |
20076 else | 20069 else |
20077 { | 20070 { |
20078 /* Set START_X to the window-relative start position for drawing glyphs of | 20071 /* Set START_X to the window-relative start position for drawing glyphs of |
20079 AREA. The first glyph of the text area can be partially visible. | 20072 AREA. The first glyph of the text area can be partially visible. |
20080 The first glyphs of other areas cannot. */ | 20073 The first glyphs of other areas cannot. */ |
20081 if (area == LEFT_MARGIN_AREA) | 20074 start_x = window_box_left_offset (w, area); |
20082 start_x = 0; | 20075 if (area == TEXT_AREA) |
20083 else if (area == TEXT_AREA) | 20076 start_x += row->x; |
20084 start_x = row->x + window_box_width (w, LEFT_MARGIN_AREA); | |
20085 else | |
20086 start_x = (window_box_width (w, LEFT_MARGIN_AREA) | |
20087 + window_box_width (w, TEXT_AREA)); | |
20088 x = start_x; | 20077 x = start_x; |
20089 | 20078 |
20090 /* Find the first glyph that must be redrawn. */ | 20079 /* Find the first glyph that must be redrawn. */ |
20091 while (first < end | 20080 while (first < end |
20092 && x + first->pixel_width < r->x) | 20081 && x + first->pixel_width < r->x) |
20212 x_draw_vertical_border (w) | 20201 x_draw_vertical_border (w) |
20213 struct window *w; | 20202 struct window *w; |
20214 { | 20203 { |
20215 struct frame *f = XFRAME (WINDOW_FRAME (w)); | 20204 struct frame *f = XFRAME (WINDOW_FRAME (w)); |
20216 | 20205 |
20206 /* We could do better, if we knew what type of scroll-bar the adjacent | |
20207 windows (on either side) have... But we don't :-( | |
20208 However, I think this works ok. ++KFS 2003-04-25 */ | |
20209 | |
20217 /* Redraw borders between horizontally adjacent windows. Don't | 20210 /* Redraw borders between horizontally adjacent windows. Don't |
20218 do it for frames with vertical scroll bars because either the | 20211 do it for frames with vertical scroll bars because either the |
20219 right scroll bar of a window, or the left scroll bar of its | 20212 right scroll bar of a window, or the left scroll bar of its |
20220 neighbor will suffice as a border. */ | 20213 neighbor will suffice as a border. */ |
20221 if (!WINDOW_RIGHTMOST_P (w) | 20214 if (!WINDOW_RIGHTMOST_P (w) |
20222 && !FRAME_HAS_VERTICAL_SCROLL_BARS (f)) | 20215 && !WINDOW_HAS_VERTICAL_SCROLL_BAR_ON_RIGHT (w)) |
20223 { | 20216 { |
20224 int x0, x1, y0, y1; | 20217 int x0, x1, y0, y1; |
20225 | 20218 |
20226 window_box_edges (w, -1, &x0, &y0, &x1, &y1); | 20219 window_box_edges (w, -1, &x0, &y0, &x1, &y1); |
20227 x1 += FRAME_X_RIGHT_FRINGE_WIDTH (f); | |
20228 y1 -= 1; | 20220 y1 -= 1; |
20229 | 20221 |
20230 rif->draw_vertical_window_border (w, x1, y0, y1); | 20222 rif->draw_vertical_window_border (w, x1, y0, y1); |
20223 } | |
20224 else if (!WINDOW_LEFTMOST_P (w) | |
20225 && !WINDOW_HAS_VERTICAL_SCROLL_BAR_ON_LEFT (w)) | |
20226 { | |
20227 int x0, x1, y0, y1; | |
20228 | |
20229 window_box_edges (w, -1, &x0, &y0, &x1, &y1); | |
20230 y1 -= 1; | |
20231 | |
20232 rif->draw_vertical_window_border (w, x0, y0, y1); | |
20231 } | 20233 } |
20232 } | 20234 } |
20233 | 20235 |
20234 | 20236 |
20235 /* Redraw the part of window W intersection rectangle FR. Pixel | 20237 /* Redraw the part of window W intersection rectangle FR. Pixel |
20261 SET_FRAME_GARBAGED (f); | 20263 SET_FRAME_GARBAGED (f); |
20262 return 0; | 20264 return 0; |
20263 } | 20265 } |
20264 | 20266 |
20265 /* Frame-relative pixel rectangle of W. */ | 20267 /* Frame-relative pixel rectangle of W. */ |
20266 wr.x = XFASTINT (w->left) * CANON_X_UNIT (f); | 20268 wr.x = WINDOW_LEFT_EDGE_X (w); |
20267 wr.y = XFASTINT (w->top) * CANON_Y_UNIT (f); | 20269 wr.y = WINDOW_TOP_EDGE_Y (w); |
20268 wr.width = XFASTINT (w->width) * CANON_X_UNIT (f); | 20270 wr.width = WINDOW_TOTAL_WIDTH (w); |
20269 wr.height = XFASTINT (w->height) * CANON_Y_UNIT (f); | 20271 wr.height = WINDOW_TOTAL_HEIGHT (w); |
20270 | 20272 |
20271 if (x_intersect_rectangles (fr, &wr, &r)) | 20273 if (x_intersect_rectangles (fr, &wr, &r)) |
20272 { | 20274 { |
20273 int yb = window_text_bottom_y (w); | 20275 int yb = window_text_bottom_y (w); |
20274 struct glyph_row *row; | 20276 struct glyph_row *row; |
20439 } | 20441 } |
20440 | 20442 |
20441 if (w == 0 || h == 0) | 20443 if (w == 0 || h == 0) |
20442 { | 20444 { |
20443 r.x = r.y = 0; | 20445 r.x = r.y = 0; |
20444 r.width = CANON_X_UNIT (f) * f->width; | 20446 r.width = FRAME_COLUMN_WIDTH (f) * FRAME_COLS (f); |
20445 r.height = CANON_Y_UNIT (f) * f->height; | 20447 r.height = FRAME_LINE_HEIGHT (f) * FRAME_LINES (f); |
20446 } | 20448 } |
20447 else | 20449 else |
20448 { | 20450 { |
20449 r.x = x; | 20451 r.x = x; |
20450 r.y = y; | 20452 r.y = y; |
21005 if (!noninteractive) | 21007 if (!noninteractive) |
21006 { | 21008 { |
21007 struct frame *f = XFRAME (WINDOW_FRAME (XWINDOW (root_window))); | 21009 struct frame *f = XFRAME (WINDOW_FRAME (XWINDOW (root_window))); |
21008 int i; | 21010 int i; |
21009 | 21011 |
21010 XWINDOW (root_window)->top = make_number (FRAME_TOP_MARGIN (f)); | 21012 XWINDOW (root_window)->top_line = make_number (FRAME_TOP_MARGIN (f)); |
21011 set_window_height (root_window, | 21013 set_window_height (root_window, |
21012 FRAME_HEIGHT (f) - 1 - FRAME_TOP_MARGIN (f), | 21014 FRAME_LINES (f) - 1 - FRAME_TOP_MARGIN (f), |
21013 0); | 21015 0); |
21014 mini_w->top = make_number (FRAME_HEIGHT (f) - 1); | 21016 mini_w->top_line = make_number (FRAME_LINES (f) - 1); |
21015 set_window_height (minibuf_window, 1, 0); | 21017 set_window_height (minibuf_window, 1, 0); |
21016 | 21018 |
21017 XWINDOW (root_window)->width = make_number (FRAME_WIDTH (f)); | 21019 XWINDOW (root_window)->total_cols = make_number (FRAME_COLS (f)); |
21018 mini_w->width = make_number (FRAME_WIDTH (f)); | 21020 mini_w->total_cols = make_number (FRAME_COLS (f)); |
21019 | 21021 |
21020 scratch_glyph_row.glyphs[TEXT_AREA] = scratch_glyphs; | 21022 scratch_glyph_row.glyphs[TEXT_AREA] = scratch_glyphs; |
21021 scratch_glyph_row.glyphs[TEXT_AREA + 1] | 21023 scratch_glyph_row.glyphs[TEXT_AREA + 1] |
21022 = scratch_glyphs + MAX_SCRATCH_GLYPHS; | 21024 = scratch_glyphs + MAX_SCRATCH_GLYPHS; |
21023 | 21025 |