aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKim F. Storm2003-05-24 22:08:54 +0000
committerKim F. Storm2003-05-24 22:08:54 +0000
commitda8b7f4fcb226267c7d8c38e57512471caa82abe (patch)
tree8a66ff8012f9277b90fc269d9fd70b09ba195645 /src
parent6000501bd85da2e2a376969f3cb619f07977d702 (diff)
downloademacs-da8b7f4fcb226267c7d8c38e57512471caa82abe.tar.gz
emacs-da8b7f4fcb226267c7d8c38e57512471caa82abe.zip
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.
Diffstat (limited to 'src')
-rw-r--r--src/xdisp.c588
1 files changed, 295 insertions, 293 deletions
diff --git a/src/xdisp.c b/src/xdisp.c
index a7009f8aac2..9abfbd4e1aa 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -424,8 +424,8 @@ 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
430EMACS_INT scroll_margin; 430EMACS_INT scroll_margin;
431 431
@@ -913,14 +913,13 @@ 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 922
923
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. */
@@ -930,29 +929,36 @@ 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)
956 ? XFASTINT (w->right_margin_cols) : 0);
957 pixels = 0;
958 }
953 } 959 }
954 960
955 return width * CANON_X_UNIT (f); 961 return cols * WINDOW_FRAME_COLUMN_WIDTH (w) + pixels;
956} 962}
957 963
958 964
@@ -964,7 +970,7 @@ 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
@@ -1003,6 +1009,51 @@ window_box_height (w)
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
1016INLINE int
1017window_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
1050INLINE int
1051window_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
@@ -1014,19 +1065,13 @@ window_box_left (w, area)
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)
1022 + FRAME_LEFT_FRINGE_WIDTH (f));
1023 1072
1024 if (area == TEXT_AREA) 1073 x = (WINDOW_LEFT_EDGE_X (w)
1025 x += window_box_width (w, LEFT_MARGIN_AREA); 1074 + window_box_left_offset (w, 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}
@@ -1044,7 +1089,6 @@ window_box_right (w, area)
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 1091
1047
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
@@ -1058,15 +1102,18 @@ window_box (w, area, box_x, box_y, box_width, box_height)
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
@@ -1184,7 +1231,7 @@ pos_visible_p (w, charpos, fully, exact_mode_line_heights_p)
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;
@@ -1421,34 +1468,34 @@ pixel_to_glyph_coords (f, pix_x, pix_y, x, y, bounds, noclip)
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
@@ -1530,7 +1577,7 @@ x_y_to_hpos_vpos (w, x, y, hpos, vpos, area, 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)
@@ -1557,21 +1604,20 @@ x_y_to_hpos_vpos (w, x, y, hpos, vpos, area, buffer_only_p)
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
@@ -1614,12 +1660,12 @@ frame_to_window_pixel_xy (w, x, y)
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}
@@ -1636,20 +1682,9 @@ get_glyph_string_clip_rect (s, nr)
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. */
@@ -1661,7 +1696,7 @@ get_glyph_string_clip_rect (s, nr)
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 }
@@ -1671,7 +1706,7 @@ get_glyph_string_clip_rect (s, nr)
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
@@ -1681,7 +1716,7 @@ get_glyph_string_clip_rect (s, nr)
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
@@ -2087,12 +2122,12 @@ init_iterator (it, w, charpos, bytepos, row, base_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
@@ -2109,7 +2144,7 @@ init_iterator (it, w, charpos, bytepos, row, base_face_id)
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. */
@@ -5796,7 +5831,7 @@ move_it_vertically_backward (it, dy)
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)
@@ -7107,9 +7142,9 @@ resize_mini_window (w, exact_p)
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
@@ -7123,7 +7158,7 @@ resize_mini_window (w, exact_p)
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
@@ -7164,45 +7199,45 @@ resize_mini_window (w, exact_p)
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
@@ -8105,7 +8140,7 @@ update_tool_bar (f, save_match_data)
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)
@@ -8438,7 +8473,7 @@ tool_bar_lines_needed (f)
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))
@@ -8448,7 +8483,7 @@ tool_bar_lines_needed (f)
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
@@ -8470,7 +8505,7 @@ DEFUN ("tool-bar-lines-needed", Ftool_bar_lines_needed, Stool_bar_lines_needed,
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)
@@ -8508,13 +8543,13 @@ redisplay_tool_bar (f)
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. */
@@ -8541,10 +8576,10 @@ redisplay_tool_bar (f)
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,
@@ -8557,11 +8592,11 @@ redisplay_tool_bar (f)
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);
@@ -8569,7 +8604,7 @@ redisplay_tool_bar (f)
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 }
@@ -8782,7 +8817,7 @@ note_tool_bar_highlight (f, x, y)
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;
@@ -8909,41 +8944,46 @@ draw_fringe_bitmap (w, row, which, left_p)
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;
@@ -8973,7 +9013,7 @@ draw_row_fringe_bitmaps (w, row)
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)
@@ -8990,14 +9030,14 @@ draw_row_fringe_bitmaps (w, row)
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;
@@ -9014,9 +9054,9 @@ 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);
@@ -9037,7 +9077,7 @@ compute_fringe_widths (f, redraw)
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)
@@ -9045,14 +9085,14 @@ compute_fringe_widths (f, redraw)
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 {
@@ -9060,35 +9100,33 @@ compute_fringe_widths (f, redraw)
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
@@ -9146,8 +9184,8 @@ hscroll_window_tree (window)
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
@@ -9157,11 +9195,10 @@ hscroll_window_tree (window)
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)
@@ -9198,7 +9235,7 @@ hscroll_window_tree (window)
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)
@@ -9206,10 +9243,10 @@ hscroll_window_tree (window)
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 {
@@ -9217,10 +9254,10 @@ hscroll_window_tree (window)
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
@@ -9869,7 +9906,7 @@ redisplay_internal (preserve_echo_area)
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 {
@@ -10273,7 +10310,7 @@ mark_window_display_accurate_1 (w, accurate_p)
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;
@@ -10736,8 +10773,8 @@ try_scrolling (window, just_this_one_p, scroll_conservatively,
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;
@@ -10755,7 +10792,7 @@ try_scrolling (window, just_this_one_p, scroll_conservatively,
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
@@ -10806,15 +10843,14 @@ try_scrolling (window, just_this_one_p, 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 }
@@ -10866,14 +10902,13 @@ try_scrolling (window, just_this_one_p, scroll_conservatively,
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 }
@@ -10963,7 +10998,7 @@ compute_window_start_on_continuation_line (w)
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
@@ -11081,8 +11116,8 @@ try_cursor_movement (window, startp, scroll_step)
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. */
@@ -11942,7 +11977,7 @@ redisplay_window (window, just_this_one_p)
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);
@@ -12177,7 +12212,7 @@ try_window_reusing_current_matrix (w)
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;
@@ -12292,7 +12327,7 @@ try_window_reusing_current_matrix (w)
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
@@ -12323,7 +12358,7 @@ try_window_reusing_current_matrix (w)
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
@@ -12340,7 +12375,7 @@ try_window_reusing_current_matrix (w)
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 {
@@ -12592,7 +12627,7 @@ sync_frame_with_window_matrix_rows (w)
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];
@@ -13133,9 +13168,8 @@ try_window_id (w)
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
@@ -13170,8 +13204,8 @@ try_window_id (w)
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
@@ -13861,7 +13895,7 @@ compute_line_metrics (it)
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;
@@ -13892,8 +13926,8 @@ compute_line_metrics (it)
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;
@@ -14649,7 +14683,7 @@ display_menu_bar (w)
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 {
@@ -14661,7 +14695,7 @@ display_menu_bar (w)
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 {
@@ -14670,7 +14704,7 @@ display_menu_bar (w)
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
@@ -15742,7 +15776,7 @@ decode_mode_spec (w, c, field_width, precision, multibyte)
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. */
@@ -17268,30 +17302,15 @@ draw_glyphs (w, x, row, area, start, end, hl, overlaps_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
@@ -17396,38 +17415,20 @@ draw_glyphs (w, x, row, area, start, end, hl, overlaps_p)
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:
17403 if (!row->full_width_p && XFASTINT (w->left_margin_width) != 0)
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 17421
17413 notice_overwritten_cursor (w, area, x0, x1, 17422 notice_overwritten_cursor (w, TEXT_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
@@ -17695,7 +17696,7 @@ produce_stretch_glyph (it)
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 {
@@ -17722,15 +17723,15 @@ produce_stretch_glyph (it)
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);
@@ -17957,14 +17958,14 @@ x_produce_glyphs (it)
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;
@@ -17999,7 +18000,7 @@ x_produce_glyphs (it)
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;
@@ -18455,12 +18456,7 @@ x_clear_end_of_line (to_x)
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);
@@ -18493,11 +18489,12 @@ x_clear_end_of_line (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;
18494 to_x += area_left;
18498 } 18495 }
18499 18496
18500 min_y = WINDOW_DISPLAY_HEADER_LINE_HEIGHT (w); 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
@@ -18783,13 +18780,9 @@ x_fix_overlapping_area (w, row, area)
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 {
@@ -18928,7 +18921,7 @@ erase_phys_cursor (w)
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)
@@ -19594,7 +19587,7 @@ note_mouse_highlight (f, x, y)
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))
@@ -20078,13 +20071,9 @@ expose_area (w, row, r, area)
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. */
@@ -20214,21 +20203,34 @@ x_draw_vertical_border (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);
20231 } 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);
20233 }
20232} 20234}
20233 20235
20234 20236
@@ -20263,10 +20265,10 @@ expose_window (w, fr)
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 {
@@ -20441,8 +20443,8 @@ expose_frame (f, x, y, w, h)
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 {
@@ -21007,15 +21009,15 @@ init_xdisp ()
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]