/[emacs]/emacs/src/xdisp.c
ViewVC logotype

Diff of /emacs/src/xdisp.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.830 by monnier, Fri May 23 23:32:55 2003 UTC revision 1.831 by kfstorm, Sat May 24 22:08:54 2003 UTC
# Line 424  static EMACS_INT scroll_conservatively; Line 424  static EMACS_INT scroll_conservatively;
424    
425  /* Recenter the window whenever point gets within this many lines of  /* 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     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     pixel value by multiplying it with FRAME_LINE_HEIGHT, which means
428     there is really a fixed pixel height scroll margin.  */     that there is really a fixed pixel height scroll margin.  */
429    
430  EMACS_INT scroll_margin;  EMACS_INT scroll_margin;
431    
# Line 913  window_text_bottom_y (w) Line 913  window_text_bottom_y (w)
913       struct window *w;       struct window *w;
914  {  {
915    struct frame *f = XFRAME (w->frame);    struct frame *f = XFRAME (w->frame);
916    int height = XFASTINT (w->height) * CANON_Y_UNIT (f);    int height = WINDOW_TOTAL_HEIGHT (w);
917    
918    if (WINDOW_WANTS_MODELINE_P (w))    if (WINDOW_WANTS_MODELINE_P (w))
919      height -= CURRENT_MODE_LINE_HEIGHT (w);      height -= CURRENT_MODE_LINE_HEIGHT (w);
920    return height;    return height;
921  }  }
922    
   
923  /* Return the pixel width of display area AREA of window W.  AREA < 0  /* Return the pixel width of display area AREA of window W.  AREA < 0
924     means return the total width of W, not including fringes to     means return the total width of W, not including fringes to
925     the left and right of the window.  */     the left and right of the window.  */
# Line 930  window_box_width (w, area) Line 929  window_box_width (w, area)
929       struct window *w;       struct window *w;
930       int area;       int area;
931  {  {
932    struct frame *f = XFRAME (w->frame);    int cols = XFASTINT (w->total_cols);
933    int width = XFASTINT (w->width);    int pixels = 0;
934    
935    if (!w->pseudo_window_p)    if (!w->pseudo_window_p)
936      {      {
937        width -= FRAME_SCROLL_BAR_WIDTH (f) + FRAME_FRINGE_COLS (f);        cols -= WINDOW_SCROLL_BAR_COLS (w);
938    
939        if (area == TEXT_AREA)        if (area == TEXT_AREA)
940          {          {
941            if (INTEGERP (w->left_margin_width))            if (INTEGERP (w->left_margin_cols))
942              width -= XFASTINT (w->left_margin_width);              cols -= XFASTINT (w->left_margin_cols);
943            if (INTEGERP (w->right_margin_width))            if (INTEGERP (w->right_margin_cols))
944              width -= XFASTINT (w->right_margin_width);              cols -= XFASTINT (w->right_margin_cols);
945              pixels = -WINDOW_TOTAL_FRINGE_WIDTH (w);
946          }          }
947        else if (area == LEFT_MARGIN_AREA)        else if (area == LEFT_MARGIN_AREA)
948          width = (INTEGERP (w->left_margin_width)          {
949                   ? XFASTINT (w->left_margin_width) : 0);            cols = (INTEGERP (w->left_margin_cols)
950                       ? XFASTINT (w->left_margin_cols) : 0);
951              pixels = 0;
952            }
953        else if (area == RIGHT_MARGIN_AREA)        else if (area == RIGHT_MARGIN_AREA)
954          width = (INTEGERP (w->right_margin_width)          {
955                   ? XFASTINT (w->right_margin_width) : 0);            cols = (INTEGERP (w->right_margin_cols)
956                       ? XFASTINT (w->right_margin_cols) : 0);
957              pixels = 0;
958            }
959      }      }
960    
961    return width * CANON_X_UNIT (f);    return cols * WINDOW_FRAME_COLUMN_WIDTH (w) + pixels;
962  }  }
963    
964    
# Line 964  window_box_height (w) Line 970  window_box_height (w)
970       struct window *w;       struct window *w;
971  {  {
972    struct frame *f = XFRAME (w->frame);    struct frame *f = XFRAME (w->frame);
973    int height = XFASTINT (w->height) * CANON_Y_UNIT (f);    int height = WINDOW_TOTAL_HEIGHT (w);
974    
975    xassert (height >= 0);    xassert (height >= 0);
976    
# Line 1003  window_box_height (w) Line 1009  window_box_height (w)
1009    return max (0, height);    return max (0, height);
1010  }  }
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    }
1057    
1058  /* Return the frame-relative coordinate of the left edge of display  /* Return the frame-relative coordinate of the left edge of display
1059     area AREA of window W.  AREA < 0 means return the left edge of the     area AREA of window W.  AREA < 0 means return the left edge of the
# Line 1014  window_box_left (w, area) Line 1065  window_box_left (w, area)
1065       int area;       int area;
1066  {  {
1067    struct frame *f = XFRAME (w->frame);    struct frame *f = XFRAME (w->frame);
1068    int x = FRAME_INTERNAL_BORDER_WIDTH_SAFE (f);    int x;
1069    
1070    if (!w->pseudo_window_p)    if (w->pseudo_window_p)
1071      {      return FRAME_INTERNAL_BORDER_WIDTH (f);
       x += (WINDOW_LEFT_MARGIN (w) * CANON_X_UNIT (f)  
             + FRAME_LEFT_FRINGE_WIDTH (f));  
1072    
1073        if (area == TEXT_AREA)    x = (WINDOW_LEFT_EDGE_X (w)
1074          x += window_box_width (w, LEFT_MARGIN_AREA);         + window_box_left_offset (w, area));
       else if (area == RIGHT_MARGIN_AREA)  
         x += (window_box_width (w, LEFT_MARGIN_AREA)  
               + window_box_width (w, TEXT_AREA));  
     }  
1075    
1076    return x;    return x;
1077  }  }
# Line 1044  window_box_right (w, area) Line 1089  window_box_right (w, area)
1089    return window_box_left (w, area) + window_box_width (w, area);    return window_box_left (w, area) + window_box_width (w, area);
1090  }  }
1091    
   
1092  /* Get the bounding box of the display area AREA of window W, without  /* Get the bounding box of the display area AREA of window W, without
1093     mode lines, in frame-relative coordinates.  AREA < 0 means the     mode lines, in frame-relative coordinates.  AREA < 0 means the
1094     whole window, not including the left and right fringes of     whole window, not including the left and right fringes of
# Line 1058  window_box (w, area, box_x, box_y, box_w Line 1102  window_box (w, area, box_x, box_y, box_w
1102       int area;       int area;
1103       int *box_x, *box_y, *box_width, *box_height;       int *box_x, *box_y, *box_width, *box_height;
1104  {  {
1105    struct frame *f = XFRAME (w->frame);    if (box_width)
1106        *box_width = window_box_width (w, area);
1107    *box_width = window_box_width (w, area);    if (box_height)
1108    *box_height = window_box_height (w);      *box_height = window_box_height (w);
1109    *box_x = window_box_left (w, area);    if (box_x)
1110    *box_y = (FRAME_INTERNAL_BORDER_WIDTH_SAFE (f)      *box_x = window_box_left (w, area);
1111              + XFASTINT (w->top) * CANON_Y_UNIT (f));    if (box_y)
1112    if (WINDOW_WANTS_HEADER_LINE_P (w))      {
1113      *box_y += CURRENT_HEADER_LINE_HEIGHT (w);        *box_y = WINDOW_TOP_EDGE_Y (w);
1114          if (WINDOW_WANTS_HEADER_LINE_P (w))
1115            *box_y += CURRENT_HEADER_LINE_HEIGHT (w);
1116        }
1117  }  }
1118    
1119    
# Line 1184  pos_visible_p (w, charpos, fully, exact_ Line 1231  pos_visible_p (w, charpos, fully, exact_
1231      {      {
1232        int top_y = it.current_y;        int top_y = it.current_y;
1233        int bottom_y = line_bottom_y (&it);        int bottom_y = line_bottom_y (&it);
1234        int window_top_y = WINDOW_DISPLAY_HEADER_LINE_HEIGHT (w);        int window_top_y = WINDOW_HEADER_LINE_HEIGHT (w);
1235    
1236        if (top_y < window_top_y)        if (top_y < window_top_y)
1237          visible_p = bottom_y > window_top_y;          visible_p = bottom_y > window_top_y;
# Line 1421  pixel_to_glyph_coords (f, pix_x, pix_y, Line 1468  pixel_to_glyph_coords (f, pix_x, pix_y,
1468  #ifdef HAVE_WINDOW_SYSTEM  #ifdef HAVE_WINDOW_SYSTEM
1469    if (FRAME_WINDOW_P (f))    if (FRAME_WINDOW_P (f))
1470      {      {
1471        /* Arrange for the division in PIXEL_TO_CHAR_COL etc. to round down        /* Arrange for the division in FRAME_PIXEL_X_TO_COL etc. to round down
1472           even for negative values.  */           even for negative values.  */
1473        if (pix_x < 0)        if (pix_x < 0)
1474          pix_x -= FONT_WIDTH (FRAME_FONT (f)) - 1;          pix_x -= FRAME_COLUMN_WIDTH (f) - 1;
1475        if (pix_y < 0)        if (pix_y < 0)
1476          pix_y -= FRAME_X_OUTPUT(f)->line_height - 1;          pix_y -= FRAME_LINE_HEIGHT (f) - 1;
1477    
1478        pix_x = PIXEL_TO_CHAR_COL (f, pix_x);        pix_x = FRAME_PIXEL_X_TO_COL (f, pix_x);
1479        pix_y = PIXEL_TO_CHAR_ROW (f, pix_y);        pix_y = FRAME_PIXEL_Y_TO_LINE (f, pix_y);
1480    
1481        if (bounds)        if (bounds)
1482          STORE_NATIVE_RECT (*bounds,          STORE_NATIVE_RECT (*bounds,
1483                             CHAR_TO_PIXEL_COL (f, pix_x),                             FRAME_COL_TO_PIXEL_X (f, pix_x),
1484                             CHAR_TO_PIXEL_ROW (f, pix_y),                             FRAME_LINE_TO_PIXEL_Y (f, pix_y),
1485                             FONT_WIDTH  (FRAME_FONT (f)) - 1,                             FRAME_COLUMN_WIDTH (f) - 1,
1486                             FRAME_X_OUTPUT (f)->line_height - 1);                             FRAME_LINE_HEIGHT (f) - 1);
1487    
1488        if (!noclip)        if (!noclip)
1489          {          {
1490            if (pix_x < 0)            if (pix_x < 0)
1491              pix_x = 0;              pix_x = 0;
1492            else if (pix_x > FRAME_WINDOW_WIDTH (f))            else if (pix_x > FRAME_TOTAL_COLS (f))
1493              pix_x = FRAME_WINDOW_WIDTH (f);              pix_x = FRAME_TOTAL_COLS (f);
1494    
1495            if (pix_y < 0)            if (pix_y < 0)
1496              pix_y = 0;              pix_y = 0;
1497            else if (pix_y > f->height)            else if (pix_y > FRAME_LINES (f))
1498              pix_y = f->height;              pix_y = FRAME_LINES (f);
1499          }          }
1500      }      }
1501  #endif  #endif
# Line 1530  x_y_to_hpos_vpos (w, x, y, hpos, vpos, a Line 1577  x_y_to_hpos_vpos (w, x, y, hpos, vpos, a
1577  {  {
1578    struct glyph *glyph, *end;    struct glyph *glyph, *end;
1579    struct glyph_row *row = NULL;    struct glyph_row *row = NULL;
1580    int x0, i, left_area_width;    int x0, i;
1581    
1582    /* Find row containing Y.  Give up if some row is not enabled.  */    /* Find row containing Y.  Give up if some row is not enabled.  */
1583    for (i = 0; i < w->current_matrix->nrows; ++i)    for (i = 0; i < w->current_matrix->nrows; ++i)
# Line 1557  x_y_to_hpos_vpos (w, x, y, hpos, vpos, a Line 1604  x_y_to_hpos_vpos (w, x, y, hpos, vpos, a
1604      }      }
1605    else    else
1606      {      {
1607        left_area_width = window_box_width (w, LEFT_MARGIN_AREA);        if (x < window_box_left_offset (w, TEXT_AREA))
       if (x < left_area_width)  
1608          {          {
1609            *area = LEFT_MARGIN_AREA;            *area = LEFT_MARGIN_AREA;
1610            x0 = 0;            x0 = window_box_left_offset (w, LEFT_MARGIN_AREA);
1611          }          }
1612        else if (x < left_area_width + window_box_width (w, TEXT_AREA))        else if (x < window_box_right_offset (w, TEXT_AREA))
1613          {          {
1614            *area = TEXT_AREA;            *area = TEXT_AREA;
1615            x0 = row->x + left_area_width;            x0 = window_box_left_offset (w, TEXT_AREA);
1616          }          }
1617        else        else
1618          {          {
1619            *area = RIGHT_MARGIN_AREA;            *area = RIGHT_MARGIN_AREA;
1620            x0 = left_area_width + window_box_width (w, TEXT_AREA);            x0 = window_box_left_offset (w, RIGHT_MARGIN_AREA);
1621          }          }
1622      }      }
1623    
# Line 1614  frame_to_window_pixel_xy (w, x, y) Line 1660  frame_to_window_pixel_xy (w, x, y)
1660        /* A pseudo-window is always full-width, and starts at the        /* A pseudo-window is always full-width, and starts at the
1661           left edge of the frame, plus a frame border.  */           left edge of the frame, plus a frame border.  */
1662        struct frame *f = XFRAME (w->frame);        struct frame *f = XFRAME (w->frame);
1663        *x -= FRAME_INTERNAL_BORDER_WIDTH_SAFE (f);        *x -= FRAME_INTERNAL_BORDER_WIDTH (f);
1664        *y = FRAME_TO_WINDOW_PIXEL_Y (w, *y);        *y = FRAME_TO_WINDOW_PIXEL_Y (w, *y);
1665      }      }
1666    else    else
1667      {      {
1668        *x = FRAME_TO_WINDOW_PIXEL_X (w, *x);        *x -= WINDOW_LEFT_EDGE_X (w);
1669        *y = FRAME_TO_WINDOW_PIXEL_Y (w, *y);        *y = FRAME_TO_WINDOW_PIXEL_Y (w, *y);
1670      }      }
1671  }  }
# Line 1636  get_glyph_string_clip_rect (s, nr) Line 1682  get_glyph_string_clip_rect (s, nr)
1682    
1683    if (s->row->full_width_p)    if (s->row->full_width_p)
1684      {      {
1685        /* Draw full-width.  X coordinates are relative to S->w->left.  */        /* Draw full-width.  X coordinates are relative to S->w->left_col.  */
1686        int canon_x = CANON_X_UNIT (s->f);        r.x = WINDOW_LEFT_EDGE_X (s->w);
1687          r.width = WINDOW_TOTAL_WIDTH (s->w);
       r.x = WINDOW_LEFT_MARGIN (s->w) * canon_x;  
       r.width = XFASTINT (s->w->width) * canon_x;  
   
       if (FRAME_HAS_VERTICAL_SCROLL_BARS (s->f))  
         {  
           int width = FRAME_SCROLL_BAR_WIDTH (s->f) * canon_x;  
           if (FRAME_HAS_VERTICAL_SCROLL_BARS_ON_LEFT (s->f))  
             r.x -= width;  
         }  
   
       r.x += FRAME_INTERNAL_BORDER_WIDTH (s->f);  
1688    
1689        /* Unless displaying a mode or menu bar line, which are always        /* Unless displaying a mode or menu bar line, which are always
1690           fully visible, clip to the visible part of the row.  */           fully visible, clip to the visible part of the row.  */
# Line 1661  get_glyph_string_clip_rect (s, nr) Line 1696  get_glyph_string_clip_rect (s, nr)
1696    else    else
1697      {      {
1698        /* This is a text line that may be partially visible.  */        /* This is a text line that may be partially visible.  */
1699        r.x = WINDOW_AREA_TO_FRAME_PIXEL_X (s->w, s->area, 0);        r.x = window_box_left (s->w, s->area);
1700        r.width = window_box_width (s->w, s->area);        r.width = window_box_width (s->w, s->area);
1701        r.height = s->row->visible_height;        r.height = s->row->visible_height;
1702      }      }
# Line 1671  get_glyph_string_clip_rect (s, nr) Line 1706  get_glyph_string_clip_rect (s, nr)
1706       intentionally draws over other lines.  */       intentionally draws over other lines.  */
1707    if (s->for_overlaps_p)    if (s->for_overlaps_p)
1708      {      {
1709        r.y = WINDOW_DISPLAY_HEADER_LINE_HEIGHT (s->w);        r.y = WINDOW_HEADER_LINE_HEIGHT (s->w);
1710        r.height = window_text_bottom_y (s->w) - r.y;        r.height = window_text_bottom_y (s->w) - r.y;
1711      }      }
1712    else    else
# Line 1681  get_glyph_string_clip_rect (s, nr) Line 1716  get_glyph_string_clip_rect (s, nr)
1716           partially visible lines at the top of a window.  */           partially visible lines at the top of a window.  */
1717        if (!s->row->full_width_p        if (!s->row->full_width_p
1718            && MATRIX_ROW_PARTIALLY_VISIBLE_AT_TOP_P (s->w, s->row))            && MATRIX_ROW_PARTIALLY_VISIBLE_AT_TOP_P (s->w, s->row))
1719          r.y = WINDOW_DISPLAY_HEADER_LINE_HEIGHT (s->w);          r.y = WINDOW_HEADER_LINE_HEIGHT (s->w);
1720        else        else
1721          r.y = max (0, s->row->y);          r.y = max (0, s->row->y);
1722    
# Line 2087  init_iterator (it, w, charpos, bytepos, Line 2122  init_iterator (it, w, charpos, bytepos,
2122      {      {
2123        /* Mode lines, menu bar in terminal frames.  */        /* Mode lines, menu bar in terminal frames.  */
2124        it->first_visible_x = 0;        it->first_visible_x = 0;
2125        it->last_visible_x = XFASTINT (w->width) * CANON_X_UNIT (it->f);        it->last_visible_x = WINDOW_TOTAL_WIDTH (w);
2126      }      }
2127    else    else
2128      {      {
2129        it->first_visible_x        it->first_visible_x
2130          = XFASTINT (it->w->hscroll) * CANON_X_UNIT (it->f);          = XFASTINT (it->w->hscroll) * FRAME_COLUMN_WIDTH (it->f);
2131        it->last_visible_x = (it->first_visible_x        it->last_visible_x = (it->first_visible_x
2132                              + window_box_width (w, TEXT_AREA));                              + window_box_width (w, TEXT_AREA));
2133    
# Line 2109  init_iterator (it, w, charpos, bytepos, Line 2144  init_iterator (it, w, charpos, bytepos,
2144          }          }
2145    
2146        it->header_line_p = WINDOW_WANTS_HEADER_LINE_P (w);        it->header_line_p = WINDOW_WANTS_HEADER_LINE_P (w);
2147        it->current_y = WINDOW_DISPLAY_HEADER_LINE_HEIGHT (w) + w->vscroll;        it->current_y = WINDOW_HEADER_LINE_HEIGHT (w) + w->vscroll;
2148      }      }
2149    
2150    /* Leave room for a border glyph.  */    /* Leave room for a border glyph.  */
# Line 5796  move_it_vertically_backward (it, dy) Line 5831  move_it_vertically_backward (it, dy)
5831    xassert (dy >= 0);    xassert (dy >= 0);
5832    
5833    /* Estimate how many newlines we must move back.  */    /* Estimate how many newlines we must move back.  */
5834    nlines = max (1, dy / CANON_Y_UNIT (it->f));    nlines = max (1, dy / FRAME_LINE_HEIGHT (it->f));
5835    
5836    /* Set the iterator's position that many lines back.  */    /* Set the iterator's position that many lines back.  */
5837    while (nlines-- && IT_CHARPOS (*it) > BEGV)    while (nlines-- && IT_CHARPOS (*it) > BEGV)
# Line 7107  resize_mini_window (w, exact_p) Line 7142  resize_mini_window (w, exact_p)
7142      {      {
7143        struct it it;        struct it it;
7144        struct window *root = XWINDOW (FRAME_ROOT_WINDOW (f));        struct window *root = XWINDOW (FRAME_ROOT_WINDOW (f));
7145        int total_height = XFASTINT (root->height) + XFASTINT (w->height);        int total_height = WINDOW_TOTAL_LINES (root) + WINDOW_TOTAL_LINES (w);
7146        int height, max_height;        int height, max_height;
7147        int unit = CANON_Y_UNIT (f);        int unit = FRAME_LINE_HEIGHT (f);
7148        struct text_pos start;        struct text_pos start;
7149        struct buffer *old_current_buffer = NULL;        struct buffer *old_current_buffer = NULL;
7150    
# Line 7123  resize_mini_window (w, exact_p) Line 7158  resize_mini_window (w, exact_p)
7158    
7159        /* Compute the max. number of lines specified by the user.  */        /* Compute the max. number of lines specified by the user.  */
7160        if (FLOATP (Vmax_mini_window_height))        if (FLOATP (Vmax_mini_window_height))
7161          max_height = XFLOATINT (Vmax_mini_window_height) * FRAME_HEIGHT (f);          max_height = XFLOATINT (Vmax_mini_window_height) * FRAME_LINES (f);
7162        else if (INTEGERP (Vmax_mini_window_height))        else if (INTEGERP (Vmax_mini_window_height))
7163          max_height = XINT (Vmax_mini_window_height);          max_height = XINT (Vmax_mini_window_height);
7164        else        else
# Line 7164  resize_mini_window (w, exact_p) Line 7199  resize_mini_window (w, exact_p)
7199          {          {
7200            /* Let it grow only, until we display an empty message, in which            /* Let it grow only, until we display an empty message, in which
7201               case the window shrinks again.  */               case the window shrinks again.  */
7202            if (height > XFASTINT (w->height))            if (height > WINDOW_TOTAL_LINES (w))
7203              {              {
7204                int old_height = XFASTINT (w->height);                int old_height = WINDOW_TOTAL_LINES (w);
7205                freeze_window_starts (f, 1);                freeze_window_starts (f, 1);
7206                grow_mini_window (w, height - XFASTINT (w->height));                grow_mini_window (w, height - WINDOW_TOTAL_LINES (w));
7207                window_height_changed_p = XFASTINT (w->height) != old_height;                window_height_changed_p = WINDOW_TOTAL_LINES (w) != old_height;
7208              }              }
7209            else if (height < XFASTINT (w->height)            else if (height < WINDOW_TOTAL_LINES (w)
7210                     && (exact_p || BEGV == ZV))                     && (exact_p || BEGV == ZV))
7211              {              {
7212                int old_height = XFASTINT (w->height);                int old_height = WINDOW_TOTAL_LINES (w);
7213                freeze_window_starts (f, 0);                freeze_window_starts (f, 0);
7214                shrink_mini_window (w);                shrink_mini_window (w);
7215                window_height_changed_p = XFASTINT (w->height) != old_height;                window_height_changed_p = WINDOW_TOTAL_LINES (w) != old_height;
7216              }              }
7217          }          }
7218        else        else
7219          {          {
7220            /* Always resize to exact size needed.  */            /* Always resize to exact size needed.  */
7221            if (height > XFASTINT (w->height))            if (height > WINDOW_TOTAL_LINES (w))
7222              {              {
7223                int old_height = XFASTINT (w->height);                int old_height = WINDOW_TOTAL_LINES (w);
7224                freeze_window_starts (f, 1);                freeze_window_starts (f, 1);
7225                grow_mini_window (w, height - XFASTINT (w->height));                grow_mini_window (w, height - WINDOW_TOTAL_LINES (w));
7226                window_height_changed_p = XFASTINT (w->height) != old_height;                window_height_changed_p = WINDOW_TOTAL_LINES (w) != old_height;
7227              }              }
7228            else if (height < XFASTINT (w->height))            else if (height < WINDOW_TOTAL_LINES (w))
7229              {              {
7230                int old_height = XFASTINT (w->height);                int old_height = WINDOW_TOTAL_LINES (w);
7231                freeze_window_starts (f, 0);                freeze_window_starts (f, 0);
7232                shrink_mini_window (w);                shrink_mini_window (w);
7233    
7234                if (height)                if (height)
7235                  {                  {
7236                    freeze_window_starts (f, 1);                    freeze_window_starts (f, 1);
7237                    grow_mini_window (w, height - XFASTINT (w->height));                    grow_mini_window (w, height - WINDOW_TOTAL_LINES (w));
7238                  }                  }
7239    
7240                window_height_changed_p = XFASTINT (w->height) != old_height;                window_height_changed_p = WINDOW_TOTAL_LINES (w) != old_height;
7241              }              }
7242          }          }
7243    
# Line 8105  update_tool_bar (f, save_match_data) Line 8140  update_tool_bar (f, save_match_data)
8140    int do_update = FRAME_EXTERNAL_TOOL_BAR(f);    int do_update = FRAME_EXTERNAL_TOOL_BAR(f);
8141  #else  #else
8142    int do_update = WINDOWP (f->tool_bar_window)    int do_update = WINDOWP (f->tool_bar_window)
8143      && XFASTINT (XWINDOW (f->tool_bar_window)->height) > 0;      && WINDOW_TOTAL_LINES (XWINDOW (f->tool_bar_window)) > 0;
8144  #endif  #endif
8145    
8146    if (do_update)    if (do_update)
# Line 8438  tool_bar_lines_needed (f) Line 8473  tool_bar_lines_needed (f)
8473       F->desired_tool_bar_string in the tool-bar window of frame F.  */       F->desired_tool_bar_string in the tool-bar window of frame F.  */
8474    init_iterator (&it, w, -1, -1, w->desired_matrix->rows, TOOL_BAR_FACE_ID);    init_iterator (&it, w, -1, -1, w->desired_matrix->rows, TOOL_BAR_FACE_ID);
8475    it.first_visible_x = 0;    it.first_visible_x = 0;
8476    it.last_visible_x = FRAME_WINDOW_WIDTH (f) * CANON_X_UNIT (f);    it.last_visible_x = FRAME_TOTAL_COLS (f) * FRAME_COLUMN_WIDTH (f);
8477    reseat_to_string (&it, NULL, f->desired_tool_bar_string, 0, 0, 0, -1);    reseat_to_string (&it, NULL, f->desired_tool_bar_string, 0, 0, 0, -1);
8478    
8479    while (!ITERATOR_AT_END_P (&it))    while (!ITERATOR_AT_END_P (&it))
# Line 8448  tool_bar_lines_needed (f) Line 8483  tool_bar_lines_needed (f)
8483        display_tool_bar_line (&it);        display_tool_bar_line (&it);
8484      }      }
8485    
8486    return (it.current_y + CANON_Y_UNIT (f) - 1) / CANON_Y_UNIT (f);    return (it.current_y + FRAME_LINE_HEIGHT (f) - 1) / FRAME_LINE_HEIGHT (f);
8487  }  }
8488    
8489    
# Line 8470  DEFUN ("tool-bar-lines-needed", Ftool_ba Line 8505  DEFUN ("tool-bar-lines-needed", Ftool_ba
8505    
8506    if (WINDOWP (f->tool_bar_window)    if (WINDOWP (f->tool_bar_window)
8507        || (w = XWINDOW (f->tool_bar_window),        || (w = XWINDOW (f->tool_bar_window),
8508            XFASTINT (w->height) > 0))            WINDOW_TOTAL_LINES (w) > 0))
8509      {      {
8510        update_tool_bar (f, 1);        update_tool_bar (f, 1);
8511        if (f->n_tool_bar_items)        if (f->n_tool_bar_items)
# Line 8508  redisplay_tool_bar (f) Line 8543  redisplay_tool_bar (f)
8543       can turn off tool-bars by specifying tool-bar-lines zero.  */       can turn off tool-bars by specifying tool-bar-lines zero.  */
8544    if (!WINDOWP (f->tool_bar_window)    if (!WINDOWP (f->tool_bar_window)
8545        || (w = XWINDOW (f->tool_bar_window),        || (w = XWINDOW (f->tool_bar_window),
8546            XFASTINT (w->height) == 0))            WINDOW_TOTAL_LINES (w) == 0))
8547      return 0;      return 0;
8548    
8549    /* Set up an iterator for the tool-bar window.  */    /* Set up an iterator for the tool-bar window.  */
8550    init_iterator (&it, w, -1, -1, w->desired_matrix->rows, TOOL_BAR_FACE_ID);    init_iterator (&it, w, -1, -1, w->desired_matrix->rows, TOOL_BAR_FACE_ID);
8551    it.first_visible_x = 0;    it.first_visible_x = 0;
8552    it.last_visible_x = FRAME_WINDOW_WIDTH (f) * CANON_X_UNIT (f);    it.last_visible_x = FRAME_TOTAL_COLS (f) * FRAME_COLUMN_WIDTH (f);
8553    row = it.glyph_row;    row = it.glyph_row;
8554    
8555    /* Build a string that represents the contents of the tool-bar.  */    /* Build a string that represents the contents of the tool-bar.  */
# Line 8541  redisplay_tool_bar (f) Line 8576  redisplay_tool_bar (f)
8576    
8577        /* If there are blank lines at the end, except for a partially        /* If there are blank lines at the end, except for a partially
8578           visible blank line at the end that is smaller than           visible blank line at the end that is smaller than
8579           CANON_Y_UNIT, change the tool-bar's height.  */           FRAME_LINE_HEIGHT, change the tool-bar's height.  */
8580        row = it.glyph_row - 1;        row = it.glyph_row - 1;
8581        if (!row->displays_text_p        if (!row->displays_text_p
8582            && row->height >= CANON_Y_UNIT (f))            && row->height >= FRAME_LINE_HEIGHT (f))
8583          change_height_p = 1;          change_height_p = 1;
8584    
8585        /* If row displays tool-bar items, but is partially visible,        /* If row displays tool-bar items, but is partially visible,
# Line 8557  redisplay_tool_bar (f) Line 8592  redisplay_tool_bar (f)
8592           frame parameter.  */           frame parameter.  */
8593        if (change_height_p        if (change_height_p
8594            && (nlines = tool_bar_lines_needed (f),            && (nlines = tool_bar_lines_needed (f),
8595                nlines != XFASTINT (w->height)))                nlines != WINDOW_TOTAL_LINES (w)))
8596          {          {
8597            extern Lisp_Object Qtool_bar_lines;            extern Lisp_Object Qtool_bar_lines;
8598            Lisp_Object frame;            Lisp_Object frame;
8599            int old_height = XFASTINT (w->height);            int old_height = WINDOW_TOTAL_LINES (w);
8600    
8601            XSETFRAME (frame, f);            XSETFRAME (frame, f);
8602            clear_glyph_matrix (w->desired_matrix);            clear_glyph_matrix (w->desired_matrix);
# Line 8569  redisplay_tool_bar (f) Line 8604  redisplay_tool_bar (f)
8604                                      Fcons (Fcons (Qtool_bar_lines,                                      Fcons (Fcons (Qtool_bar_lines,
8605                                                    make_number (nlines)),                                                    make_number (nlines)),
8606                                             Qnil));                                             Qnil));
8607            if (XFASTINT (w->height) != old_height)            if (WINDOW_TOTAL_LINES (w) != old_height)
8608              fonts_changed_p = 1;              fonts_changed_p = 1;
8609          }          }
8610      }      }
# Line 8782  note_tool_bar_highlight (f, x, y) Line 8817  note_tool_bar_highlight (f, x, y)
8817    if (!NILP (enabled_p))    if (!NILP (enabled_p))
8818      {      {
8819        /* Compute the x-position of the glyph.  In front and past the        /* Compute the x-position of the glyph.  In front and past the
8820           image is a space.  We include this is the highlighted area.  */           image is a space.  We include this in the highlighted area.  */
8821        row = MATRIX_ROW (w->current_matrix, vpos);        row = MATRIX_ROW (w->current_matrix, vpos);
8822        for (i = x = 0; i < hpos; ++i)        for (i = x = 0; i < hpos; ++i)
8823          x += row->glyphs[TEXT_AREA][i].pixel_width;          x += row->glyphs[TEXT_AREA][i].pixel_width;
# Line 8909  draw_fringe_bitmap (w, row, which, left_ Line 8944  draw_fringe_bitmap (w, row, which, left_
8944    p.bx = -1;    p.bx = -1;
8945    if (left_p)    if (left_p)
8946      {      {
8947        if (p.wd > FRAME_X_LEFT_FRINGE_WIDTH (f))        int wd = WINDOW_LEFT_FRINGE_WIDTH (w);
8948          p.wd = FRAME_X_LEFT_FRINGE_WIDTH (f);        int x = window_box_left (w, (WINDOW_HAS_FRINGES_OUTSIDE_MARGINS (w)
8949        p.x = (WINDOW_TO_FRAME_PIXEL_X (w, 0)                                     ? LEFT_MARGIN_AREA
8950               - p.wd                                     : TEXT_AREA));
8951               - (FRAME_X_LEFT_FRINGE_WIDTH (f) - p.wd) / 2);        if (p.wd > wd)
8952        if (p.wd < FRAME_X_LEFT_FRINGE_WIDTH (f) || row->height > p.h)          p.wd = wd;
8953          p.x = x - p.wd - (wd - p.wd) / 2;
8954    
8955          if (p.wd < wd || row->height > p.h)
8956          {          {
8957            /* If W has a vertical border to its left, don't draw over it.  */            /* If W has a vertical border to its left, don't draw over it.  */
8958            int border = ((XFASTINT (w->left) > 0            wd -= ((!WINDOW_LEFTMOST_P (w)
8959                           && !FRAME_HAS_VERTICAL_SCROLL_BARS (f))                    && !WINDOW_HAS_VERTICAL_SCROLL_BAR (w))
8960                          ? 1 : 0);                   ? 1 : 0);
8961            p.bx = (window_box_left (w, -1)            p.bx = x - wd;
8962                    - FRAME_X_LEFT_FRINGE_WIDTH (f)            p.nx = wd;
                   + border);  
           p.nx = (FRAME_X_LEFT_FRINGE_WIDTH (f) - border);  
8963          }          }
8964      }      }
8965    else    else
8966      {      {
8967        if (p.wd > FRAME_X_RIGHT_FRINGE_WIDTH (f))        int x = window_box_right (w,
8968          p.wd = FRAME_X_RIGHT_FRINGE_WIDTH (f);                                  (WINDOW_HAS_FRINGES_OUTSIDE_MARGINS (w)
8969        p.x = (window_box_right (w, -1)                                   ? RIGHT_MARGIN_AREA
8970               + (FRAME_X_RIGHT_FRINGE_WIDTH (f) - p.wd) / 2);                                   : 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;
8975        /* Clear right fringe if no bitmap to draw of if bitmap doesn't fill        /* Clear right fringe if no bitmap to draw of if bitmap doesn't fill
8976           the fringe.  */           the fringe.  */
8977        if (p.wd < FRAME_X_RIGHT_FRINGE_WIDTH (f) || row->height > p.h)        if (p.wd < wd || row->height > p.h)
8978          {          {
8979            p.bx = window_box_right (w, -1);            p.bx = x;
8980            p.nx = FRAME_X_RIGHT_FRINGE_WIDTH (f);            p.nx = wd;
8981          }          }
8982      }      }
8983    
8984    if (p.bx >= 0)    if (p.bx >= 0)
8985      {      {
8986        int header_line_height = WINDOW_DISPLAY_HEADER_LINE_HEIGHT (w);        int header_line_height = WINDOW_HEADER_LINE_HEIGHT (w);
8987    
8988        p.by = WINDOW_TO_FRAME_PIXEL_Y (w, max (header_line_height, row->y));        p.by = WINDOW_TO_FRAME_PIXEL_Y (w, max (header_line_height, row->y));
8989        p.ny = row->visible_height;        p.ny = row->visible_height;
# Line 8973  draw_row_fringe_bitmaps (w, row) Line 9013  draw_row_fringe_bitmaps (w, row)
9013    if (row->visible_height <= 0)    if (row->visible_height <= 0)
9014      return;      return;
9015    
9016    if (FRAME_X_LEFT_FRINGE_WIDTH (f) != 0)    if (WINDOW_LEFT_FRINGE_WIDTH (w) != 0)
9017      {      {
9018        /* Decide which bitmap to draw in the left fringe.  */        /* Decide which bitmap to draw in the left fringe.  */
9019        if (row->overlay_arrow_p)        if (row->overlay_arrow_p)
# Line 8990  draw_row_fringe_bitmaps (w, row) Line 9030  draw_row_fringe_bitmaps (w, row)
9030        draw_fringe_bitmap (w, row, bitmap, 1);        draw_fringe_bitmap (w, row, bitmap, 1);
9031      }      }
9032    
9033    if (FRAME_X_RIGHT_FRINGE_WIDTH (f) != 0)    if (WINDOW_RIGHT_FRINGE_WIDTH (w) != 0)
9034      {      {
9035        /* Decide which bitmap to draw in the right fringe.  */        /* Decide which bitmap to draw in the right fringe.  */
9036        if (row->truncated_on_right_p)        if (row->truncated_on_right_p)
9037          bitmap = RIGHT_TRUNCATION_BITMAP;          bitmap = RIGHT_TRUNCATION_BITMAP;
9038        else if (row->continued_p)        else if (row->continued_p)
9039          bitmap = CONTINUED_LINE_BITMAP;          bitmap = CONTINUED_LINE_BITMAP;
9040        else if (row->indicate_empty_line_p && FRAME_X_LEFT_FRINGE_WIDTH (f) == 0)        else if (row->indicate_empty_line_p && WINDOW_LEFT_FRINGE_WIDTH (w) == 0)
9041          bitmap = ZV_LINE_BITMAP;          bitmap = ZV_LINE_BITMAP;
9042        else        else
9043          bitmap = NO_FRINGE_BITMAP;          bitmap = NO_FRINGE_BITMAP;
# Line 9014  compute_fringe_widths (f, redraw) Line 9054  compute_fringe_widths (f, redraw)
9054       struct frame *f;       struct frame *f;
9055       int redraw;       int redraw;
9056  {  {
9057    int o_left = FRAME_X_LEFT_FRINGE_WIDTH (f);    int o_left = FRAME_LEFT_FRINGE_WIDTH (f);
9058    int o_right = FRAME_X_RIGHT_FRINGE_WIDTH (f);    int o_right = FRAME_RIGHT_FRINGE_WIDTH (f);
9059    int o_cols = FRAME_X_FRINGE_COLS (f);    int o_cols = FRAME_FRINGE_COLS (f);
9060    
9061    Lisp_Object left_fringe = Fassq (Qleft_fringe, f->param_alist);    Lisp_Object left_fringe = Fassq (Qleft_fringe, f->param_alist);
9062    Lisp_Object right_fringe = Fassq (Qright_fringe, f->param_alist);    Lisp_Object right_fringe = Fassq (Qright_fringe, f->param_alist);
# Line 9037  compute_fringe_widths (f, redraw) Line 9077  compute_fringe_widths (f, redraw)
9077        int left_wid = left_fringe_width >= 0 ? left_fringe_width : -left_fringe_width;        int left_wid = left_fringe_width >= 0 ? left_fringe_width : -left_fringe_width;
9078        int right_wid = right_fringe_width >= 0 ? right_fringe_width : -right_fringe_width;        int right_wid = right_fringe_width >= 0 ? right_fringe_width : -right_fringe_width;
9079        int conf_wid = left_wid + right_wid;        int conf_wid = left_wid + right_wid;
9080        int font_wid = FONT_WIDTH (FRAME_FONT (f));        int font_wid = FRAME_COLUMN_WIDTH (f);
9081        int cols = (left_wid + right_wid + font_wid-1) / font_wid;        int cols = (left_wid + right_wid + font_wid-1) / font_wid;
9082        int real_wid = cols * font_wid;        int real_wid = cols * font_wid;
9083        if (left_wid && right_wid)        if (left_wid && right_wid)
# Line 9045  compute_fringe_widths (f, redraw) Line 9085  compute_fringe_widths (f, redraw)
9085            if (left_fringe_width < 0)            if (left_fringe_width < 0)
9086              {              {
9087                /* Left fringe width is fixed, adjust right fringe if necessary */                /* Left fringe width is fixed, adjust right fringe if necessary */
9088                FRAME_X_LEFT_FRINGE_WIDTH (f) = left_wid;                FRAME_LEFT_FRINGE_WIDTH (f) = left_wid;
9089                FRAME_X_RIGHT_FRINGE_WIDTH (f) = real_wid - left_wid;                FRAME_RIGHT_FRINGE_WIDTH (f) = real_wid - left_wid;
9090              }              }
9091            else if (right_fringe_width < 0)            else if (right_fringe_width < 0)
9092              {              {
9093                /* Right fringe width is fixed, adjust left fringe if necessary */                /* Right fringe width is fixed, adjust left fringe if necessary */
9094                FRAME_X_LEFT_FRINGE_WIDTH (f) = real_wid - right_wid;                FRAME_LEFT_FRINGE_WIDTH (f) = real_wid - right_wid;
9095                FRAME_X_RIGHT_FRINGE_WIDTH (f) = right_wid;                FRAME_RIGHT_FRINGE_WIDTH (f) = right_wid;
9096              }              }
9097            else            else
9098              {              {
# Line 9060  compute_fringe_widths (f, redraw) Line 9100  compute_fringe_widths (f, redraw)
9100                   Note that we are doing integer arithmetic here, so don't                   Note that we are doing integer arithmetic here, so don't
9101                   lose a pixel if the total width is an odd number.  */                   lose a pixel if the total width is an odd number.  */
9102                int fill = real_wid - conf_wid;                int fill = real_wid - conf_wid;
9103                FRAME_X_LEFT_FRINGE_WIDTH (f) = left_wid + fill/2;                FRAME_LEFT_FRINGE_WIDTH (f) = left_wid + fill/2;
9104                FRAME_X_RIGHT_FRINGE_WIDTH (f) = right_wid + fill - fill/2;                FRAME_RIGHT_FRINGE_WIDTH (f) = right_wid + fill - fill/2;
9105              }              }
9106          }          }
9107        else if (left_fringe_width)        else if (left_fringe_width)
9108          {          {
9109            FRAME_X_LEFT_FRINGE_WIDTH (f) = real_wid;            FRAME_LEFT_FRINGE_WIDTH (f) = real_wid;
9110            FRAME_X_RIGHT_FRINGE_WIDTH (f) = 0;            FRAME_RIGHT_FRINGE_WIDTH (f) = 0;
9111          }          }
9112        else        else
9113          {          {
9114            FRAME_X_LEFT_FRINGE_WIDTH (f) = 0;            FRAME_LEFT_FRINGE_WIDTH (f) = 0;
9115            FRAME_X_RIGHT_FRINGE_WIDTH (f) = real_wid;            FRAME_RIGHT_FRINGE_WIDTH (f) = real_wid;
9116          }          }
9117        FRAME_X_FRINGE_COLS (f) = cols;        FRAME_FRINGE_COLS (f) = cols;
       FRAME_X_FRINGE_WIDTH (f) = real_wid;  
9118      }      }
9119    else    else
9120      {      {
9121        FRAME_X_LEFT_FRINGE_WIDTH (f) = 0;        FRAME_LEFT_FRINGE_WIDTH (f) = 0;
9122        FRAME_X_RIGHT_FRINGE_WIDTH (f) = 0;        FRAME_RIGHT_FRINGE_WIDTH (f) = 0;
9123        FRAME_X_FRINGE_COLS (f) = 0;        FRAME_FRINGE_COLS (f) = 0;
       FRAME_X_FRINGE_WIDTH (f) = 0;  
9124      }      }
9125    
9126    if (redraw && FRAME_VISIBLE_P (f))    if (redraw && FRAME_VISIBLE_P (f))
9127      if (o_left != FRAME_X_LEFT_FRINGE_WIDTH (f) ||      if (o_left != FRAME_LEFT_FRINGE_WIDTH (f) ||
9128          o_right != FRAME_X_RIGHT_FRINGE_WIDTH (f) ||          o_right != FRAME_RIGHT_FRINGE_WIDTH (f) ||
9129          o_cols != FRAME_X_FRINGE_COLS (f))          o_cols != FRAME_FRINGE_COLS (f))
9130        redraw_frame (f);        redraw_frame (f);
9131  }  }
9132    
# Line 9146  hscroll_window_tree (window) Line 9184  hscroll_window_tree (window)
9184          hscrolled_p |= hscroll_window_tree (w->vchild);          hscrolled_p |= hscroll_window_tree (w->vchild);
9185        else if (w->cursor.vpos >= 0)        else if (w->cursor.vpos >= 0)
9186          {          {
9187            int h_margin, text_area_x, text_area_y;            int h_margin;
9188            int text_area_width, text_area_height;            int text_area_width;
9189            struct glyph_row *current_cursor_row            struct glyph_row *current_cursor_row
9190              = MATRIX_ROW (w->current_matrix, w->cursor.vpos);              = MATRIX_ROW (w->current_matrix, w->cursor.vpos);
9191            struct glyph_row *desired_cursor_row            struct glyph_row *desired_cursor_row
# Line 9157  hscroll_window_tree (window) Line 9195  hscroll_window_tree (window)
9195                 ? desired_cursor_row                 ? desired_cursor_row
9196                 : current_cursor_row);                 : current_cursor_row);
9197    
9198            window_box (w, TEXT_AREA, &text_area_x, &text_area_y,            text_area_width = window_box_width (w, TEXT_AREA);
                       &text_area_width, &text_area_height);  
9199    
9200            /* Scroll when cursor is inside this scroll margin.  */            /* Scroll when cursor is inside this scroll margin.  */
9201            h_margin = hscroll_margin * CANON_X_UNIT (XFRAME (w->frame));            h_margin = hscroll_margin * WINDOW_FRAME_COLUMN_WIDTH (w);
9202    
9203            if ((XFASTINT (w->hscroll)            if ((XFASTINT (w->hscroll)
9204                 && w->cursor.x <= h_margin)                 && w->cursor.x <= h_margin)
# Line 9198  hscroll_window_tree (window) Line 9235  hscroll_window_tree (window)
9235                /* Position cursor in window.  */                /* Position cursor in window.  */
9236                if (!hscroll_relative_p && hscroll_step_abs == 0)                if (!hscroll_relative_p && hscroll_step_abs == 0)
9237                  hscroll = max (0, it.current_x - text_area_width / 2)                  hscroll = max (0, it.current_x - text_area_width / 2)
9238                            / CANON_X_UNIT (it.f);                            / FRAME_COLUMN_WIDTH (it.f);
9239                else if (w->cursor.x >= text_area_width - h_margin)                else if (w->cursor.x >= text_area_width - h_margin)
9240                  {                  {
9241                    if (hscroll_relative_p)                    if (hscroll_relative_p)
# Line 9206  hscroll_window_tree (window) Line 9243  hscroll_window_tree (window)
9243                                 - h_margin;                                 - h_margin;
9244                    else                    else
9245                      wanted_x = text_area_width                      wanted_x = text_area_width
9246                                 - hscroll_step_abs * CANON_X_UNIT (it.f)                                 - hscroll_step_abs * FRAME_COLUMN_WIDTH (it.f)
9247                                 - h_margin;                                 - h_margin;
9248                    hscroll                    hscroll
9249                      = max (0, it.current_x - wanted_x) / CANON_X_UNIT (it.f);                      = max (0, it.current_x - wanted_x) / FRAME_COLUMN_WIDTH (it.f);
9250                  }                  }
9251                else                else
9252                  {                  {
# Line 9217  hscroll_window_tree (window) Line 9254  hscroll_window_tree (window)
9254                      wanted_x = text_area_width * hscroll_step_rel                      wanted_x = text_area_width * hscroll_step_rel
9255                                 + h_margin;                                 + h_margin;
9256                    else                    else
9257                      wanted_x = hscroll_step_abs * CANON_X_UNIT (it.f)                      wanted_x = hscroll_step_abs * FRAME_COLUMN_WIDTH (it.f)
9258                                 + h_margin;                                 + h_margin;
9259                    hscroll                    hscroll
9260                      = max (0, it.current_x - wanted_x) / CANON_X_UNIT (it.f);                      = max (0, it.current_x - wanted_x) / FRAME_COLUMN_WIDTH (it.f);
9261                  }                  }
9262                hscroll = max (hscroll, XFASTINT (w->min_hscroll));                hscroll = max (hscroll, XFASTINT (w->min_hscroll));
9263    
# Line 9869  redisplay_internal (preserve_echo_area) Line 9906  redisplay_internal (preserve_echo_area)
9906                 /* Make sure the cursor was last displayed                 /* Make sure the cursor was last displayed
9907                    in this window.  Otherwise we have to reposition it.  */                    in this window.  Otherwise we have to reposition it.  */
9908                 && 0 <= w->cursor.vpos                 && 0 <= w->cursor.vpos
9909                 && XINT (w->height) > w->cursor.vpos)                 && WINDOW_TOTAL_LINES (w) > w->cursor.vpos)
9910          {          {
9911            if (!must_finish)            if (!must_finish)
9912              {              {
# Line 10273  mark_window_display_accurate_1 (w, accur Line 10310  mark_window_display_accurate_1 (w, accur
10310        w->window_end_valid = w->buffer;        w->window_end_valid = w->buffer;
10311  #if 0 /* This is incorrect with variable-height lines.  */  #if 0 /* This is incorrect with variable-height lines.  */
10312        xassert (XINT (w->window_end_vpos)        xassert (XINT (w->window_end_vpos)
10313                 < (XINT (w->height)                 < (WINDOW_TOTAL_LINES (w)
10314                    - (WINDOW_WANTS_MODELINE_P (w) ? 1 : 0)));                    - (WINDOW_WANTS_MODELINE_P (w) ? 1 : 0)));
10315  #endif  #endif
10316        w->update_mode_line = Qnil;        w->update_mode_line = Qnil;
# Line 10736  try_scrolling (window, just_this_one_p, Line 10773  try_scrolling (window, just_this_one_p,
10773       within this distance from the top or bottom of the window.  */       within this distance from the top or bottom of the window.  */
10774    if (scroll_margin > 0)    if (scroll_margin > 0)
10775      {      {
10776        this_scroll_margin = min (scroll_margin, XINT (w->height) / 4);        this_scroll_margin = min (scroll_margin, WINDOW_TOTAL_LINES (w) / 4);
10777        this_scroll_margin *= CANON_Y_UNIT (f);        this_scroll_margin *= FRAME_LINE_HEIGHT (f);
10778      }      }
10779    else    else
10780      this_scroll_margin = 0;      this_scroll_margin = 0;
# Line 10755  try_scrolling (window, just_this_one_p, Line 10792  try_scrolling (window, just_this_one_p,
10792      scroll_max = 10;      scroll_max = 10;
10793    else    else
10794      scroll_max = 0;      scroll_max = 0;
10795    scroll_max *= CANON_Y_UNIT (f);    scroll_max *= FRAME_LINE_HEIGHT (f);
10796    
10797    /* Decide whether we have to scroll down.  Start at the window end    /* Decide whether we have to scroll down.  Start at the window end
10798       and move this_scroll_margin up to find the position of the scroll       and move this_scroll_margin up to find the position of the scroll
# Line 10806  try_scrolling (window, just_this_one_p, Line 10843  try_scrolling (window, just_this_one_p,
10843          /* Set AMOUNT_TO_SCROLL to at least one line,          /* Set AMOUNT_TO_SCROLL to at least one line,
10844             and at most scroll_conservatively lines.  */             and at most scroll_conservatively lines.  */
10845          amount_to_scroll          amount_to_scroll
10846            = min (max (dy, CANON_Y_UNIT (f)),            = min (max (dy, FRAME_LINE_HEIGHT (f)),
10847                   CANON_Y_UNIT (f) * scroll_conservatively);                   FRAME_LINE_HEIGHT (f) * scroll_conservatively);
10848        else if (scroll_step || temp_scroll_step)        else if (scroll_step || temp_scroll_step)
10849          amount_to_scroll = scroll_max;          amount_to_scroll = scroll_max;
10850        else        else
10851          {          {
10852            aggressive = current_buffer->scroll_up_aggressively;            aggressive = current_buffer->scroll_up_aggressively;
10853            height = (WINDOW_DISPLAY_HEIGHT_NO_MODE_LINE (w)            height = WINDOW_BOX_TEXT_HEIGHT (w);
                     - WINDOW_DISPLAY_HEADER_LINE_HEIGHT (w));  
10854            if (NUMBERP (aggressive))            if (NUMBERP (aggressive))
10855              amount_to_scroll = XFLOATINT (aggressive) * height;              amount_to_scroll = XFLOATINT (aggressive) * height;
10856          }          }
# Line 10866  try_scrolling (window, just_this_one_p, Line 10902  try_scrolling (window, just_this_one_p,
10902    
10903            if (scroll_conservatively)            if (scroll_conservatively)
10904              amount_to_scroll =              amount_to_scroll =
10905                max (dy, CANON_Y_UNIT (f) * max (scroll_step, temp_scroll_step));                max (dy, FRAME_LINE_HEIGHT (f) * max (scroll_step, temp_scroll_step));
10906            else if (scroll_step || temp_scroll_step)            else if (scroll_step || temp_scroll_step)
10907              amount_to_scroll = scroll_max;              amount_to_scroll = scroll_max;
10908            else            else
10909              {              {
10910                aggressive = current_buffer->scroll_down_aggressively;                aggressive = current_buffer->scroll_down_aggressively;
10911                height = (WINDOW_DISPLAY_HEIGHT_NO_MODE_LINE (w)                height = WINDOW_BOX_TEXT_HEIGHT (w);
                         - WINDOW_DISPLAY_HEADER_LINE_HEIGHT (w));  
10912                if (NUMBERP (aggressive))                if (NUMBERP (aggressive))
10913                  amount_to_scroll = XFLOATINT (aggressive) * height;                  amount_to_scroll = XFLOATINT (aggressive) * height;
10914              }              }
# Line 10963  compute_window_start_on_continuation_lin Line 10998  compute_window_start_on_continuation_lin
10998        /* If the line start is "too far" away from the window start,        /* If the line start is "too far" away from the window start,
10999           say it takes too much time to compute a new window start.  */           say it takes too much time to compute a new window start.  */
11000        if (CHARPOS (start_pos) - IT_CHARPOS (it)        if (CHARPOS (start_pos) - IT_CHARPOS (it)
11001            < XFASTINT (w->height) * XFASTINT (w->width))            < WINDOW_TOTAL_LINES (w) * WINDOW_TOTAL_COLS (w))
11002          {          {
11003            int min_distance, distance;            int min_distance, distance;
11004    
# Line 11081  try_cursor_movement (window, startp, scr Line 11116  try_cursor_movement (window, startp, scr
11116        /* Scroll if point within this distance from the top or bottom        /* Scroll if point within this distance from the top or bottom
11117           of the window.  This is a pixel value.  */           of the window.  This is a pixel value.  */
11118        this_scroll_margin = max (0, scroll_margin);        this_scroll_margin = max (0, scroll_margin);
11119        this_scroll_margin = min (this_scroll_margin, XFASTINT (w->height) / 4);        this_scroll_margin = min (this_scroll_margin, WINDOW_TOTAL_LINES (w) / 4);
11120        this_scroll_margin *= CANON_Y_UNIT (f);        this_scroll_margin *= FRAME_LINE_HEIGHT (f);
11121    
11122        /* Start with the row the cursor was displayed during the last        /* Start with the row the cursor was displayed during the last
11123           not paused redisplay.  Give up if that row is not valid.  */           not paused redisplay.  Give up if that row is not valid.  */
# Line 11942  redisplay_window (window, just_this_one_ Line 11977  redisplay_window (window, just_this_one_
11977    ;    ;
11978   finish_scroll_bars:   finish_scroll_bars:
11979    
11980    if (FRAME_HAS_VERTICAL_SCROLL_BARS (f))    if (WINDOW_HAS_VERTICAL_SCROLL_BAR (w))
11981      {      {
11982        /* Set the thumb's position and size.  */        /* Set the thumb's position and size.  */
11983        set_vertical_scroll_bar (w);        set_vertical_scroll_bar (w);
# Line 12177  try_window_reusing_current_matrix (w) Line 12212  try_window_reusing_current_matrix (w)
12212              (start_row + i)->enabled_p = 0;              (start_row + i)->enabled_p = 0;
12213    
12214            /* Re-compute Y positions.  */            /* Re-compute Y positions.  */
12215            min_y = WINDOW_DISPLAY_HEADER_LINE_HEIGHT (w);            min_y = WINDOW_HEADER_LINE_HEIGHT (w);
12216            max_y = it.last_visible_y;            max_y = it.last_visible_y;
12217            for (row = start_row + nrows_scrolled;            for (row = start_row + nrows_scrolled;
12218                 row < bottom_row;                 row < bottom_row;
# Line 12292  try_window_reusing_current_matrix (w) Line 12327  try_window_reusing_current_matrix (w)
12327        it.vpos = (MATRIX_ROW_VPOS (first_row_to_display, w->current_matrix)        it.vpos = (MATRIX_ROW_VPOS (first_row_to_display, w->current_matrix)
12328                   - nrows_scrolled);                   - nrows_scrolled);
12329        it.current_y = (first_row_to_display->y - first_reusable_row->y        it.current_y = (first_row_to_display->y - first_reusable_row->y
12330                        + WINDOW_DISPLAY_HEADER_LINE_HEIGHT (w));                        + WINDOW_HEADER_LINE_HEIGHT (w));
12331    
12332        /* Display lines beginning with first_row_to_display in the        /* Display lines beginning with first_row_to_display in the
12333           desired matrix.  Set last_text_row to the last row displayed           desired matrix.  Set last_text_row to the last row displayed
# Line 12323  try_window_reusing_current_matrix (w) Line 12358  try_window_reusing_current_matrix (w)
12358    
12359        /* Scroll the display.  */        /* Scroll the display.  */
12360        run.current_y = first_reusable_row->y;        run.current_y = first_reusable_row->y;
12361        run.desired_y = WINDOW_DISPLAY_HEADER_LINE_HEIGHT (w);        run.desired_y = WINDOW_HEADER_LINE_HEIGHT (w);
12362        run.height = it.last_visible_y - run.current_y;        run.height = it.last_visible_y - run.current_y;
12363        dy = run.current_y - run.desired_y;        dy = run.current_y - run.desired_y;
12364    
# Line 12340  try_window_reusing_current_matrix (w) Line 12375  try_window_reusing_current_matrix (w)
12375    
12376        /* Adjust Y positions of reused rows.  */        /* Adjust Y positions of reused rows.  */
12377        bottom_row = MATRIX_BOTTOM_TEXT_ROW (w->current_matrix, w);        bottom_row = MATRIX_BOTTOM_TEXT_ROW (w->current_matrix, w);
12378        min_y = WINDOW_DISPLAY_HEADER_LINE_HEIGHT (w);        min_y = WINDOW_HEADER_LINE_HEIGHT (w);
12379        max_y = it.last_visible_y;        max_y = it.last_visible_y;
12380        for (row = first_reusable_row; row < first_row_to_display; ++row)        for (row = first_reusable_row; row < first_row_to_display; ++row)
12381          {          {
# Line 12592  sync_frame_with_window_matrix_rows (w) Line 12627  sync_frame_with_window_matrix_rows (w)
12627       marginal areas (see build_frame_matrix).  */       marginal areas (see build_frame_matrix).  */
12628    window_row = w->current_matrix->rows;    window_row = w->current_matrix->rows;
12629    window_row_end = window_row + w->current_matrix->nrows;    window_row_end = window_row + w->current_matrix->nrows;
12630    frame_row = f->current_matrix->rows + XFASTINT (w->top);    frame_row = f->current_matrix->rows + WINDOW_TOP_EDGE_LINE (w);
12631    while (window_row < window_row_end)    while (window_row < window_row_end)
12632      {      {
12633        struct glyph *start = window_row->glyphs[LEFT_MARGIN_AREA];        struct glyph *start = window_row->glyphs[LEFT_MARGIN_AREA];
# Line 13133  try_window_id (w) Line 13168  try_window_id (w)
13168      int this_scroll_margin, cursor_height;      int this_scroll_margin, cursor_height;
13169    
13170      this_scroll_margin = max (0, scroll_margin);      this_scroll_margin = max (0, scroll_margin);
13171      this_scroll_margin = min (this_scroll_margin,      this_scroll_margin = min (this_scroll_margin, WINDOW_TOTAL_LINES (w) / 4);
13172                                XFASTINT (w->height) / 4);      this_scroll_margin *= FRAME_LINE_HEIGHT (it.f);
     this_scroll_margin *= CANON_Y_UNIT (it.f);  
13173      cursor_height = MATRIX_ROW (w->desired_matrix, w->cursor.vpos)->height;      cursor_height = MATRIX_ROW (w->desired_matrix, w->cursor.vpos)->height;
13174    
13175      if ((w->cursor.y < this_scroll_margin      if ((w->cursor.y < this_scroll_margin
# Line 13170  try_window_id (w) Line 13204  try_window_id (w)
13204               lines to scroll by; dvpos < 0 means scroll up.  */               lines to scroll by; dvpos < 0 means scroll up.  */
13205            int first_unchanged_at_end_vpos            int first_unchanged_at_end_vpos
13206              = MATRIX_ROW_VPOS (first_unchanged_at_end_row, w->current_matrix);              = MATRIX_ROW_VPOS (first_unchanged_at_end_row, w->current_matrix);
13207            int from = XFASTINT (w->top) + first_unchanged_at_end_vpos;            int from = WINDOW_TOP_EDGE_LINE (w) + first_unchanged_at_end_vpos;
13208            int end = (XFASTINT (w->top)            int end = (WINDOW_TOP_EDGE_LINE (w)
13209                       + (WINDOW_WANTS_HEADER_LINE_P (w) ? 1 : 0)                       + (WINDOW_WANTS_HEADER_LINE_P (w) ? 1 : 0)
13210                       + window_internal_height (w));                       + window_internal_height (w));
13211    
# Line 13861  compute_line_metrics (it) Line 13895  compute_line_metrics (it)
13895        if (row->height == 0)        if (row->height == 0)
13896          {          {
13897            if (it->max_ascent + it->max_descent == 0)            if (it->max_ascent + it->max_descent == 0)
13898              it->max_descent = it->max_phys_descent = CANON_Y_UNIT (it->f);              it->max_descent = it->max_phys_descent = FRAME_LINE_HEIGHT (it->f);
13899            row->ascent = it->max_ascent;            row->ascent = it->max_ascent;
13900            row->height = it->max_ascent + it->max_descent;            row->height = it->max_ascent + it->max_descent;
13901            row->phys_ascent = it->max_phys_ascent;            row->phys_ascent = it->max_phys_ascent;
# Line 13892  compute_line_metrics (it) Line 13926  compute_line_metrics (it)
13926        /* Compute how much of the line is visible.  */        /* Compute how much of the line is visible.  */
13927        row->visible_height = row->height;        row->visible_height = row->height;
13928    
13929        min_y = WINDOW_DISPLAY_HEADER_LINE_HEIGHT (it->w);        min_y = WINDOW_HEADER_LINE_HEIGHT (it->w);
13930        max_y = WINDOW_DISPLAY_HEIGHT_NO_MODE_LINE (it->w);        max_y = WINDOW_BOX_HEIGHT_NO_MODE_LINE (it->w);
13931    
13932        if (row->y < min_y)        if (row->y < min_y)
13933          row->visible_height -= min_y - row->y;          row->visible_height -= min_y - row->y;
# Line 14649  display_menu_bar (w) Line 14683  display_menu_bar (w)
14683    xassert (!FRAME_WINDOW_P (f));    xassert (!FRAME_WINDOW_P (f));
14684    init_iterator (&it, w, -1, -1, f->desired_matrix->rows, MENU_FACE_ID);    init_iterator (&it, w, -1, -1, f->desired_matrix->rows, MENU_FACE_ID);
14685    it.first_visible_x = 0;    it.first_visible_x = 0;
14686    it.last_visible_x = FRAME_WINDOW_WIDTH (f) * CANON_X_UNIT (f);    it.last_visible_x = FRAME_TOTAL_COLS (f) * FRAME_COLUMN_WIDTH (f);
14687  #else /* not USE_X_TOOLKIT */  #else /* not USE_X_TOOLKIT */
14688    if (FRAME_WINDOW_P (f))    if (FRAME_WINDOW_P (f))
14689      {      {
# Line 14661  display_menu_bar (w) Line 14695  display_menu_bar (w)
14695        init_iterator (&it, menu_w, -1, -1, menu_w->desired_matrix->rows,        init_iterator (&it, menu_w, -1, -1, menu_w->desired_matrix->rows,
14696                       MENU_FACE_ID);                       MENU_FACE_ID);
14697        it.first_visible_x = 0;        it.first_visible_x = 0;
14698        it.last_visible_x = FRAME_WINDOW_WIDTH (f) * CANON_X_UNIT (f);        it.last_visible_x = FRAME_TOTAL_COLS (f) * FRAME_COLUMN_WIDTH (f);
14699      }      }
14700    else    else
14701      {      {
# Line 14670  display_menu_bar (w) Line 14704  display_menu_bar (w)
14704        init_iterator (&it, w, -1, -1, f->desired_matrix->rows,        init_iterator (&it, w, -1, -1, f->desired_matrix->rows,
14705                       MENU_FACE_ID);                       MENU_FACE_ID);
14706        it.first_visible_x = 0;        it.first_visible_x = 0;
14707        it.last_visible_x = FRAME_WIDTH (f);        it.last_visible_x = FRAME_COLS (f);
14708      }      }
14709  #endif /* not USE_X_TOOLKIT */  #endif /* not USE_X_TOOLKIT */
14710    
# Line 15742  decode_mode_spec (w, c, field_width, pre Line 15776  decode_mode_spec (w, c, field_width, pre
15776          int startpos_byte = marker_byte_position (w->start);          int startpos_byte = marker_byte_position (w->start);
15777          int line, linepos, linepos_byte, topline;          int line, linepos, linepos_byte, topline;
15778          int nlines, junk;          int nlines, junk;
15779          int height = XFASTINT (w->height);          int height = WINDOW_TOTAL_LINES (w);
15780    
15781          /* If we decided that this buffer isn't suitable for line numbers,          /* If we decided that this buffer isn't suitable for line numbers,
15782             don't forget that too fast.  */             don't forget that too fast.  */
# Line 17268  draw_glyphs (w, x, row, area, start, end Line 17302  draw_glyphs (w, x, row, area, start, end
17302      {      {
17303        /* X is relative to the left edge of W, without scroll bars        /* X is relative to the left edge of W, without scroll bars
17304           or fringes.  */           or fringes.  */
17305        int window_left_x = WINDOW_LEFT_MARGIN (w) * CANON_X_UNIT (f);        x += WINDOW_LEFT_EDGE_X (w);
17306          last_x = WINDOW_LEFT_EDGE_X (w) + WINDOW_TOTAL_WIDTH (w);
       x += window_left_x;  
       area_width = XFASTINT (w->width) * CANON_X_UNIT (f);  
       last_x = window_left_x + area_width;  
   
       if (FRAME_HAS_VERTICAL_SCROLL_BARS (f))  
         {  
           int width = FRAME_SCROLL_BAR_WIDTH (f) * CANON_X_UNIT (f);  
           if (FRAME_HAS_VERTICAL_SCROLL_BARS_ON_RIGHT (f))  
             last_x += width;  
           else  
             x -= width;  
         }  
   
       x += FRAME_INTERNAL_BORDER_WIDTH (f);  
       /* ++KFS: W32 and MAC versions had -= in next line (bug??)  */  
       last_x += FRAME_INTERNAL_BORDER_WIDTH (f);  
17307      }      }
17308    else    else
17309      {      {
17310        x = WINDOW_AREA_TO_FRAME_PIXEL_X (w, area, x);        int area_left = window_box_left (w, area);
17311          x += area_left;
17312        area_width = window_box_width (w, area);        area_width = window_box_width (w, area);
17313        last_x = WINDOW_AREA_TO_FRAME_PIXEL_X (w, area, area_width);        last_x = area_left + area_width;
17314      }      }
17315    
17316    /* Build a doubly-linked list of glyph_string structures between    /* Build a doubly-linked list of glyph_string structures between
# Line 17396  draw_glyphs (w, x, row, area, start, end Line 17415  draw_glyphs (w, x, row, area, start, end
17415        int x0 = head ? head->x : x;        int x0 = head ? head->x : x;
17416        int x1 = tail ? tail->x + tail->background_width : x;        int x1 = tail ? tail->x + tail->background_width : x;
17417    
17418        x0 = FRAME_TO_WINDOW_PIXEL_X (w, x0);        int text_left = window_box_left (w, TEXT_AREA);
17419        x1 = FRAME_TO_WINDOW_PIXEL_X (w, x1);        x0 -= text_left;
17420          x1 -= text_left;
       /* ++KFS: W32 and MAC versions had following test here:  
          if (!row->full_width_p && XFASTINT (w->left_margin_width) != 0)  
       */  
   
       if (XFASTINT (w->left_margin_width) != 0)  
         {  
           int left_area_width = window_box_width (w, LEFT_MARGIN_AREA);  
           x0 -= left_area_width;  
           x1 -= left_area_width;  
         }  
17421    
17422        notice_overwritten_cursor (w, area, x0, x1,        notice_overwritten_cursor (w, TEXT_AREA, x0, x1,
17423                                   row->y, MATRIX_ROW_BOTTOM_Y (row));                                   row->y, MATRIX_ROW_BOTTOM_Y (row));
17424      }      }
17425    
17426    /* Value is the x-position up to which drawn, relative to AREA of W.    /* Value is the x-position up to which drawn, relative to AREA of W.
17427       This doesn't include parts drawn because of overhangs.  */       This doesn't include parts drawn because of overhangs.  */
17428    x_reached = FRAME_TO_WINDOW_PIXEL_X (w, x_reached);    if (row->full_width_p)
17429    if (!row->full_width_p)      x_reached = FRAME_TO_WINDOW_PIXEL_X (w, x_reached);
17430      {    else
17431        /* ++KFS: W32 and MAC versions only had this test here:      x_reached -= window_box_left (w, area);
          if (area > LEFT_MARGIN_AREA)  
       */  
   
       if (area > LEFT_MARGIN_AREA && XFASTINT (w->left_margin_width) != 0)  
         x_reached -= window_box_width (w, LEFT_MARGIN_AREA);  
       if (area > TEXT_AREA)  
         x_reached -= window_box_width (w, TEXT_AREA);  
     }  
17432    
17433    RELEASE_HDC (hdc, f);    RELEASE_HDC (hdc, f);
17434    
# Line 17695  produce_stretch_glyph (it) Line 17696  produce_stretch_glyph (it)
17696    if (prop = Fplist_get (plist, QCwidth),    if (prop = Fplist_get (plist, QCwidth),
17697        NUMVAL (prop) > 0)        NUMVAL (prop) > 0)
17698      /* Absolute width `:width WIDTH' specified and valid.  */      /* Absolute width `:width WIDTH' specified and valid.  */
17699      width = NUMVAL (prop) * CANON_X_UNIT (it->f);      width = NUMVAL (prop) * FRAME_COLUMN_WIDTH (it->f);
17700    else if (prop = Fplist_get (plist, QCrelative_width),    else if (prop = Fplist_get (plist, QCrelative_width),
17701             NUMVAL (prop) > 0)             NUMVAL (prop) > 0)
17702      {      {
# Line 17722  produce_stretch_glyph (it) Line 17723  produce_stretch_glyph (it)
17723      }      }
17724    else if (prop = Fplist_get (plist, QCalign_to),    else if (prop = Fplist_get (plist, QCalign_to),
17725             NUMVAL (prop) > 0)             NUMVAL (prop) > 0)
17726      width = NUMVAL (prop) * CANON_X_UNIT (it->f) - it->current_x;      width = NUMVAL (prop) * FRAME_COLUMN_WIDTH (it->f) - it->current_x;
17727    else    else
17728      /* Nothing specified -> width defaults to canonical char width.  */      /* Nothing specified -> width defaults to canonical char width.  */
17729      width = CANON_X_UNIT (it->f);      width = FRAME_COLUMN_WIDTH (it->f);
17730    
17731    /* Compute height.  */    /* Compute height.  */
17732    if (prop = Fplist_get (plist, QCheight),    if (prop = Fplist_get (plist, QCheight),
17733        NUMVAL (prop) > 0)        NUMVAL (prop) > 0)
17734      height = NUMVAL (prop) * CANON_Y_UNIT (it->f);      height = NUMVAL (prop) * FRAME_LINE_HEIGHT (it->f);
17735    else if (prop = Fplist_get (plist, QCrelative_height),    else if (prop = Fplist_get (plist, QCrelative_height),
17736             NUMVAL (prop) > 0)             NUMVAL (prop) > 0)
17737      height = FONT_HEIGHT (font) * NUMVAL (prop);      height = FONT_HEIGHT (font) * NUMVAL (prop);
# Line 17957  x_produce_glyphs (it) Line 17958  x_produce_glyphs (it)
17958          }          }
17959        else if (it->char_to_display == '\t')        else if (it->char_to_display == '\t')
17960          {          {
17961            int tab_width = it->tab_width * CANON_X_UNIT (it->f);            int tab_width = it->tab_width * FRAME_COLUMN_WIDTH (it->f);
17962            int x = it->current_x + it->continuation_lines_width;            int x = it->current_x + it->continuation_lines_width;
17963            int next_tab_x = ((1 + x + tab_width - 1) / tab_width) * tab_width;            int next_tab_x = ((1 + x + tab_width - 1) / tab_width) * tab_width;
17964    
17965            /* If the distance from the current position to the next tab            /* If the distance from the current position to the next tab
17966               stop is less than a canonical character width, use the               stop is less than a canonical character width, use the
17967               tab stop after that.  */               tab stop after that.  */
17968            if (next_tab_x - x < CANON_X_UNIT (it->f))            if (next_tab_x - x < FRAME_COLUMN_WIDTH (it->f))
17969              next_tab_x += tab_width;              next_tab_x += tab_width;
17970    
17971            it->pixel_width = next_tab_x - x;            it->pixel_width = next_tab_x - x;
# Line 17999  x_produce_glyphs (it) Line 18000  x_produce_glyphs (it)
18000                int charset = CHAR_CHARSET (it->char_to_display);                int charset = CHAR_CHARSET (it->char_to_display);
18001    
18002                it->glyph_not_available_p = 1;                it->glyph_not_available_p = 1;
18003                it->pixel_width = (FONT_WIDTH (FRAME_FONT (it->f))                it->pixel_width = (FRAME_COLUMN_WIDTH (it->f)
18004                                   * CHARSET_WIDTH (charset));                                   * CHARSET_WIDTH (charset));
18005                it->phys_ascent = FONT_BASE (font) + boff;                it->phys_ascent = FONT_BASE (font) + boff;
18006                it->phys_descent = FONT_DESCENT (font) - boff;                it->phys_descent = FONT_DESCENT (font) - boff;
# Line 18455  x_clear_end_of_line (to_x) Line 18456  x_clear_end_of_line (to_x)
18456    f = XFRAME (w->frame);    f = XFRAME (w->frame);
18457    
18458    if (updated_row->full_width_p)    if (updated_row->full_width_p)
18459      {      max_x = WINDOW_TOTAL_WIDTH (w);
       max_x = XFASTINT (w->width) * CANON_X_UNIT (f);  
       if (FRAME_HAS_VERTICAL_SCROLL_BARS (f)  
           && !w->pseudo_window_p)  
         max_x += FRAME_SCROLL_BAR_WIDTH (f) * CANON_X_UNIT (f);  
     }  
18460    else    else
18461      max_x = window_box_width (w, updated_area);      max_x = window_box_width (w, updated_area);
18462    max_y = window_text_bottom_y (w);    max_y = window_text_bottom_y (w);
# Line 18493  x_clear_end_of_line (to_x) Line 18489  x_clear_end_of_line (to_x)
18489      }      }
18490    else    else
18491      {      {
18492        from_x = WINDOW_AREA_TO_FRAME_PIXEL_X (w, updated_area, from_x);        int area_left = window_box_left (w, updated_area);
18493        to_x = WINDOW_AREA_TO_FRAME_PIXEL_X (w, updated_area, to_x);        from_x += area_left;
18494          to_x += area_left;
18495      }      }
18496    
18497    min_y = WINDOW_DISPLAY_HEADER_LINE_HEIGHT (w);    min_y = WINDOW_HEADER_LINE_HEIGHT (w);
18498    from_y = WINDOW_TO_FRAME_PIXEL_Y (w, max (min_y, output_cursor.y));    from_y = WINDOW_TO_FRAME_PIXEL_Y (w, max (min_y, output_cursor.y));
18499    to_y = WINDOW_TO_FRAME_PIXEL_Y (w, to_y);    to_y = WINDOW_TO_FRAME_PIXEL_Y (w, to_y);
18500    
# Line 18783  x_fix_overlapping_area (w, row, area) Line 18780  x_fix_overlapping_area (w, row, area)
18780    
18781    BLOCK_INPUT;    BLOCK_INPUT;
18782    
18783    if (area == LEFT_MARGIN_AREA)    x = window_box_left_offset (w, area);
18784      x = 0;    if (area == TEXT_AREA)
18785    else if (area == TEXT_AREA)      x += row->x;
     x = row->x + window_box_width (w, LEFT_MARGIN_AREA);  
   else  
     x = (window_box_width (w, LEFT_MARGIN_AREA)  
          + window_box_width (w, TEXT_AREA));  
18786    
18787    for (i = 0; i < row->used[area];)    for (i = 0; i < row->used[area];)
18788      {      {
# Line 18928  erase_phys_cursor (w) Line 18921  erase_phys_cursor (w)
18921    if (w->phys_cursor_type == HOLLOW_BOX_CURSOR)    if (w->phys_cursor_type == HOLLOW_BOX_CURSOR)
18922      {      {
18923        int x, y;        int x, y;
18924        int header_line_height = WINDOW_DISPLAY_HEADER_LINE_HEIGHT (w);        int header_line_height = WINDOW_HEADER_LINE_HEIGHT (w);
18925    
18926        cursor_glyph = get_phys_cursor_glyph (w);        cursor_glyph = get_phys_cursor_glyph (w);
18927        if (cursor_glyph == NULL)        if (cursor_glyph == NULL)
# Line 19594  note_mouse_highlight (f, x, y) Line 19587  note_mouse_highlight (f, x, y)
19587      }      }
19588    
19589    /* Which window is that in?  */    /* Which window is that in?  */
19590    window = window_from_coordinates (f, x, y, &part, 1);    window = window_from_coordinates (f, x, y, &part, 0, 0, 1);
19591    
19592    /* If we were displaying active text in another window, clear that.  */    /* If we were displaying active text in another window, clear that.  */
19593    if (! EQ (window, dpyinfo->mouse_face_window))    if (! EQ (window, dpyinfo->mouse_face_window))
# Line 20078  expose_area (w, row, r, area) Line 20071  expose_area (w, row, r, area)
20071        /* Set START_X to the window-relative start position for drawing glyphs of        /* Set START_X to the window-relative start position for drawing glyphs of
20072           AREA.  The first glyph of the text area can be partially visible.           AREA.  The first glyph of the text area can be partially visible.
20073           The first glyphs of other areas cannot.  */           The first glyphs of other areas cannot.  */
20074        if (area == LEFT_MARGIN_AREA)        start_x = window_box_left_offset (w, area);
20075          start_x = 0;        if (area == TEXT_AREA)
20076        else if (area == TEXT_AREA)          start_x += row->x;
         start_x = row->x + window_box_width (w, LEFT_MARGIN_AREA);  
       else  
         start_x = (window_box_width (w, LEFT_MARGIN_AREA)  
                    + window_box_width (w, TEXT_AREA));  
20077        x = start_x;        x = start_x;
20078    
20079        /* Find the first glyph that must be redrawn.  */        /* Find the first glyph that must be redrawn.  */
# Line 20214  x_draw_vertical_border (w) Line 20203  x_draw_vertical_border (w)
20203  {  {
20204    struct frame *f = XFRAME (WINDOW_FRAME (w));    struct frame *f = XFRAME (WINDOW_FRAME (w));
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    
20210    /* Redraw borders between horizontally adjacent windows.  Don't    /* Redraw borders between horizontally adjacent windows.  Don't
20211       do it for frames with vertical scroll bars because either the       do it for frames with vertical scroll bars because either the
20212       right scroll bar of a window, or the left scroll bar of its       right scroll bar of a window, or the left scroll bar of its
20213       neighbor will suffice as a border.  */       neighbor will suffice as a border.  */
20214    if (!WINDOW_RIGHTMOST_P (w)    if (!WINDOW_RIGHTMOST_P (w)
20215        && !FRAME_HAS_VERTICAL_SCROLL_BARS (f))        && !WINDOW_HAS_VERTICAL_SCROLL_BAR_ON_RIGHT (w))
20216      {      {
20217        int x0, x1, y0, y1;        int x0, x1, y0, y1;
20218    
20219        window_box_edges (w, -1, &x0, &y0, &x1, &y1);        window_box_edges (w, -1, &x0, &y0, &x1, &y1);
       x1 += FRAME_X_RIGHT_FRINGE_WIDTH (f);  
20220        y1 -= 1;        y1 -= 1;
20221    
20222        rif->draw_vertical_window_border (w, x1, y0, y1);        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);
20233        }
20234  }  }
20235    
20236    
# Line 20263  expose_window (w, fr) Line 20265  expose_window (w, fr)
20265      }      }
20266    
20267    /* Frame-relative pixel rectangle of W.  */    /* Frame-relative pixel rectangle of W.  */
20268    wr.x = XFASTINT (w->left) * CANON_X_UNIT (f);    wr.x = WINDOW_LEFT_EDGE_X (w);
20269    wr.y = XFASTINT (w->top) * CANON_Y_UNIT (f);    wr.y = WINDOW_TOP_EDGE_Y (w);
20270    wr.width = XFASTINT (w->width) * CANON_X_UNIT (f);    wr.width = WINDOW_TOTAL_WIDTH (w);
20271    wr.height = XFASTINT (w->height) * CANON_Y_UNIT (f);    wr.height = WINDOW_TOTAL_HEIGHT (w);
20272    
20273    if (x_intersect_rectangles (fr, &wr, &r))    if (x_intersect_rectangles (fr, &wr, &r))
20274      {      {
# Line 20441  expose_frame (f, x, y, w, h) Line 20443  expose_frame (f, x, y, w, h)
20443    if (w == 0 || h == 0)    if (w == 0 || h == 0)
20444      {      {
20445        r.x = r.y = 0;        r.x = r.y = 0;
20446        r.width = CANON_X_UNIT (f) * f->width;        r.width = FRAME_COLUMN_WIDTH (f) * FRAME_COLS (f);
20447        r.height = CANON_Y_UNIT (f) * f->height;        r.height = FRAME_LINE_HEIGHT (f) * FRAME_LINES (f);
20448      }      }
20449    else    else
20450      {      {
# Line 21007  init_xdisp () Line 21009  init_xdisp ()
21009        struct frame *f = XFRAME (WINDOW_FRAME (XWINDOW (root_window)));        struct frame *f = XFRAME (WINDOW_FRAME (XWINDOW (root_window)));
21010        int i;        int i;
21011    
21012        XWINDOW (root_window)->top = make_number (FRAME_TOP_MARGIN (f));        XWINDOW (root_window)->top_line = make_number (FRAME_TOP_MARGIN (f));
21013        set_window_height (root_window,        set_window_height (root_window,
21014                           FRAME_HEIGHT (f) - 1 - FRAME_TOP_MARGIN (f),                           FRAME_LINES (f) - 1 - FRAME_TOP_MARGIN (f),
21015                           0);                           0);
21016        mini_w->top = make_number (FRAME_HEIGHT (f) - 1);        mini_w->top_line = make_number (FRAME_LINES (f) - 1);
21017        set_window_height (minibuf_window, 1, 0);        set_window_height (minibuf_window, 1, 0);
21018    
21019        XWINDOW (root_window)->width = make_number (FRAME_WIDTH (f));        XWINDOW (root_window)->total_cols = make_number (FRAME_COLS (f));
21020        mini_w->width = make_number (FRAME_WIDTH (f));        mini_w->total_cols = make_number (FRAME_COLS (f));
21021    
21022        scratch_glyph_row.glyphs[TEXT_AREA] = scratch_glyphs;        scratch_glyph_row.glyphs[TEXT_AREA] = scratch_glyphs;
21023        scratch_glyph_row.glyphs[TEXT_AREA + 1]        scratch_glyph_row.glyphs[TEXT_AREA + 1]

Legend:
Removed from v.1.830  
changed lines
  Added in v.1.831

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26