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

Diff of /emacs/src/dispnew.c

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

revision 1.312 by jhd, Sun Jan 19 21:50:01 2003 UTC revision 1.313 by lektu, Tue Feb 4 14:03:12 2003 UTC
# Line 317  struct redisplay_interface *rif; Line 317  struct redisplay_interface *rif;
317    
318  int fonts_changed_p;  int fonts_changed_p;
319    
320  /* Convert vpos and hpos from frame to window and vice versa.  /* Convert vpos and hpos from frame to window and vice versa.
321     This may only be used for terminal frames.  */     This may only be used for terminal frames.  */
322    
323  #if GLYPH_DEBUG  #if GLYPH_DEBUG
# Line 368  add_window_display_history (w, msg, paus Line 368  add_window_display_history (w, msg, paus
368       int paused_p;       int paused_p;
369  {  {
370    char *buf;    char *buf;
371      
372    if (history_idx >= REDISPLAY_HISTORY_SIZE)    if (history_idx >= REDISPLAY_HISTORY_SIZE)
373      history_idx = 0;      history_idx = 0;
374    buf = redisplay_history[history_idx].trace;    buf = redisplay_history[history_idx].trace;
375    ++history_idx;    ++history_idx;
376      
377    sprintf (buf, "%d: window %p (`%s')%s\n",    sprintf (buf, "%d: window %p (`%s')%s\n",
378             history_tick++,             history_tick++,
379             w,             w,
# Line 396  add_frame_display_history (f, paused_p) Line 396  add_frame_display_history (f, paused_p)
396       int paused_p;       int paused_p;
397  {  {
398    char *buf;    char *buf;
399      
400    if (history_idx >= REDISPLAY_HISTORY_SIZE)    if (history_idx >= REDISPLAY_HISTORY_SIZE)
401      history_idx = 0;      history_idx = 0;
402    buf = redisplay_history[history_idx].trace;    buf = redisplay_history[history_idx].trace;
403    ++history_idx;    ++history_idx;
404      
405    sprintf (buf, "%d: update frame %p%s",    sprintf (buf, "%d: update frame %p%s",
406             history_tick++,             history_tick++,
407             f, paused_p ? " ***paused***" : "");             f, paused_p ? " ***paused***" : "");
# Line 490  safe_bcopy (from, to, size) Line 490  safe_bcopy (from, to, size)
490            bcopy (from, to, endt - from);            bcopy (from, to, endt - from);
491          }          }
492      }      }
493  }      }
494    
495    
496    
# Line 530  new_glyph_matrix (pool) Line 530  new_glyph_matrix (pool)
530     is freed.  If the count gets negative, more structures were freed     is freed.  If the count gets negative, more structures were freed
531     than allocated, i.e. one matrix was freed more than once or a bogus     than allocated, i.e. one matrix was freed more than once or a bogus
532     pointer was passed to this function.     pointer was passed to this function.
533    
534     If MATRIX->pool is null, this means that the matrix manages its own     If MATRIX->pool is null, this means that the matrix manages its own
535     glyph memory---this is done for matrices on X frames.  Freeing the     glyph memory---this is done for matrices on X frames.  Freeing the
536     matrix also frees the glyph memory in this case.  */     matrix also frees the glyph memory in this case.  */
# Line 552  free_glyph_matrix (matrix) Line 552  free_glyph_matrix (matrix)
552        if (matrix->pool == NULL)        if (matrix->pool == NULL)
553          for (i = 0; i < matrix->rows_allocated; ++i)          for (i = 0; i < matrix->rows_allocated; ++i)
554            xfree (matrix->rows[i].glyphs[LEFT_MARGIN_AREA]);            xfree (matrix->rows[i].glyphs[LEFT_MARGIN_AREA]);
555          
556        /* Free row structures and the matrix itself.  */        /* Free row structures and the matrix itself.  */
557        xfree (matrix->rows);        xfree (matrix->rows);
558        xfree (matrix);        xfree (matrix);
# Line 655  adjust_glyph_matrix (w, matrix, x, y, di Line 655  adjust_glyph_matrix (w, matrix, x, y, di
655            && matrix->window_width == window_width)            && matrix->window_width == window_width)
656          return;          return;
657      }      }
658      
659    /* Enlarge MATRIX->rows if necessary.  New rows are cleared.  */    /* Enlarge MATRIX->rows if necessary.  New rows are cleared.  */
660    if (matrix->rows_allocated < dim.height)    if (matrix->rows_allocated < dim.height)
661      {      {
# Line 675  adjust_glyph_matrix (w, matrix, x, y, di Line 675  adjust_glyph_matrix (w, matrix, x, y, di
675    if (matrix->pool)    if (matrix->pool)
676      {      {
677        xassert (matrix->pool->glyphs);        xassert (matrix->pool->glyphs);
678          
679        if (w)        if (w)
680          {          {
681            left = margin_glyphs_to_reserve (w, dim.width,            left = margin_glyphs_to_reserve (w, dim.width,
# Line 685  adjust_glyph_matrix (w, matrix, x, y, di Line 685  adjust_glyph_matrix (w, matrix, x, y, di
685          }          }
686        else        else
687          left = right = 0;          left = right = 0;
688          
689        for (i = 0; i < dim.height; ++i)        for (i = 0; i < dim.height; ++i)
690          {          {
691            struct glyph_row *row = &matrix->rows[i];            struct glyph_row *row = &matrix->rows[i];
692              
693            row->glyphs[LEFT_MARGIN_AREA]            row->glyphs[LEFT_MARGIN_AREA]
694              = (matrix->pool->glyphs              = (matrix->pool->glyphs
695                 + (y + i) * matrix->pool->ncolumns                 + (y + i) * matrix->pool->ncolumns
696                 + x);                 + x);
697              
698            if (w == NULL            if (w == NULL
699                || row == matrix->rows + dim.height - 1                || row == matrix->rows + dim.height - 1
700                || (row == matrix->rows && matrix->header_line_p))                || (row == matrix->rows && matrix->header_line_p))
# Line 716  adjust_glyph_matrix (w, matrix, x, y, di Line 716  adjust_glyph_matrix (w, matrix, x, y, di
716                  = row->glyphs[LEFT_MARGIN_AREA] + dim.width;                  = row->glyphs[LEFT_MARGIN_AREA] + dim.width;
717              }              }
718          }          }
719          
720        matrix->left_margin_glyphs = left;        matrix->left_margin_glyphs = left;
721        matrix->right_margin_glyphs = right;        matrix->right_margin_glyphs = right;
722      }      }
# Line 731  adjust_glyph_matrix (w, matrix, x, y, di Line 731  adjust_glyph_matrix (w, matrix, x, y, di
731          {          {
732            struct glyph_row *row = matrix->rows;            struct glyph_row *row = matrix->rows;
733            struct glyph_row *end = row + matrix->rows_allocated;            struct glyph_row *end = row + matrix->rows_allocated;
734              
735            while (row < end)            while (row < end)
736              {              {
737                row->glyphs[LEFT_MARGIN_AREA]                row->glyphs[LEFT_MARGIN_AREA]
738                  = (struct glyph *) xrealloc (row->glyphs[LEFT_MARGIN_AREA],                  = (struct glyph *) xrealloc (row->glyphs[LEFT_MARGIN_AREA],
739                                               (dim.width                                               (dim.width
740                                                * sizeof (struct glyph)));                                                * sizeof (struct glyph)));
741                  
742                /* The mode line never has marginal areas.  */                /* The mode line never has marginal areas.  */
743                if (row == matrix->rows + dim.height - 1                if (row == matrix->rows + dim.height - 1
744                    || (row == matrix->rows && matrix->header_line_p))                    || (row == matrix->rows && matrix->header_line_p))
# Line 767  adjust_glyph_matrix (w, matrix, x, y, di Line 767  adjust_glyph_matrix (w, matrix, x, y, di
767        matrix->left_margin_glyphs = left;        matrix->left_margin_glyphs = left;
768        matrix->right_margin_glyphs = right;        matrix->right_margin_glyphs = right;
769      }      }
770      
771    /* Number of rows to be used by MATRIX.  */    /* Number of rows to be used by MATRIX.  */
772    matrix->nrows = dim.height;    matrix->nrows = dim.height;
773    xassert (matrix->nrows >= 0);    xassert (matrix->nrows >= 0);
# Line 782  adjust_glyph_matrix (w, matrix, x, y, di Line 782  adjust_glyph_matrix (w, matrix, x, y, di
782               building desired matrices when this function runs.  */               building desired matrices when this function runs.  */
783            if (window_width < 0)            if (window_width < 0)
784              window_width = window_box_width (w, -1);              window_width = window_box_width (w, -1);
785          
786            /* Optimize the case that only the height has changed (C-x 2,            /* Optimize the case that only the height has changed (C-x 2,
787               upper window).  Invalidate all rows that are no longer part               upper window).  Invalidate all rows that are no longer part
788               of the window.  */               of the window.  */
# Line 807  adjust_glyph_matrix (w, matrix, x, y, di Line 807  adjust_glyph_matrix (w, matrix, x, y, di
807                if (INTEGERP (w->window_end_vpos)                if (INTEGERP (w->window_end_vpos)
808                    && XFASTINT (w->window_end_vpos) >= i)                    && XFASTINT (w->window_end_vpos) >= i)
809                  w->window_end_valid = Qnil;                  w->window_end_valid = Qnil;
810              
811                while (i < matrix->nrows)                while (i < matrix->nrows)
812                  matrix->rows[i++].enabled_p = 0;                  matrix->rows[i++].enabled_p = 0;
813              }              }
# Line 827  adjust_glyph_matrix (w, matrix, x, y, di Line 827  adjust_glyph_matrix (w, matrix, x, y, di
827              matrix->rows[i].enabled_p = 0;              matrix->rows[i].enabled_p = 0;
828          }          }
829      }      }
830        
831      
832    /* Remember last values to be able to optimize frame redraws.  */    /* Remember last values to be able to optimize frame redraws.  */
833    matrix->matrix_x = x;    matrix->matrix_x = x;
834    matrix->matrix_y = y;    matrix->matrix_y = y;
# Line 939  enable_glyph_matrix_rows (matrix, start, Line 939  enable_glyph_matrix_rows (matrix, start,
939    xassert (start <= end);    xassert (start <= end);
940    xassert (start >= 0 && start < matrix->nrows);    xassert (start >= 0 && start < matrix->nrows);
941    xassert (end >= 0 && end <= matrix->nrows);    xassert (end >= 0 && end <= matrix->nrows);
942      
943    for (; start < end; ++start)    for (; start < end; ++start)
944      matrix->rows[start].enabled_p = enabled_p != 0;      matrix->rows[start].enabled_p = enabled_p != 0;
945  }  }
# Line 965  clear_glyph_matrix (matrix) Line 965  clear_glyph_matrix (matrix)
965        matrix->no_scrolling_p = 0;        matrix->no_scrolling_p = 0;
966      }      }
967  }  }
968      
969    
970  /* Shift part of the glyph matrix MATRIX of window W up or down.  /* Shift part of the glyph matrix MATRIX of window W up or down.
971     Increment y-positions in glyph rows between START and END by DY,     Increment y-positions in glyph rows between START and END by DY,
# Line 978  shift_glyph_matrix (w, matrix, start, en Line 978  shift_glyph_matrix (w, matrix, start, en
978       int start, end, dy;       int start, end, dy;
979  {  {
980    int min_y, max_y;    int min_y, max_y;
981      
982    xassert (start <= end);    xassert (start <= end);
983    xassert (start >= 0 && start < matrix->nrows);    xassert (start >= 0 && start < matrix->nrows);
984    xassert (end >= 0 && end <= matrix->nrows);    xassert (end >= 0 && end <= matrix->nrows);
985      
986    min_y = WINDOW_DISPLAY_HEADER_LINE_HEIGHT (w);    min_y = WINDOW_DISPLAY_HEADER_LINE_HEIGHT (w);
987    max_y = WINDOW_DISPLAY_HEIGHT_NO_MODE_LINE (w);    max_y = WINDOW_DISPLAY_HEIGHT_NO_MODE_LINE (w);
988      
989    for (; start < end; ++start)    for (; start < end; ++start)
990      {      {
991        struct glyph_row *row = &matrix->rows[start];        struct glyph_row *row = &matrix->rows[start];
992          
993        row->y += dy;        row->y += dy;
994        row->visible_height = row->height;        row->visible_height = row->height;
995          
996        if (row->y < min_y)        if (row->y < min_y)
997          row->visible_height -= min_y - row->y;          row->visible_height -= min_y - row->y;
998        if (row->y + row->height > max_y)        if (row->y + row->height > max_y)
# Line 1037  clear_desired_matrices (f) Line 1037  clear_desired_matrices (f)
1037  {  {
1038    if (f->desired_matrix)    if (f->desired_matrix)
1039      clear_glyph_matrix (f->desired_matrix);      clear_glyph_matrix (f->desired_matrix);
1040      
1041    if (WINDOWP (f->menu_bar_window))    if (WINDOWP (f->menu_bar_window))
1042      clear_glyph_matrix (XWINDOW (f->menu_bar_window)->desired_matrix);      clear_glyph_matrix (XWINDOW (f->menu_bar_window)->desired_matrix);
1043    
# Line 1142  blank_row (w, row, y) Line 1142  blank_row (w, row, y)
1142       int y;       int y;
1143  {  {
1144    int min_y, max_y;    int min_y, max_y;
1145      
1146    min_y = WINDOW_DISPLAY_HEADER_LINE_HEIGHT (w);    min_y = WINDOW_DISPLAY_HEADER_LINE_HEIGHT (w);
1147    max_y = WINDOW_DISPLAY_HEIGHT_NO_MODE_LINE (w);    max_y = WINDOW_DISPLAY_HEIGHT_NO_MODE_LINE (w);
1148      
1149    clear_glyph_row (row);    clear_glyph_row (row);
1150    row->y = y;    row->y = y;
1151    row->ascent = row->phys_ascent = 0;    row->ascent = row->phys_ascent = 0;
1152    row->height = row->phys_height = CANON_Y_UNIT (XFRAME (w->frame));    row->height = row->phys_height = CANON_Y_UNIT (XFRAME (w->frame));
1153    row->visible_height = row->height;    row->visible_height = row->height;
1154          
1155    if (row->y < min_y)    if (row->y < min_y)
1156      row->visible_height -= min_y - row->y;      row->visible_height -= min_y - row->y;
1157    if (row->y + row->height > max_y)    if (row->y + row->height > max_y)
# Line 1290  copy_glyph_row_contents (to, from, delta Line 1290  copy_glyph_row_contents (to, from, delta
1290    /* Copy glyphs from FROM to TO.  */    /* Copy glyphs from FROM to TO.  */
1291    for (area = 0; area < LAST_AREA; ++area)    for (area = 0; area < LAST_AREA; ++area)
1292      if (from->used[area])      if (from->used[area])
1293        bcopy (from->glyphs[area], to->glyphs[area],        bcopy (from->glyphs[area], to->glyphs[area],
1294               from->used[area] * sizeof (struct glyph));               from->used[area] * sizeof (struct glyph));
1295    
1296    /* Increment buffer positions in TO by DELTA.  */    /* Increment buffer positions in TO by DELTA.  */
# Line 1383  line_hash_code (row) Line 1383  line_hash_code (row)
1383       struct glyph_row *row;       struct glyph_row *row;
1384  {  {
1385    int hash = 0;    int hash = 0;
1386      
1387    if (row->enabled_p)    if (row->enabled_p)
1388      {      {
1389        struct glyph *glyph = row->glyphs[TEXT_AREA];        struct glyph *glyph = row->glyphs[TEXT_AREA];
# Line 1431  line_draw_cost (matrix, vpos) Line 1431  line_draw_cost (matrix, vpos)
1431        while (end > beg && CHAR_GLYPH_SPACE_P (*(end - 1)))        while (end > beg && CHAR_GLYPH_SPACE_P (*(end - 1)))
1432          --end;          --end;
1433    
1434        /* All blank line.  */              /* All blank line.  */
1435        if (end == beg)        if (end == beg)
1436          return 0;          return 0;
1437    
# Line 1452  line_draw_cost (matrix, vpos) Line 1452  line_draw_cost (matrix, vpos)
1452        while (beg < end)        while (beg < end)
1453          {          {
1454            GLYPH g = GLYPH_FROM_CHAR_GLYPH (*beg);            GLYPH g = GLYPH_FROM_CHAR_GLYPH (*beg);
1455              
1456            if (g < 0            if (g < 0
1457                || GLYPH_SIMPLE_P (glyph_table_base, glyph_table_len, g))                || GLYPH_SIMPLE_P (glyph_table_base, glyph_table_len, g))
1458              len += 1;              len += 1;
1459            else            else
1460              len += GLYPH_LENGTH (glyph_table_base, g);              len += GLYPH_LENGTH (glyph_table_base, g);
1461              
1462            ++beg;            ++beg;
1463          }          }
1464      }      }
1465      
1466    return len;    return len;
1467  }  }
1468    
# Line 1473  line_draw_cost (matrix, vpos) Line 1473  line_draw_cost (matrix, vpos)
1473     visibility.  MOUSE_FACE_P non-zero means compare the mouse_face_p     visibility.  MOUSE_FACE_P non-zero means compare the mouse_face_p
1474     flags of A and B, too.  */     flags of A and B, too.  */
1475    
1476  static INLINE int  static INLINE int
1477  row_equal_p (w, a, b, mouse_face_p)  row_equal_p (w, a, b, mouse_face_p)
1478       struct window *w;       struct window *w;
1479       struct glyph_row *a, *b;       struct glyph_row *a, *b;
# Line 1496  row_equal_p (w, a, b, mouse_face_p) Line 1496  row_equal_p (w, a, b, mouse_face_p)
1496          {          {
1497            if (a->used[area] != b->used[area])            if (a->used[area] != b->used[area])
1498              return 0;              return 0;
1499              
1500            a_glyph = a->glyphs[area];            a_glyph = a->glyphs[area];
1501            a_end = a_glyph + a->used[area];            a_end = a_glyph + a->used[area];
1502            b_glyph = b->glyphs[area];            b_glyph = b->glyphs[area];
1503              
1504            while (a_glyph < a_end            while (a_glyph < a_end
1505                   && GLYPH_EQUAL_P (a_glyph, b_glyph))                   && GLYPH_EQUAL_P (a_glyph, b_glyph))
1506              ++a_glyph, ++b_glyph;              ++a_glyph, ++b_glyph;
1507              
1508            if (a_glyph != a_end)            if (a_glyph != a_end)
1509              return 0;              return 0;
1510          }          }
# Line 1551  new_glyph_pool () Line 1551  new_glyph_pool ()
1551    /* Allocate a new glyph_pool and clear it.  */    /* Allocate a new glyph_pool and clear it.  */
1552    result = (struct glyph_pool *) xmalloc (sizeof *result);    result = (struct glyph_pool *) xmalloc (sizeof *result);
1553    bzero (result, sizeof *result);    bzero (result, sizeof *result);
1554      
1555    /* For memory leak and double deletion checking.  */    /* For memory leak and double deletion checking.  */
1556    ++glyph_pool_count;    ++glyph_pool_count;
1557      
1558    return result;    return result;
1559  }  }
1560    
# Line 1626  realloc_glyph_pool (pool, matrix_dim) Line 1626  realloc_glyph_pool (pool, matrix_dim)
1626       determine pointers to rows of window sub-matrices.  */       determine pointers to rows of window sub-matrices.  */
1627    pool->nrows = matrix_dim.height;    pool->nrows = matrix_dim.height;
1628    pool->ncolumns = matrix_dim.width;    pool->ncolumns = matrix_dim.width;
1629      
1630    return changed_p;    return changed_p;
1631  }  }
1632    
# Line 1659  check_matrix_pointer_lossage (matrix) Line 1659  check_matrix_pointer_lossage (matrix)
1659       struct glyph_matrix *matrix;       struct glyph_matrix *matrix;
1660  {  {
1661    int i, j;    int i, j;
1662      
1663    for (i = 0; i < matrix->nrows; ++i)    for (i = 0; i < matrix->nrows; ++i)
1664      for (j = 0; j < matrix->nrows; ++j)      for (j = 0; j < matrix->nrows; ++j)
1665        xassert (i == j        xassert (i == j
# Line 1684  matrix_row (matrix, row) Line 1684  matrix_row (matrix, row)
1684  #if 0  #if 0
1685    check_matrix_pointer_lossage (matrix);    check_matrix_pointer_lossage (matrix);
1686  #endif  #endif
1687      
1688    return matrix->rows + row;    return matrix->rows + row;
1689  }  }
1690    
# Line 1707  check_matrix_invariants (w) Line 1707  check_matrix_invariants (w)
1707    struct buffer *saved = current_buffer;    struct buffer *saved = current_buffer;
1708    struct buffer *buffer = XBUFFER (w->buffer);    struct buffer *buffer = XBUFFER (w->buffer);
1709    int c;    int c;
1710      
1711    /* This can sometimes happen for a fresh window.  */    /* This can sometimes happen for a fresh window.  */
1712    if (matrix->nrows < 2)    if (matrix->nrows < 2)
1713      return;      return;
# Line 1870  allocate_matrices_for_frame_redisplay (w Line 1870  allocate_matrices_for_frame_redisplay (w
1870         && !NILP (XWINDOW (XWINDOW (window)->parent)->hchild));         && !NILP (XWINDOW (XWINDOW (window)->parent)->hchild));
1871    
1872    /* For WINDOW and all windows on the same level.  */    /* For WINDOW and all windows on the same level.  */
1873    do    do
1874      {      {
1875        w = XWINDOW (window);        w = XWINDOW (window);
1876    
1877        /* Get the dimension of the window sub-matrix for W, depending        /* Get the dimension of the window sub-matrix for W, depending
1878           on whether this is a combination or a leaf window.  */           on whether this is a combination or a leaf window.  */
1879        if (!NILP (w->hchild))        if (!NILP (w->hchild))
1880          dim = allocate_matrices_for_frame_redisplay (w->hchild, x, y,          dim = allocate_matrices_for_frame_redisplay (w->hchild, x, y,
1881                                                       dim_only_p,                                                       dim_only_p,
1882                                                       window_change_flags);                                                       window_change_flags);
1883        else if (!NILP (w->vchild))        else if (!NILP (w->vchild))
1884          dim = allocate_matrices_for_frame_redisplay (w->vchild, x, y,          dim = allocate_matrices_for_frame_redisplay (w->vchild, x, y,
1885                                                       dim_only_p,                                                       dim_only_p,
1886                                                       window_change_flags);                                                       window_change_flags);
1887        else        else
# Line 1893  allocate_matrices_for_frame_redisplay (w Line 1893  allocate_matrices_for_frame_redisplay (w
1893                w->current_matrix = new_glyph_matrix (f->current_pool);                w->current_matrix = new_glyph_matrix (f->current_pool);
1894                *window_change_flags |= NEW_LEAF_MATRIX;                *window_change_flags |= NEW_LEAF_MATRIX;
1895              }              }
1896      
1897            /* Width and height MUST be chosen so that there are no            /* Width and height MUST be chosen so that there are no
1898               holes in the frame matrix.  */               holes in the frame matrix.  */
1899            dim.width = required_matrix_width (w);            dim.width = required_matrix_width (w);
# Line 1929  allocate_matrices_for_frame_redisplay (w Line 1929  allocate_matrices_for_frame_redisplay (w
1929           below W.  */           below W.  */
1930        if (in_horz_combination_p)        if (in_horz_combination_p)
1931          x += dim.width;          x += dim.width;
1932        else        else
1933          y += dim.height;          y += dim.height;
1934    
1935        /* Remember maximum glyph matrix dimensions.  */        /* Remember maximum glyph matrix dimensions.  */
# Line 1952  allocate_matrices_for_frame_redisplay (w Line 1952  allocate_matrices_for_frame_redisplay (w
1952        total.width = x - x0;        total.width = x - x0;
1953        total.height = hmax;        total.height = hmax;
1954      }      }
1955    else    else
1956      {      {
1957        total.width = wmax;        total.width = wmax;
1958        total.height = y - y0;        total.height = y - y0;
# Line 1970  required_matrix_height (w) Line 1970  required_matrix_height (w)
1970  {  {
1971  #ifdef HAVE_WINDOW_SYSTEM  #ifdef HAVE_WINDOW_SYSTEM
1972    struct frame *f = XFRAME (w->frame);    struct frame *f = XFRAME (w->frame);
1973      
1974    if (FRAME_WINDOW_P (f))    if (FRAME_WINDOW_P (f))
1975      {      {
1976        int ch_height = FRAME_SMALLEST_FONT_HEIGHT (f);        int ch_height = FRAME_SMALLEST_FONT_HEIGHT (f);
# Line 1984  required_matrix_height (w) Line 1984  required_matrix_height (w)
1984                + 2);                + 2);
1985      }      }
1986  #endif /* HAVE_WINDOW_SYSTEM */  #endif /* HAVE_WINDOW_SYSTEM */
1987          
1988    return XINT (w->height);    return XINT (w->height);
1989  }  }
1990    
# Line 2001  required_matrix_width (w) Line 2001  required_matrix_width (w)
2001      {      {
2002        int ch_width = FRAME_SMALLEST_CHAR_WIDTH (f);        int ch_width = FRAME_SMALLEST_CHAR_WIDTH (f);
2003        int window_pixel_width = XFLOATINT (w->width) * CANON_X_UNIT (f);        int window_pixel_width = XFLOATINT (w->width) * CANON_X_UNIT (f);
2004      
2005        /* Compute number of glyphs needed in a glyph row.  */        /* Compute number of glyphs needed in a glyph row.  */
2006        return (((window_pixel_width + ch_width - 1)        return (((window_pixel_width + ch_width - 1)
2007                 / ch_width)                 / ch_width)
# Line 2020  required_matrix_width (w) Line 2020  required_matrix_width (w)
2020  /* Allocate window matrices for window-based redisplay.  W is the  /* Allocate window matrices for window-based redisplay.  W is the
2021     window whose matrices must be allocated/reallocated.  CH_DIM is the     window whose matrices must be allocated/reallocated.  CH_DIM is the
2022     size of the smallest character that could potentially be used on W.  */     size of the smallest character that could potentially be used on W.  */
2023      
2024  static void  static void
2025  allocate_matrices_for_window_redisplay (w)  allocate_matrices_for_window_redisplay (w)
2026       struct window *w;       struct window *w;
# Line 2048  allocate_matrices_for_window_redisplay ( Line 2048  allocate_matrices_for_window_redisplay (
2048            adjust_glyph_matrix (w, w->desired_matrix, 0, 0, dim);            adjust_glyph_matrix (w, w->desired_matrix, 0, 0, dim);
2049            adjust_glyph_matrix (w, w->current_matrix, 0, 0, dim);            adjust_glyph_matrix (w, w->current_matrix, 0, 0, dim);
2050          }          }
2051          
2052        w = NILP (w->next) ? NULL : XWINDOW (w->next);        w = NILP (w->next) ? NULL : XWINDOW (w->next);
2053      }      }
2054  }  }
# Line 2072  adjust_glyphs (f) Line 2072  adjust_glyphs (f)
2072    else    else
2073      {      {
2074        Lisp_Object tail, lisp_frame;        Lisp_Object tail, lisp_frame;
2075          
2076        FOR_EACH_FRAME (tail, lisp_frame)        FOR_EACH_FRAME (tail, lisp_frame)
2077          adjust_frame_glyphs (XFRAME (lisp_frame));          adjust_frame_glyphs (XFRAME (lisp_frame));
2078      }      }
# Line 2082  adjust_glyphs (f) Line 2082  adjust_glyphs (f)
2082    
2083    
2084  /* Adjust frame glyphs when Emacs is initialized.  /* Adjust frame glyphs when Emacs is initialized.
2085      
2086     To be called from init_display.     To be called from init_display.
2087      
2088     We need a glyph matrix because redraw will happen soon.     We need a glyph matrix because redraw will happen soon.
2089     Unfortunately, window sizes on selected_frame are not yet set to     Unfortunately, window sizes on selected_frame are not yet set to
2090     meaningful values.  I believe we can assume that there are only two     meaningful values.  I believe we can assume that there are only two
# Line 2115  adjust_frame_glyphs_initially () Line 2115  adjust_frame_glyphs_initially ()
2115    adjust_frame_glyphs (sf);    adjust_frame_glyphs (sf);
2116    glyphs_initialized_initially_p = 1;    glyphs_initialized_initially_p = 1;
2117  }  }
2118      
2119    
2120  /* Allocate/reallocate glyph matrices of a single frame F.  */  /* Allocate/reallocate glyph matrices of a single frame F.  */
2121    
# Line 2127  adjust_frame_glyphs (f) Line 2127  adjust_frame_glyphs (f)
2127      adjust_frame_glyphs_for_window_redisplay (f);      adjust_frame_glyphs_for_window_redisplay (f);
2128    else    else
2129      adjust_frame_glyphs_for_frame_redisplay (f);      adjust_frame_glyphs_for_frame_redisplay (f);
2130      
2131    /* Don't forget the message buffer and the buffer for    /* Don't forget the message buffer and the buffer for
2132       decode_mode_spec.  */       decode_mode_spec.  */
2133    adjust_frame_message_buffer (f);    adjust_frame_message_buffer (f);
# Line 2145  fake_current_matrices (window) Line 2145  fake_current_matrices (window)
2145       Lisp_Object window;       Lisp_Object window;
2146  {  {
2147    struct window *w;    struct window *w;
2148          
2149    for (; !NILP (window); window = w->next)    for (; !NILP (window); window = w->next)
2150      {      {
2151        w = XWINDOW (window);        w = XWINDOW (window);
2152          
2153        if (!NILP (w->hchild))        if (!NILP (w->hchild))
2154          fake_current_matrices (w->hchild);          fake_current_matrices (w->hchild);
2155        else if (!NILP (w->vchild))        else if (!NILP (w->vchild))
# Line 2163  fake_current_matrices (window) Line 2163  fake_current_matrices (window)
2163    
2164            xassert (m->matrix_h == XFASTINT (w->height));            xassert (m->matrix_h == XFASTINT (w->height));
2165            xassert (m->matrix_w == XFASTINT (w->width));            xassert (m->matrix_w == XFASTINT (w->width));
2166              
2167            for (i = 0; i < m->matrix_h; ++i)            for (i = 0; i < m->matrix_h; ++i)
2168              {              {
2169                struct glyph_row *r = m->rows + i;                struct glyph_row *r = m->rows + i;
# Line 2238  restore_current_matrix (f, saved) Line 2238  restore_current_matrix (f, saved)
2238        to->used[TEXT_AREA] = from->used[TEXT_AREA];        to->used[TEXT_AREA] = from->used[TEXT_AREA];
2239        xfree (from->glyphs[TEXT_AREA]);        xfree (from->glyphs[TEXT_AREA]);
2240      }      }
2241      
2242    xfree (saved->rows);    xfree (saved->rows);
2243    xfree (saved);    xfree (saved);
2244  }  }
# Line 2264  adjust_frame_glyphs_for_frame_redisplay Line 2264  adjust_frame_glyphs_for_frame_redisplay
2264    /* Determine the smallest character in any font for F.  On    /* Determine the smallest character in any font for F.  On
2265       console windows, all characters have dimension (1, 1).  */       console windows, all characters have dimension (1, 1).  */
2266    ch_dim.width = ch_dim.height = 1;    ch_dim.width = ch_dim.height = 1;
2267      
2268    top_window_y = FRAME_TOP_MARGIN (f);    top_window_y = FRAME_TOP_MARGIN (f);
2269    
2270    /* Allocate glyph pool structures if not already done.  */    /* Allocate glyph pool structures if not already done.  */
# Line 2280  adjust_frame_glyphs_for_frame_redisplay Line 2280  adjust_frame_glyphs_for_frame_redisplay
2280        f->desired_matrix = new_glyph_matrix (f->desired_pool);        f->desired_matrix = new_glyph_matrix (f->desired_pool);
2281        f->current_matrix = new_glyph_matrix (f->current_pool);        f->current_matrix = new_glyph_matrix (f->current_pool);
2282      }      }
2283      
2284    /* Compute window glyph matrices.  (This takes the mini-buffer    /* Compute window glyph matrices.  (This takes the mini-buffer
2285       window into account).  The result is the size of the frame glyph       window into account).  The result is the size of the frame glyph
2286       matrix needed.  The variable window_change_flags is set to a bit       matrix needed.  The variable window_change_flags is set to a bit
# Line 2301  adjust_frame_glyphs_for_frame_redisplay Line 2301  adjust_frame_glyphs_for_frame_redisplay
2301    pool_changed_p = realloc_glyph_pool (f->desired_pool, matrix_dim);    pool_changed_p = realloc_glyph_pool (f->desired_pool, matrix_dim);
2302    realloc_glyph_pool (f->current_pool, matrix_dim);    realloc_glyph_pool (f->current_pool, matrix_dim);
2303    
2304    /* Set up glyph pointers within window matrices.  Do this only if    /* Set up glyph pointers within window matrices.  Do this only if
2305       absolutely necessary since it requires a frame redraw.  */       absolutely necessary since it requires a frame redraw.  */
2306    if (pool_changed_p || window_change_flags)    if (pool_changed_p || window_change_flags)
2307      {      {
# Line 2315  adjust_frame_glyphs_for_frame_redisplay Line 2315  adjust_frame_glyphs_for_frame_redisplay
2315           to the frame width (from CHANGE_FRAME_SIZE_1).  */           to the frame width (from CHANGE_FRAME_SIZE_1).  */
2316        xassert (matrix_dim.width == FRAME_WIDTH (f)        xassert (matrix_dim.width == FRAME_WIDTH (f)
2317                 && matrix_dim.height == FRAME_HEIGHT (f));                 && matrix_dim.height == FRAME_HEIGHT (f));
2318      
2319        /* Pointers to glyph memory in glyph rows are exchanged during        /* Pointers to glyph memory in glyph rows are exchanged during
2320           the update phase of redisplay, which means in general that a           the update phase of redisplay, which means in general that a
2321           frame's current matrix consists of pointers into both the           frame's current matrix consists of pointers into both the
# Line 2357  adjust_frame_glyphs_for_window_redisplay Line 2357  adjust_frame_glyphs_for_window_redisplay
2357    struct window *w;    struct window *w;
2358    
2359    xassert (FRAME_WINDOW_P (f) && FRAME_LIVE_P (f));    xassert (FRAME_WINDOW_P (f) && FRAME_LIVE_P (f));
2360      
2361    /* Get minimum sizes.  */    /* Get minimum sizes.  */
2362  #ifdef HAVE_WINDOW_SYSTEM  #ifdef HAVE_WINDOW_SYSTEM
2363    ch_dim.width = FRAME_SMALLEST_CHAR_WIDTH (f);    ch_dim.width = FRAME_SMALLEST_CHAR_WIDTH (f);
# Line 2365  adjust_frame_glyphs_for_window_redisplay Line 2365  adjust_frame_glyphs_for_window_redisplay
2365  #else  #else
2366    ch_dim.width = ch_dim.height = 1;    ch_dim.width = ch_dim.height = 1;
2367  #endif  #endif
2368        
2369    /* Allocate/reallocate window matrices.  */    /* Allocate/reallocate window matrices.  */
2370    allocate_matrices_for_window_redisplay (XWINDOW (FRAME_ROOT_WINDOW (f)));    allocate_matrices_for_window_redisplay (XWINDOW (FRAME_ROOT_WINDOW (f)));
2371    
# Line 2416  adjust_frame_glyphs_for_window_redisplay Line 2416  adjust_frame_glyphs_for_window_redisplay
2416  }  }
2417    
2418    
2419  /* Adjust/ allocate message buffer of frame F.  /* Adjust/ allocate message buffer of frame F.
2420    
2421     Note that the message buffer is never freed.  Since I could not     Note that the message buffer is never freed.  Since I could not
2422     find a free in 19.34, I assume that freeing it would be     find a free in 19.34, I assume that freeing it would be
# Line 2474  free_glyphs (f) Line 2474  free_glyphs (f)
2474           event while we're in an inconsistent state.  */           event while we're in an inconsistent state.  */
2475        BLOCK_INPUT;        BLOCK_INPUT;
2476        f->glyphs_initialized_p = 0;        f->glyphs_initialized_p = 0;
2477          
2478        /* Release window sub-matrices.  */        /* Release window sub-matrices.  */
2479        if (!NILP (f->root_window))        if (!NILP (f->root_window))
2480          free_window_matrices (XWINDOW (f->root_window));          free_window_matrices (XWINDOW (f->root_window));
# Line 2516  free_glyphs (f) Line 2516  free_glyphs (f)
2516            free_glyph_pool (f->current_pool);            free_glyph_pool (f->current_pool);
2517            f->desired_pool = f->current_pool = NULL;            f->desired_pool = f->current_pool = NULL;
2518          }          }
2519          
2520        UNBLOCK_INPUT;        UNBLOCK_INPUT;
2521      }      }
2522  }  }
# Line 2536  free_window_matrices (w) Line 2536  free_window_matrices (w)
2536          free_window_matrices (XWINDOW (w->hchild));          free_window_matrices (XWINDOW (w->hchild));
2537        else if (!NILP (w->vchild))        else if (!NILP (w->vchild))
2538          free_window_matrices (XWINDOW (w->vchild));          free_window_matrices (XWINDOW (w->vchild));
2539        else        else
2540          {          {
2541            /* This is a leaf window.  Free its memory and reset fields            /* This is a leaf window.  Free its memory and reset fields
2542               to zero in case this function is called a second time for               to zero in case this function is called a second time for
# Line 2611  check_glyph_memory () Line 2611  check_glyph_memory ()
2611     up glyph lengths of the window matrices.  A line in the frame     up glyph lengths of the window matrices.  A line in the frame
2612     matrix is enabled, if a corresponding line in a window matrix is     matrix is enabled, if a corresponding line in a window matrix is
2613     enabled.     enabled.
2614      
2615     After building the desired frame matrix, it will be passed to     After building the desired frame matrix, it will be passed to
2616     terminal code, which will manipulate both the desired and current     terminal code, which will manipulate both the desired and current
2617     frame matrix.  Changes applied to the frame's current matrix have     frame matrix.  Changes applied to the frame's current matrix have
# Line 2624  check_glyph_memory () Line 2624  check_glyph_memory ()
2624     contents needed in a frame matrix.  Thus, any modification of     contents needed in a frame matrix.  Thus, any modification of
2625     glyphs done in terminal code will be reflected in window matrices     glyphs done in terminal code will be reflected in window matrices
2626     automatically.     automatically.
2627      
2628     2. Exchanges of rows in a frame matrix done by terminal code are     2. Exchanges of rows in a frame matrix done by terminal code are
2629     intercepted by hook functions so that corresponding row operations     intercepted by hook functions so that corresponding row operations
2630     on window matrices can be performed.  This is necessary because we     on window matrices can be performed.  This is necessary because we
# Line 2649  build_frame_matrix (f) Line 2649  build_frame_matrix (f)
2649    
2650    /* F must have a frame matrix when this function is called.  */    /* F must have a frame matrix when this function is called.  */
2651    xassert (!FRAME_WINDOW_P (f));    xassert (!FRAME_WINDOW_P (f));
2652      
2653    /* Clear all rows in the frame matrix covered by window matrices.    /* Clear all rows in the frame matrix covered by window matrices.
2654       Menu bar lines are not covered by windows.  */       Menu bar lines are not covered by windows.  */
2655    for (i = FRAME_TOP_MARGIN (f); i < f->desired_matrix->nrows; ++i)    for (i = FRAME_TOP_MARGIN (f); i < f->desired_matrix->nrows; ++i)
# Line 2747  build_frame_matrix_from_leaf_window (fra Line 2747  build_frame_matrix_from_leaf_window (fra
2747            window_row = w->current_matrix->rows + window_y;            window_row = w->current_matrix->rows + window_y;
2748            current_row_p = 1;            current_row_p = 1;
2749          }          }
2750          
2751        if (current_row_p)        if (current_row_p)
2752          {          {
2753            /* Copy window row to frame row.  */            /* Copy window row to frame row.  */
# Line 2758  build_frame_matrix_from_leaf_window (fra Line 2758  build_frame_matrix_from_leaf_window (fra
2758        else        else
2759          {          {
2760            xassert (window_row->enabled_p);            xassert (window_row->enabled_p);
2761              
2762            /* Only when a desired row has been displayed, we want            /* Only when a desired row has been displayed, we want
2763               the corresponding frame row to be updated.  */               the corresponding frame row to be updated.  */
2764            frame_row->enabled_p = 1;            frame_row->enabled_p = 1;
2765              
2766            /* Maybe insert a vertical border between horizontally adjacent            /* Maybe insert a vertical border between horizontally adjacent
2767               windows.  */               windows.  */
2768            if (right_border_glyph)            if (right_border_glyph)
# Line 2774  build_frame_matrix_from_leaf_window (fra Line 2774  build_frame_matrix_from_leaf_window (fra
2774            /* Window row window_y must be a slice of frame row            /* Window row window_y must be a slice of frame row
2775               frame_y.  */               frame_y.  */
2776            xassert (glyph_row_slice_p (window_row, frame_row));            xassert (glyph_row_slice_p (window_row, frame_row));
2777              
2778            /* If rows are in sync, we don't have to copy glyphs because            /* If rows are in sync, we don't have to copy glyphs because
2779               frame and window share glyphs.  */               frame and window share glyphs.  */
2780              
2781  #if GLYPH_DEBUG  #if GLYPH_DEBUG
2782            strcpy (w->current_matrix->method, w->desired_matrix->method);            strcpy (w->current_matrix->method, w->desired_matrix->method);
2783            add_window_display_history (w, w->current_matrix->method, 0);            add_window_display_history (w, w->current_matrix->method, 0);
# Line 2787  build_frame_matrix_from_leaf_window (fra Line 2787  build_frame_matrix_from_leaf_window (fra
2787        /* Set number of used glyphs in the frame matrix.  Since we fill        /* Set number of used glyphs in the frame matrix.  Since we fill
2788           up with spaces, and visit leaf windows from left to right it           up with spaces, and visit leaf windows from left to right it
2789           can be done simply.  */           can be done simply.  */
2790        frame_row->used[TEXT_AREA]        frame_row->used[TEXT_AREA]
2791          = window_matrix->matrix_x + window_matrix->matrix_w;          = window_matrix->matrix_x + window_matrix->matrix_w;
2792    
2793        /* Next row.  */        /* Next row.  */
# Line 2853  fill_up_frame_row_with_spaces (row, upto Line 2853  fill_up_frame_row_with_spaces (row, upto
2853  {  {
2854    int i = row->used[TEXT_AREA];    int i = row->used[TEXT_AREA];
2855    struct glyph *glyph = row->glyphs[TEXT_AREA];    struct glyph *glyph = row->glyphs[TEXT_AREA];
2856      
2857    while (i < upto)    while (i < upto)
2858      glyph[i++] = space_glyph;      glyph[i++] = space_glyph;
2859    
# Line 2949  mirror_make_current (w, frame_row) Line 2949  mirror_make_current (w, frame_row)
2949                current_row->enabled_p = 1;                current_row->enabled_p = 1;
2950              }              }
2951          }          }
2952          
2953        w = NILP (w->next) ? 0 : XWINDOW (w->next);        w = NILP (w->next) ? 0 : XWINDOW (w->next);
2954      }      }
2955  }  }
# Line 2964  mirror_make_current (w, frame_row) Line 2964  mirror_make_current (w, frame_row)
2964     row 0 <= I < NLINES which is empty.     row 0 <= I < NLINES which is empty.
2965    
2966     This function is called from do_scrolling and do_direct_scrolling.  */     This function is called from do_scrolling and do_direct_scrolling.  */
2967      
2968  void  void
2969  mirrored_line_dance (matrix, unchanged_at_top, nlines, copy_from,  mirrored_line_dance (matrix, unchanged_at_top, nlines, copy_from,
2970                       retained_p)                       retained_p)
# Line 2978  mirrored_line_dance (matrix, unchanged_a Line 2978  mirrored_line_dance (matrix, unchanged_a
2978    
2979    /* Rows to assign to.  */    /* Rows to assign to.  */
2980    struct glyph_row *new_rows = MATRIX_ROW (matrix, unchanged_at_top);    struct glyph_row *new_rows = MATRIX_ROW (matrix, unchanged_at_top);
2981      
2982    int i;    int i;
2983    
2984    /* Make a copy of the original rows.  */    /* Make a copy of the original rows.  */
# Line 3030  sync_window_with_frame_matrix_rows (w) Line 3030  sync_window_with_frame_matrix_rows (w)
3030    window_row = w->current_matrix->rows;    window_row = w->current_matrix->rows;
3031    window_row_end = window_row + w->current_matrix->nrows;    window_row_end = window_row + w->current_matrix->nrows;
3032    frame_row = f->current_matrix->rows + XFASTINT (w->top);    frame_row = f->current_matrix->rows + XFASTINT (w->top);
3033      
3034    for (; window_row < window_row_end; ++window_row, ++frame_row)    for (; window_row < window_row_end; ++window_row, ++frame_row)
3035      {      {
3036        window_row->glyphs[LEFT_MARGIN_AREA]        window_row->glyphs[LEFT_MARGIN_AREA]
# Line 3054  frame_row_to_window (w, row) Line 3054  frame_row_to_window (w, row)
3054       int row;       int row;
3055  {  {
3056    struct window *found = NULL;    struct window *found = NULL;
3057      
3058    while (w && !found)    while (w && !found)
3059      {      {
3060        if (!NILP (w->hchild))        if (!NILP (w->hchild))
# Line 3064  frame_row_to_window (w, row) Line 3064  frame_row_to_window (w, row)
3064        else if (row >= XFASTINT (w->top)        else if (row >= XFASTINT (w->top)
3065                 && row < XFASTINT (w->top) + XFASTINT (w->height))                 && row < XFASTINT (w->top) + XFASTINT (w->height))
3066          found = w;          found = w;
3067          
3068        w = NILP (w->next) ? 0 : XWINDOW (w->next);        w = NILP (w->next) ? 0 : XWINDOW (w->next);
3069      }      }
3070    
# Line 3114  mirror_line_dance (w, unchanged_at_top, Line 3114  mirror_line_dance (w, unchanged_at_top,
3114              {              {
3115                /* Frame relative line assigned to.  */                /* Frame relative line assigned to.  */
3116                int frame_to = i + unchanged_at_top;                int frame_to = i + unchanged_at_top;
3117                  
3118                /* Frame relative line assigned.  */                /* Frame relative line assigned.  */
3119                int frame_from = copy_from[i] + unchanged_at_top;                int frame_from = copy_from[i] + unchanged_at_top;
3120                  
3121                /* Window relative line assigned to.  */                /* Window relative line assigned to.  */
3122                int window_to = frame_to - m->matrix_y;                int window_to = frame_to - m->matrix_y;
3123                  
3124                /* Window relative line assigned.  */                /* Window relative line assigned.  */
3125                int window_from = frame_from - m->matrix_y;                int window_from = frame_from - m->matrix_y;
3126                  
3127                /* Is assigned line inside window?  */                /* Is assigned line inside window?  */
3128                int from_inside_window_p                int from_inside_window_p
3129                  = window_from >= 0 && window_from < m->matrix_h;                  = window_from >= 0 && window_from < m->matrix_h;
3130                  
3131                /* Is assigned to line inside window?  */                /* Is assigned to line inside window?  */
3132                int to_inside_window_p                int to_inside_window_p
3133                  = window_to >= 0 && window_to < m->matrix_h;                  = window_to >= 0 && window_to < m->matrix_h;
3134                  
3135                if (from_inside_window_p && to_inside_window_p)                if (from_inside_window_p && to_inside_window_p)
3136                  {                  {
3137                    /* Enabled setting before assignment.  */                    /* Enabled setting before assignment.  */
3138                    int enabled_before_p;                    int enabled_before_p;
3139                      
3140                    /* Do the assignment.  The enabled_p flag is saved                    /* Do the assignment.  The enabled_p flag is saved
3141                       over the assignment because the old redisplay did                       over the assignment because the old redisplay did
3142                       that.  */                       that.  */
3143                    enabled_before_p = m->rows[window_to].enabled_p;                    enabled_before_p = m->rows[window_to].enabled_p;
3144                    m->rows[window_to] = old_rows[window_from];                    m->rows[window_to] = old_rows[window_from];
3145                    m->rows[window_to].enabled_p = enabled_before_p;                    m->rows[window_to].enabled_p = enabled_before_p;
3146                      
3147                    /* If frame line is empty, window line is empty, too.  */                    /* If frame line is empty, window line is empty, too.  */
3148                    if (!retained_p[copy_from[i]])                    if (!retained_p[copy_from[i]])
3149                      m->rows[window_to].enabled_p = 0;                      m->rows[window_to].enabled_p = 0;
# Line 3163  mirror_line_dance (w, unchanged_at_top, Line 3163  mirror_line_dance (w, unchanged_at_top,
3163                    m2_from = frame_from - m2->matrix_y;                    m2_from = frame_from - m2->matrix_y;
3164                    copy_row_except_pointers (m->rows + window_to,                    copy_row_except_pointers (m->rows + window_to,
3165                                              m2->rows + m2_from);                                              m2->rows + m2_from);
3166                      
3167                    /* If frame line is empty, window line is empty, too.  */                    /* If frame line is empty, window line is empty, too.  */
3168                    if (!retained_p[copy_from[i]])                    if (!retained_p[copy_from[i]])
3169                      m->rows[window_to].enabled_p = 0;                      m->rows[window_to].enabled_p = 0;
# Line 3177  mirror_line_dance (w, unchanged_at_top, Line 3177  mirror_line_dance (w, unchanged_at_top,
3177               pointers are in sync with the frame matrix.  */               pointers are in sync with the frame matrix.  */
3178            if (sync_p)            if (sync_p)
3179              sync_window_with_frame_matrix_rows (w);              sync_window_with_frame_matrix_rows (w);
3180              
3181            /* Check that no pointers are lost.  */            /* Check that no pointers are lost.  */
3182            CHECK_MATRIX (m);            CHECK_MATRIX (m);
3183          }          }
# Line 3212  check_window_matrix_pointers (w) Line 3212  check_window_matrix_pointers (w)
3212            check_matrix_pointers (w->desired_matrix, f->desired_matrix);            check_matrix_pointers (w->desired_matrix, f->desired_matrix);
3213            check_matrix_pointers (w->current_matrix, f->current_matrix);            check_matrix_pointers (w->current_matrix, f->current_matrix);
3214          }          }
3215          
3216        w = NILP (w->next) ? 0 : XWINDOW (w->next);        w = NILP (w->next) ? 0 : XWINDOW (w->next);
3217      }      }
3218  }  }
# Line 3233  check_matrix_pointers (window_matrix, fr Line 3233  check_matrix_pointers (window_matrix, fr
3233    /* Row number corresponding to I in FRAME_MATRIX.  */    /* Row number corresponding to I in FRAME_MATRIX.  */
3234    int j = window_matrix->matrix_y;    int j = window_matrix->matrix_y;
3235    
3236    /* For all rows check that the row in the window matrix is a    /* For all rows check that the row in the window matrix is a
3237       slice of the row in the frame matrix.  If it isn't we didn't       slice of the row in the frame matrix.  If it isn't we didn't
3238       mirror an operation on the frame matrix correctly.  */       mirror an operation on the frame matrix correctly.  */
3239    while (i < window_matrix->nrows)    while (i < window_matrix->nrows)
# Line 3264  window_to_frame_vpos (w, vpos) Line 3264  window_to_frame_vpos (w, vpos)
3264       int vpos;       int vpos;
3265  {  {
3266    struct frame *f = XFRAME (w->frame);    struct frame *f = XFRAME (w->frame);
3267      
3268    xassert (!FRAME_WINDOW_P (f));    xassert (!FRAME_WINDOW_P (f));
3269    xassert (vpos >= 0 && vpos <= w->desired_matrix->nrows);    xassert (vpos >= 0 && vpos <= w->desired_matrix->nrows);
3270    vpos += XFASTINT (w->top);    vpos += XFASTINT (w->top);
# Line 3282  window_to_frame_hpos (w, hpos) Line 3282  window_to_frame_hpos (w, hpos)
3282       int hpos;       int hpos;
3283  {  {
3284    struct frame *f = XFRAME (w->frame);    struct frame *f = XFRAME (w->frame);
3285      
3286    xassert (!FRAME_WINDOW_P (f));    xassert (!FRAME_WINDOW_P (f));
3287    hpos += XFASTINT (w->left);    hpos += XFASTINT (w->left);
3288    return hpos;    return hpos;
3289  }  }
3290      
3291  #endif /* GLYPH_DEBUG */  #endif /* GLYPH_DEBUG */
3292    
3293    
# Line 3429  direct_output_for_insert (g) Line 3429  direct_output_for_insert (g)
3429           is handled specially there (see display_line).  */           is handled specially there (see display_line).  */
3430        || (MINI_WINDOW_P (w) && XFASTINT (w->hscroll))        || (MINI_WINDOW_P (w) && XFASTINT (w->hscroll))
3431        /* Give up if overwriting in the middle of a line.  */        /* Give up if overwriting in the middle of a line.  */
3432        || (overwrite_p        || (overwrite_p
3433            && PT != ZV            && PT != ZV
3434            && FETCH_BYTE (PT) != '\n')            && FETCH_BYTE (PT) != '\n')
3435        /* Give up for tabs and line ends.  */        /* Give up for tabs and line ends.  */
3436        || g == '\t'        || g == '\t'
# Line 3474  direct_output_for_insert (g) Line 3474  direct_output_for_insert (g)
3474    glyph_row = MATRIX_ROW (w->current_matrix, w->cursor.vpos);    glyph_row = MATRIX_ROW (w->current_matrix, w->cursor.vpos);
3475    if (glyph_row->mouse_face_p)    if (glyph_row->mouse_face_p)
3476      return 0;      return 0;
3477      
3478    /* Give up if highlighting trailing whitespace and we have trailing    /* Give up if highlighting trailing whitespace and we have trailing
3479       whitespace in glyph_row.  We would have to remove the trailing       whitespace in glyph_row.  We would have to remove the trailing
3480       whitespace face in that case.  */       whitespace face in that case.  */
# Line 3494  direct_output_for_insert (g) Line 3494  direct_output_for_insert (g)
3494       if the overlay string has newlines in it.  */       if the overlay string has newlines in it.  */
3495    if (STRINGP (it.string))    if (STRINGP (it.string))
3496      return 0;      return 0;
3497      
3498    it.hpos = w->cursor.hpos;    it.hpos = w->cursor.hpos;
3499    it.vpos = w->cursor.vpos;    it.vpos = w->cursor.vpos;
3500    it.current_x = w->cursor.x + it.first_visible_x;    it.current_x = w->cursor.x + it.first_visible_x;
# Line 3505  direct_output_for_insert (g) Line 3505  direct_output_for_insert (g)
3505    
3506    /* More than one display element may be returned for PT - 1 if    /* More than one display element may be returned for PT - 1 if
3507       (i) it's a control character which is translated into `\003' or       (i) it's a control character which is translated into `\003' or
3508       `^C', or (ii) it has a display table entry, or (iii) it's a       `^C', or (ii) it has a display table entry, or (iii) it's a
3509       combination of both.  */       combination of both.  */
3510    delta = delta_bytes = 0;    delta = delta_bytes = 0;
3511    while (get_next_display_element (&it))    while (get_next_display_element (&it))
# Line 3562  direct_output_for_insert (g) Line 3562  direct_output_for_insert (g)
3562    bcopy (it.glyph_row->glyphs[TEXT_AREA], glyphs, n * sizeof *glyphs);    bcopy (it.glyph_row->glyphs[TEXT_AREA], glyphs, n * sizeof *glyphs);
3563    glyph_row->used[TEXT_AREA] = min (glyph_row->used[TEXT_AREA] + n,    glyph_row->used[TEXT_AREA] = min (glyph_row->used[TEXT_AREA] + n,
3564                                      end - glyph_row->glyphs[TEXT_AREA]);                                      end - glyph_row->glyphs[TEXT_AREA]);
3565      
3566    /* Compute new line width.  */    /* Compute new line width.  */
3567    glyph = glyph_row->glyphs[TEXT_AREA];    glyph = glyph_row->glyphs[TEXT_AREA];
3568    end = glyph + glyph_row->used[TEXT_AREA];    end = glyph + glyph_row->used[TEXT_AREA];
# Line 3573  direct_output_for_insert (g) Line 3573  direct_output_for_insert (g)
3573        ++glyph;        ++glyph;
3574      }      }
3575    
3576    /* Increment buffer positions for glyphs following the newly    /* Increment buffer positions for glyphs following the newly
3577       inserted ones.  */       inserted ones.  */
3578    for (glyph = glyphs + n; glyph < end; ++glyph)    for (glyph = glyphs + n; glyph < end; ++glyph)
3579      if (glyph->charpos > 0 && BUFFERP (glyph->object))      if (glyph->charpos > 0 && BUFFERP (glyph->object))
3580        glyph->charpos += delta;        glyph->charpos += delta;
3581      
3582    if (MATRIX_ROW_END_CHARPOS (glyph_row) > 0)    if (MATRIX_ROW_END_CHARPOS (glyph_row) > 0)
3583      {      {
3584        MATRIX_ROW_END_CHARPOS (glyph_row) += delta;        MATRIX_ROW_END_CHARPOS (glyph_row) += delta;
3585        MATRIX_ROW_END_BYTEPOS (glyph_row) += delta_bytes;        MATRIX_ROW_END_BYTEPOS (glyph_row) += delta_bytes;
3586      }      }
3587          
3588    /* Adjust positions in lines following the one we are in.  */    /* Adjust positions in lines following the one we are in.  */
3589    increment_matrix_positions (w->current_matrix,    increment_matrix_positions (w->current_matrix,
3590                                w->cursor.vpos + 1,                                w->cursor.vpos + 1,
# Line 3611  direct_output_for_insert (g) Line 3611  direct_output_for_insert (g)
3611    if (rif)    if (rif)
3612      {      {
3613        rif->update_window_begin_hook (w);        rif->update_window_begin_hook (w);
3614          
3615        if (glyphs == end - n        if (glyphs == end - n
3616            /* In front of a space added by append_space.  */            /* In front of a space added by append_space.  */
3617            || (glyphs == end - n - 1            || (glyphs == end - n - 1
# Line 3684  direct_output_forward_char (n) Line 3684  direct_output_forward_char (n)
3684    /* Give up if face attributes have been changed.  */    /* Give up if face attributes have been changed.  */
3685    if (face_change_count)    if (face_change_count)
3686      return 0;      return 0;
3687      
3688    /* Give up if current matrix is not up to date or we are    /* Give up if current matrix is not up to date or we are
3689       displaying a message.  */       displaying a message.  */
3690    if (!display_completed || cursor_in_echo_area)    if (!display_completed || cursor_in_echo_area)
3691      return 0;      return 0;
# Line 3712  direct_output_forward_char (n) Line 3712  direct_output_forward_char (n)
3712    if (XWINDOW (minibuf_window) == w    if (XWINDOW (minibuf_window) == w
3713        && EQ (minibuf_window, echo_area_window))        && EQ (minibuf_window, echo_area_window))
3714      return 0;      return 0;
3715      
3716    /* Give up if we don't know where the cursor is.  */    /* Give up if we don't know where the cursor is.  */
3717    if (w->cursor.vpos < 0)    if (w->cursor.vpos < 0)
3718      return 0;      return 0;
# Line 3725  direct_output_forward_char (n) Line 3725  direct_output_forward_char (n)
3725      return 0;      return 0;
3726    
3727    set_cursor_from_row (w, row, w->current_matrix, 0, 0, 0, 0);    set_cursor_from_row (w, row, w->current_matrix, 0, 0, 0, 0);
3728      
3729    w->last_cursor = w->cursor;    w->last_cursor = w->cursor;
3730    XSETFASTINT (w->last_point, PT);    XSETFASTINT (w->last_point, PT);
3731    
3732    xassert (w->cursor.hpos >= 0    xassert (w->cursor.hpos >= 0
3733             && w->cursor.hpos < w->desired_matrix->matrix_w);             && w->cursor.hpos < w->desired_matrix->matrix_w);
3734      
3735    if (FRAME_WINDOW_P (f))    if (FRAME_WINDOW_P (f))
3736      rif->cursor_to (w->cursor.vpos, w->cursor.hpos,      rif->cursor_to (w->cursor.vpos, w->cursor.hpos,
3737                      w->cursor.y, w->cursor.x);                      w->cursor.y, w->cursor.x);
# Line 3745  direct_output_forward_char (n) Line 3745  direct_output_forward_char (n)
3745        y = WINDOW_TO_FRAME_VPOS (w, w->cursor.vpos);        y = WINDOW_TO_FRAME_VPOS (w, w->cursor.vpos);
3746        cursor_to (y, x);        cursor_to (y, x);
3747      }      }
3748      
3749    fflush (stdout);    fflush (stdout);
3750    redisplay_performed_directly_p = 1;    redisplay_performed_directly_p = 1;
3751    return 1;    return 1;
# Line 3762  direct_output_forward_char (n) Line 3762  direct_output_forward_char (n)
3762     If FORCE_P is non-zero, don't let redisplay be stopped by detecting     If FORCE_P is non-zero, don't let redisplay be stopped by detecting
3763     pending input.  If INHIBIT_HAIRY_ID_P is non-zero, don't try     pending input.  If INHIBIT_HAIRY_ID_P is non-zero, don't try
3764     scrolling.     scrolling.
3765      
3766     Value is non-zero if redisplay was stopped due to pending input.  */     Value is non-zero if redisplay was stopped due to pending input.  */
3767    
3768  int  int
# Line 3812  update_frame (f, force_p, inhibit_hairy_ Line 3812  update_frame (f, force_p, inhibit_hairy_
3812                f->desired_tool_bar_string = tem;                f->desired_tool_bar_string = tem;
3813              }              }
3814          }          }
3815      
3816    
3817        /* Update windows.  */        /* Update windows.  */
3818        paused_p = update_window_tree (root_window, force_p);        paused_p = update_window_tree (root_window, force_p);
3819        update_end (f);        update_end (f);
3820          
3821  #if 0 /* This flush is a performance bottleneck under X,  #if 0 /* This flush is a performance bottleneck under X,
3822           and it doesn't seem to be necessary anyway.  */           and it doesn't seem to be necessary anyway.  */
3823        rif->flush_display (f);        rif->flush_display (f);
# Line 3831  update_frame (f, force_p, inhibit_hairy_ Line 3831  update_frame (f, force_p, inhibit_hairy_
3831    
3832        /* Build F's desired matrix from window matrices.  */        /* Build F's desired matrix from window matrices.  */
3833        build_frame_matrix (f);        build_frame_matrix (f);
3834          
3835        /* Update the display  */        /* Update the display  */
3836        update_begin (f);        update_begin (f);
3837        paused_p = update_frame_1 (f, force_p, inhibit_hairy_id_p);        paused_p = update_frame_1 (f, force_p, inhibit_hairy_id_p);
# Line 3850  update_frame (f, force_p, inhibit_hairy_ Line 3850  update_frame (f, force_p, inhibit_hairy_
3850    
3851    /* Reset flags indicating that a window should be updated.  */    /* Reset flags indicating that a window should be updated.  */
3852    set_window_update_flags (root_window, 0);    set_window_update_flags (root_window, 0);
3853      
3854    display_completed = !paused_p;    display_completed = !paused_p;
3855    return paused_p;    return paused_p;
3856  }  }
# Line 3870  update_window_tree (w, force_p) Line 3870  update_window_tree (w, force_p)
3870       int force_p;       int force_p;
3871  {  {
3872    int paused_p = 0;    int paused_p = 0;
3873      
3874    while (w && !paused_p)    while (w && !paused_p)
3875      {      {
3876        if (!NILP (w->hchild))        if (!NILP (w->hchild))
# Line 3922  redraw_overlapped_rows (w, yb) Line 3922  redraw_overlapped_rows (w, yb)
3922       int yb;       int yb;
3923  {  {
3924    int i;    int i;
3925      
3926    /* If rows overlapping others have been changed, the rows being    /* If rows overlapping others have been changed, the rows being
3927       overlapped have to be redrawn.  This won't draw lines that have       overlapped have to be redrawn.  This won't draw lines that have
3928       already been drawn in update_window_line because overlapped_p in       already been drawn in update_window_line because overlapped_p in
# Line 3936  redraw_overlapped_rows (w, yb) Line 3936  redraw_overlapped_rows (w, yb)
3936          break;          break;
3937        else if (row->mode_line_p)        else if (row->mode_line_p)
3938          continue;          continue;
3939          
3940        if (row->overlapped_p)        if (row->overlapped_p)
3941          {          {
3942            enum glyph_row_area area;            enum glyph_row_area area;
3943              
3944            for (area = LEFT_MARGIN_AREA; area < LAST_AREA; ++area)            for (area = LEFT_MARGIN_AREA; area < LAST_AREA; ++area)
3945              {              {
3946                updated_row = row;                updated_row = row;
# Line 3950  redraw_overlapped_rows (w, yb) Line 3950  redraw_overlapped_rows (w, yb)
3950                  rif->write_glyphs (row->glyphs[area], row->used[area]);                  rif->write_glyphs (row->glyphs[area], row->used[area]);
3951                rif->clear_end_of_line (-1);                rif->clear_end_of_line (-1);
3952              }              }
3953              
3954            row->overlapped_p = 0;            row->overlapped_p = 0;
3955          }          }
3956    
# Line 3970  redraw_overlapping_rows (w, yb) Line 3970  redraw_overlapping_rows (w, yb)
3970  {  {
3971    int i, bottom_y;    int i, bottom_y;
3972    struct glyph_row *row;    struct glyph_row *row;
3973      
3974    for (i = 0; i < w->current_matrix->nrows; ++i)    for (i = 0; i < w->current_matrix->nrows; ++i)
3975      {      {
3976        row = w->current_matrix->rows + i;        row = w->current_matrix->rows + i;
# Line 3979  redraw_overlapping_rows (w, yb) Line 3979  redraw_overlapping_rows (w, yb)
3979          break;          break;
3980        else if (row->mode_line_p)        else if (row->mode_line_p)
3981          continue;          continue;
3982          
3983        bottom_y = MATRIX_ROW_BOTTOM_Y (row);        bottom_y = MATRIX_ROW_BOTTOM_Y (row);
3984    
3985        if (row->overlapping_p && i > 0 && bottom_y < yb)        if (row->overlapping_p && i > 0 && bottom_y < yb)
3986          {          {
3987            if (row->used[LEFT_MARGIN_AREA])            if (row->used[LEFT_MARGIN_AREA])
3988              rif->fix_overlapping_area (w, row, LEFT_MARGIN_AREA);              rif->fix_overlapping_area (w, row, LEFT_MARGIN_AREA);
3989      
3990            if (row->used[TEXT_AREA])            if (row->used[TEXT_AREA])
3991              rif->fix_overlapping_area (w, row, TEXT_AREA);              rif->fix_overlapping_area (w, row, TEXT_AREA);
3992      
3993            if (row->used[RIGHT_MARGIN_AREA])            if (row->used[RIGHT_MARGIN_AREA])
3994              rif->fix_overlapping_area (w, row, RIGHT_MARGIN_AREA);              rif->fix_overlapping_area (w, row, RIGHT_MARGIN_AREA);
3995    
# Line 4078  update_window (w, force_p) Line 4078  update_window (w, force_p)
4078           Adjust y-positions of other rows by the header line height.  */           Adjust y-positions of other rows by the header line height.  */
4079        row = desired_matrix->rows;        row = desired_matrix->rows;
4080        end = row + desired_matrix->nrows - 1;        end = row + desired_matrix->nrows - 1;
4081          
4082        if (row->mode_line_p)        if (row->mode_line_p)
4083          {          {
4084            header_line_row = row;            header_line_row = row;
# Line 4103  update_window (w, force_p) Line 4103  update_window (w, force_p)
4103           be also completely empty matrices.  */           be also completely empty matrices.  */
4104        while (row < end && !row->enabled_p)        while (row < end && !row->enabled_p)
4105          ++row;          ++row;
4106          
4107        /* Try reusing part of the display by copying.  */        /* Try reusing part of the display by copying.  */
4108        if (row < end && !desired_matrix->no_scrolling_p)        if (row < end && !desired_matrix->no_scrolling_p)
4109          {          {
# Line 4136  update_window (w, force_p) Line 4136  update_window (w, force_p)
4136            {            {
4137              int vpos = MATRIX_ROW_VPOS (row, desired_matrix);              int vpos = MATRIX_ROW_VPOS (row, desired_matrix);
4138              int i;              int i;
4139                
4140              /* We'll have to play a little bit with when to              /* We'll have to play a little bit with when to
4141                 detect_input_pending.  If it's done too often,                 detect_input_pending.  If it's done too often,
4142                 scrolling large windows with repeated scroll-up                 scrolling large windows with repeated scroll-up
# Line 4163  update_window (w, force_p) Line 4163  update_window (w, force_p)
4163    
4164        /* Was display preempted?  */        /* Was display preempted?  */
4165        paused_p = row < end;        paused_p = row < end;
4166          
4167      set_cursor:      set_cursor:
4168          
4169        /* Fix the appearance of overlapping/overlapped rows.  */        /* Fix the appearance of overlapping/overlapped rows.  */
4170        if (!paused_p && !w->pseudo_window_p)        if (!paused_p && !w->pseudo_window_p)
4171          {          {
# Line 4174  update_window (w, force_p) Line 4174  update_window (w, force_p)
4174                redraw_overlapped_rows (w, yb);                redraw_overlapped_rows (w, yb);
4175                redraw_overlapping_rows (w, yb);                redraw_overlapping_rows (w, yb);
4176              }              }
4177          
4178            /* Make cursor visible at cursor position of W.  */            /* Make cursor visible at cursor position of W.  */
4179            set_window_cursor_after_update (w);            set_window_cursor_after_update (w);
4180    
# Line 4202  update_window (w, force_p) Line 4202  update_window (w, force_p)
4202    /* check_current_matrix_flags (w); */    /* check_current_matrix_flags (w); */
4203    add_window_display_history (w, w->current_matrix->method, paused_p);    add_window_display_history (w, w->current_matrix->method, paused_p);
4204  #endif  #endif
4205      
4206    clear_glyph_matrix (desired_matrix);    clear_glyph_matrix (desired_matrix);
4207    
4208    return paused_p;    return paused_p;
# Line 4248  update_text_area (w, vpos) Line 4248  update_text_area (w, vpos)
4248    /* Let functions in xterm.c know what area subsequent X positions    /* Let functions in xterm.c know what area subsequent X positions
4249       will be relative to.  */       will be relative to.  */
4250    updated_area = TEXT_AREA;    updated_area = TEXT_AREA;
4251      
4252    /* If rows are at different X or Y, or rows have different height,    /* If rows are at different X or Y, or rows have different height,
4253       or the current row is marked invalid, write the entire line.  */       or the current row is marked invalid, write the entire line.  */
4254    if (!current_row->enabled_p    if (!current_row->enabled_p
# Line 4262  update_text_area (w, vpos) Line 4262  update_text_area (w, vpos)
4262        || current_row->x != desired_row->x)        || current_row->x != desired_row->x)
4263      {      {
4264        rif->cursor_to (vpos, 0, desired_row->y, desired_row->x);        rif->cursor_to (vpos, 0, desired_row->y, desired_row->x);
4265          
4266        if (desired_row->used[TEXT_AREA])        if (desired_row->used[TEXT_AREA])
4267          rif->write_glyphs (desired_row->glyphs[TEXT_AREA],          rif->write_glyphs (desired_row->glyphs[TEXT_AREA],
4268                             desired_row->used[TEXT_AREA]);                             desired_row->used[TEXT_AREA]);
4269          
4270        /* Clear to end of window.  */        /* Clear to end of window.  */
4271        rif->clear_end_of_line (-1);        rif->clear_end_of_line (-1);
4272        changed_p = 1;        changed_p = 1;
# Line 4294  update_text_area (w, vpos) Line 4294  update_text_area (w, vpos)
4294           extension actually takes place.  */           extension actually takes place.  */
4295        if (MATRIX_ROW_EXTENDS_FACE_P (desired_row))        if (MATRIX_ROW_EXTENDS_FACE_P (desired_row))
4296          --desired_stop_pos;          --desired_stop_pos;
4297          
4298        stop = min (current_row->used[TEXT_AREA], desired_stop_pos);        stop = min (current_row->used[TEXT_AREA], desired_stop_pos);
4299        i = 0;        i = 0;
4300        x = desired_row->x;        x = desired_row->x;
# Line 4304  update_text_area (w, vpos) Line 4304  update_text_area (w, vpos)
4304        while (i < stop)        while (i < stop)
4305          {          {
4306            int can_skip_p = 1;            int can_skip_p = 1;
4307              
4308            /* Skip over glyphs that both rows have in common.  These            /* Skip over glyphs that both rows have in common.  These
4309               don't have to be written.  We can't skip if the last               don't have to be written.  We can't skip if the last
4310               current glyph overlaps the glyph to its right.  For               current glyph overlaps the glyph to its right.  For
# Line 4317  update_text_area (w, vpos) Line 4317  update_text_area (w, vpos)
4317              {              {
4318                struct glyph *glyph = &current_row->glyphs[TEXT_AREA][i - 1];                struct glyph *glyph = &current_row->glyphs[TEXT_AREA][i - 1];
4319                int left, right;                int left, right;
4320                  
4321                rif->get_glyph_overhangs (glyph, XFRAME (w->frame),                rif->get_glyph_overhangs (glyph, XFRAME (w->frame),
4322                                          &left, &right);                                          &left, &right);
4323                can_skip_p = right == 0;                can_skip_p = right == 0;
4324              }              }
4325              
4326            if (can_skip_p)            if (can_skip_p)
4327              {              {
4328                while (i < stop                while (i < stop
# Line 4347  update_text_area (w, vpos) Line 4347  update_text_area (w, vpos)
4347                        != desired_row->used[TEXT_AREA]))                        != desired_row->used[TEXT_AREA]))
4348                  {                  {
4349                    int left, right;                    int left, right;
4350                  
4351                    rif->get_glyph_overhangs (current_glyph, XFRAME (w->frame),                    rif->get_glyph_overhangs (current_glyph, XFRAME (w->frame),
4352                                              &left, &right);                                              &left, &right);
4353                    while (left > 0 && i > 0)                    while (left > 0 && i > 0)
# Line 4358  update_text_area (w, vpos) Line 4358  update_text_area (w, vpos)
4358                      }                      }
4359                  }                  }
4360              }              }
4361              
4362            /* Try to avoid writing the entire rest of the desired row            /* Try to avoid writing the entire rest of the desired row
4363               by looking for a resync point.  This mainly prevents               by looking for a resync point.  This mainly prevents
4364               mode line flickering in the case the mode line is in               mode line flickering in the case the mode line is in
# Line 4395  update_text_area (w, vpos) Line 4395  update_text_area (w, vpos)
4395                changed_p = 1;                changed_p = 1;
4396              }              }
4397          }          }
4398          
4399        /* Write the rest.  */        /* Write the rest.  */
4400        if (i < desired_row->used[TEXT_AREA])        if (i < desired_row->used[TEXT_AREA])
4401          {          {
# Line 4403  update_text_area (w, vpos) Line 4403  update_text_area (w, vpos)
4403            rif->write_glyphs (desired_glyph, desired_row->used[TEXT_AREA] - i);            rif->write_glyphs (desired_glyph, desired_row->used[TEXT_AREA] - i);
4404            changed_p = 1;            changed_p = 1;
4405          }          }
4406          
4407        /* Maybe clear to end of line.  */        /* Maybe clear to end of line.  */
4408        if (MATRIX_ROW_EXTENDS_FACE_P (desired_row))        if (MATRIX_ROW_EXTENDS_FACE_P (desired_row))
4409          {          {
# Line 4427  update_text_area (w, vpos) Line 4427  update_text_area (w, vpos)
4427            /* Otherwise clear to the end of the old row.  Everything            /* Otherwise clear to the end of the old row.  Everything
4428               after that position should be clear already.  */               after that position should be clear already.  */
4429            int x;            int x;
4430              
4431            if (i >= desired_row->used[TEXT_AREA])            if (i >= desired_row->used[TEXT_AREA])
4432              rif->cursor_to (vpos, i, desired_row->y,              rif->cursor_to (vpos, i, desired_row->y,
4433                              desired_row->x + desired_row->pixel_width);                              desired_row->x + desired_row->pixel_width);
# Line 4470  update_window_line (w, vpos, mouse_face_ Line 4470  update_window_line (w, vpos, mouse_face_
4470       know what line height values are in effect.  */       know what line height values are in effect.  */
4471    updated_row = desired_row;    updated_row = desired_row;
4472    
4473    /* A row can be completely invisible in case a desired matrix was    /* A row can be completely invisible in case a desired matrix was
4474       built with a vscroll and then make_cursor_line_fully_visible shifts       built with a vscroll and then make_cursor_line_fully_visible shifts
4475       the matrix.  Make sure to make such rows current anyway, since       the matrix.  Make sure to make such rows current anyway, since
4476       we need the correct y-position, for example, in the current matrix.  */       we need the correct y-position, for example, in the current matrix.  */
4477    if (desired_row->mode_line_p    if (desired_row->mode_line_p
# Line 4486  update_window_line (w, vpos, mouse_face_ Line 4486  update_window_line (w, vpos, mouse_face_
4486            changed_p = 1;            changed_p = 1;
4487            update_marginal_area (w, LEFT_MARGIN_AREA, vpos);            update_marginal_area (w, LEFT_MARGIN_AREA, vpos);
4488          }          }
4489          
4490        /* Update the display of the text area.  */        /* Update the display of the text area.  */
4491        if (update_text_area (w, vpos))        if (update_text_area (w, vpos))
4492          {          {
# Line 4494  update_window_line (w, vpos, mouse_face_ Line 4494  update_window_line (w, vpos, mouse_face_
4494            if (current_row->mouse_face_p)            if (current_row->mouse_face_p)
4495              *mouse_face_overwritten_p = 1;              *mouse_face_overwritten_p = 1;
4496          }          }
4497          
4498        /* Update display of the right margin area, if there is one.  */        /* Update display of the right margin area, if there is one.  */
4499        if (!desired_row->full_width_p        if (!desired_row->full_width_p
4500            && !NILP (w->right_margin_width))            && !NILP (w->right_margin_width))
# Line 4502  update_window_line (w, vpos, mouse_face_ Line 4502  update_window_line (w, vpos, mouse_face_
4502            changed_p = 1;            changed_p = 1;
4503            update_marginal_area (w, RIGHT_MARGIN_AREA, vpos);            update_marginal_area (w, RIGHT_MARGIN_AREA, vpos);
4504          }          }
4505          
4506        /* Draw truncation marks etc.  */        /* Draw truncation marks etc.  */
4507        if (!current_row->enabled_p        if (!current_row->enabled_p
4508            || desired_row->y != current_row->y            || desired_row->y != current_row->y
# Line 4518  update_window_line (w, vpos, mouse_face_ Line 4518  update_window_line (w, vpos, mouse_face_
4518                != MATRIX_ROW_CONTINUATION_LINE_P (current_row)))                != MATRIX_ROW_CONTINUATION_LINE_P (current_row)))
4519          rif->after_update_window_line_hook (desired_row);          rif->after_update_window_line_hook (desired_row);
4520      }      }
4521      
4522    /* Update current_row from desired_row.  */    /* Update current_row from desired_row.  */
4523    make_current (w->desired_matrix, w->current_matrix, vpos);    make_current (w->desired_matrix, w->current_matrix, vpos);
4524    updated_row = NULL;    updated_row = NULL;
# Line 4538  set_window_cursor_after_update (w) Line 4538  set_window_cursor_after_update (w)
4538    
4539    /* Not intended for frame matrix updates.  */    /* Not intended for frame matrix updates.  */
4540    xassert (FRAME_WINDOW_P (f));    xassert (FRAME_WINDOW_P (f));
4541      
4542    if (cursor_in_echo_area    if (cursor_in_echo_area
4543        && !NILP (echo_area_buffer[0])        && !NILP (echo_area_buffer[0])
4544        /* If we are showing a message instead of the mini-buffer,        /* If we are showing a message instead of the mini-buffer,
# Line 4573  set_window_cursor_after_update (w) Line 4573  set_window_cursor_after_update (w)
4573                  last_row = row;                  last_row = row;
4574                ++row;                ++row;
4575              }              }
4576              
4577            if (last_row)            if (last_row)
4578              {              {
4579                struct glyph *start = last_row->glyphs[TEXT_AREA];                struct glyph *start = last_row->glyphs[TEXT_AREA];
# Line 4581  set_window_cursor_after_update (w) Line 4581  set_window_cursor_after_update (w)
4581    
4582                while (last > start && last->charpos < 0)                while (last > start && last->charpos < 0)
4583                  --last;                  --last;
4584                  
4585                for (glyph = start; glyph < last; ++glyph)                for (glyph = start; glyph < last; ++glyph)
4586                  {                  {
4587                    cx += glyph->pixel_width;                    cx += glyph->pixel_width;
# Line 4629  set_window_update_flags (w, on_p) Line 4629  set_window_update_flags (w, on_p)
4629    
4630        w = NILP (w->next) ? 0 : XWINDOW (w->next);        w = NILP (w->next) ? 0 : XWINDOW (w->next);
4631      }      }
4632  }      }
4633    
4634    
4635    
# Line 4643  struct row_entry Line 4643  struct row_entry
4643  {  {
4644    /* Number of occurrences of this row in desired and current matrix.  */    /* Number of occurrences of this row in desired and current matrix.  */
4645    int old_uses, new_uses;    int old_uses, new_uses;
4646        
4647    /* Vpos of row in new matrix.  */    /* Vpos of row in new matrix.  */
4648    int new_line_number;    int new_line_number;
4649    
4650    /* Bucket index of this row_entry in the hash table row_table.  */    /* Bucket index of this row_entry in the hash table row_table.  */
4651    int bucket;    int bucket;
4652        
4653    /* The row described by this entry.  */    /* The row described by this entry.  */
4654    struct glyph_row *row;    struct glyph_row *row;
4655        
4656    /* Hash collision chain.  */    /* Hash collision chain.  */
4657    struct row_entry *next;    struct row_entry *next;
4658  };  };
# Line 4700  add_row_entry (w, row) Line 4700  add_row_entry (w, row)
4700  {  {
4701    struct row_entry *entry;    struct row_entry *entry;
4702    int i = row->hash % row_table_size;    int i = row->hash % row_table_size;
4703      
4704    entry = row_table[i];    entry = row_table[i];
4705    while (entry && !row_equal_p (w, entry->row, row, 1))    while (entry && !row_equal_p (w, entry->row, row, 1))
4706      entry = entry->next;      entry = entry->next;
4707      
4708    if (entry == NULL)    if (entry == NULL)
4709      {      {
4710        entry = row_entry_pool + row_entry_idx++;        entry = row_entry_pool + row_entry_idx++;
# Line 4781  scrolling_window (w, header_line_p) Line 4781  scrolling_window (w, header_line_p)
4781    /* Give up if some rows in the desired matrix are not enabled.  */    /* Give up if some rows in the desired matrix are not enabled.  */
4782    if (!MATRIX_ROW (desired_matrix, i)->enabled_p)    if (!MATRIX_ROW (desired_matrix, i)->enabled_p)
4783      return -1;      return -1;
4784      
4785    first_old = first_new = i;    first_old = first_new = i;
4786    
4787    /* Set last_new to the index + 1 of the last enabled row in the    /* Set last_new to the index + 1 of the last enabled row in the
# Line 4833  scrolling_window (w, header_line_p) Line 4833  scrolling_window (w, header_line_p)
4833      return 0;      return 0;
4834    
4835    /* Reallocate vectors, tables etc. if necessary.  */    /* Reallocate vectors, tables etc. if necessary.  */
4836      
4837    if (current_matrix->nrows > old_lines_size)    if (current_matrix->nrows > old_lines_size)
4838      {      {
4839        old_lines_size = current_matrix->nrows;        old_lines_size = current_matrix->nrows;
4840        nbytes = old_lines_size * sizeof *old_lines;        nbytes = old_lines_size * sizeof *old_lines;
4841        old_lines = (struct row_entry **) xrealloc (old_lines, nbytes);        old_lines = (struct row_entry **) xrealloc (old_lines, nbytes);
4842      }      }
4843      
4844    if (desired_matrix->nrows > new_lines_size)    if (desired_matrix->nrows > new_lines_size)
4845      {      {
4846        new_lines_size = desired_matrix->nrows;        new_lines_size = desired_matrix->nrows;
# Line 4878  scrolling_window (w, header_line_p) Line 4878  scrolling_window (w, header_line_p)
4878    
4879    /* Add rows from the current and desired matrix to the hash table    /* Add rows from the current and desired matrix to the hash table
4880       row_hash_table to be able to find equal ones quickly.  */       row_hash_table to be able to find equal ones quickly.  */
4881      
4882    for (i = first_old; i < last_old; ++i)    for (i = first_old; i < last_old; ++i)
4883      {      {
4884        if (MATRIX_ROW (current_matrix, i)->enabled_p)        if (MATRIX_ROW (current_matrix, i)->enabled_p)
# Line 4927  scrolling_window (w, header_line_p) Line 4927  scrolling_window (w, header_line_p)
4927                 && old_lines[j] == new_lines[k])                 && old_lines[j] == new_lines[k])
4928            {            {
4929              int h = MATRIX_ROW (current_matrix, j)->height;              int h = MATRIX_ROW (current_matrix, j)->height;
4930              --run->current_vpos;              --run->current_vpos;
4931              --run->desired_vpos;              --run->desired_vpos;
4932              ++run->nrows;              ++run->nrows;
4933              run->height += h;              run->height += h;
4934              run->desired_y -= h;              run->desired_y -= h;
# Line 4944  scrolling_window (w, header_line_p) Line 4944  scrolling_window (w, header_line_p)
4944                 && old_lines[j] == new_lines[k])                 && old_lines[j] == new_lines[k])
4945            {            {
4946              int h = MATRIX_ROW (current_matrix, j)->height;              int h = MATRIX_ROW (current_matrix, j)->height;
4947              ++run->nrows;              ++run->nrows;
4948              run->height += h;              run->height += h;
4949              ++j, ++k;              ++j, ++k;
4950            }            }
# Line 4994  scrolling_window (w, header_line_p) Line 4994  scrolling_window (w, header_line_p)
4994              for (j = i + 1; j < nruns; ++j)              for (j = i + 1; j < nruns; ++j)
4995                {                {
4996                  struct run *p = runs[j];                  struct run *p = runs[j];
4997                    
4998                  if ((p->current_y >= r->desired_y                  if ((p->current_y >= r->desired_y
4999                       && p->current_y < r->desired_y + r->height)                       && p->current_y < r->desired_y + r->height)
5000                      || (p->current_y + p->height >= r->desired_y                      || (p->current_y + p->height >= r->desired_y
# Line 5126  update_frame_1 (f, force_p, inhibit_id_p Line 5126  update_frame_1 (f, force_p, inhibit_id_p
5126            update_frame_line (f, i);            update_frame_line (f, i);
5127          }          }
5128      }      }
5129      
5130    pause = (i < FRAME_HEIGHT (f) - 1) ? i : 0;    pause = (i < FRAME_HEIGHT (f) - 1) ? i : 0;
5131    
5132    /* Now just clean up termcap drivers and set cursor, etc.  */    /* Now just clean up termcap drivers and set cursor, etc.  */
# Line 5161  update_frame_1 (f, force_p, inhibit_id_p Line 5161  update_frame_1 (f, force_p, inhibit_id_p
5161                   is several lines high, find the last line that has                   is several lines high, find the last line that has
5162                   any text on it.  */                   any text on it.  */
5163                row = FRAME_HEIGHT (f);                row = FRAME_HEIGHT (f);
5164                do                do
5165                  {                  {
5166                    --row;                    --row;
5167                    col = 0;                    col = 0;
5168                      
5169                    if (MATRIX_ROW_ENABLED_P (current_matrix, row))                    if (MATRIX_ROW_ENABLED_P (current_matrix, row))
5170                      {                      {
5171                        /* Frame rows are filled up with spaces that                        /* Frame rows are filled up with spaces that
# Line 5178  update_frame_1 (f, force_p, inhibit_id_p Line 5178  update_frame_1 (f, force_p, inhibit_id_p
5178                        while (last > start                        while (last > start
5179                               && (last - 1)->charpos < 0)                               && (last - 1)->charpos < 0)
5180                          --last;                          --last;
5181                          
5182                        col = last - start;                        col = last - start;
5183                      }                      }
5184                  }                  }
# Line 5219  update_frame_1 (f, force_p, inhibit_id_p Line 5219  update_frame_1 (f, force_p, inhibit_id_p
5219    
5220                if (INTEGERP (w->left_margin_width))                if (INTEGERP (w->left_margin_width))
5221                  x += XFASTINT (w->left_margin_width);                  x += XFASTINT (w->left_margin_width);
5222                  
5223                /* x = max (min (x, FRAME_WINDOW_WIDTH (f) - 1), 0); */                /* x = max (min (x, FRAME_WINDOW_WIDTH (f) - 1), 0); */
5224                cursor_to (y, x);                cursor_to (y, x);
5225              }              }
# Line 5334  count_blanks (r, len) Line 5334  count_blanks (r, len)
5334       int len;       int len;
5335  {  {
5336    int i;    int i;
5337      
5338    for (i = 0; i < len; ++i)    for (i = 0; i < len; ++i)
5339      if (!CHAR_GLYPH_SPACE_P (r[i]))      if (!CHAR_GLYPH_SPACE_P (r[i]))
5340        break;        break;
# Line 5353  count_match (str1, end1, str2, end2) Line 5353  count_match (str1, end1, str2, end2)
5353  {  {
5354    struct glyph *p1 = str1;    struct glyph *p1 = str1;
5355    struct glyph *p2 = str2;    struct glyph *p2 = str2;
5356      
5357    while (p1 < end1    while (p1 < end1
5358           && p2 < end2           && p2 < end2
5359           && GLYPH_CHAR_AND_FACE_EQUAL_P (p1, p2))           && GLYPH_CHAR_AND_FACE_EQUAL_P (p1, p2))
5360      ++p1, ++p2;      ++p1, ++p2;
5361      
5362    return p1 - str1;    return p1 - str1;
5363  }  }
5364    
# Line 5403  update_frame_line (f, vpos) Line 5403  update_frame_line (f, vpos)
5403      {      {
5404        obody = MATRIX_ROW_GLYPH_START (current_matrix, vpos);        obody = MATRIX_ROW_GLYPH_START (current_matrix, vpos);
5405        olen = current_row->used[TEXT_AREA];        olen = current_row->used[TEXT_AREA];
5406          
5407        /* Ignore trailing spaces, if we can.  */        /* Ignore trailing spaces, if we can.  */
5408        if (!write_spaces_p)        if (!write_spaces_p)
5409          while (olen > 0 && CHAR_GLYPH_SPACE_P (obody[olen-1]))          while (olen > 0 && CHAR_GLYPH_SPACE_P (obody[olen-1]))
# Line 5438  update_frame_line (f, vpos) Line 5438  update_frame_line (f, vpos)
5438            cursor_to (vpos, 0);            cursor_to (vpos, 0);
5439            write_glyphs (nbody, nlen);            write_glyphs (nbody, nlen);
5440          }          }
5441          
5442        /* Don't call clear_end_of_line if we already wrote the whole        /* Don't call clear_end_of_line if we already wrote the whole
5443           line.  The cursor will not be at the right margin in that           line.  The cursor will not be at the right margin in that
5444           case but in the line below.  */           case but in the line below.  */
# Line 5451  update_frame_line (f, vpos) Line 5451  update_frame_line (f, vpos)
5451          /* Make sure we are in the right row, otherwise cursor movement          /* Make sure we are in the right row, otherwise cursor movement
5452             with cmgoto might use `ch' in the wrong row.  */             with cmgoto might use `ch' in the wrong row.  */
5453          cursor_to (vpos, 0);          cursor_to (vpos, 0);
5454          
5455        make_current (desired_matrix, current_matrix, vpos);        make_current (desired_matrix, current_matrix, vpos);
5456        return;        return;
5457      }      }
# Line 5480  update_frame_line (f, vpos) Line 5480  update_frame_line (f, vpos)
5480                           || !GLYPH_EQUAL_P (nbody + j, obody + j)                           || !GLYPH_EQUAL_P (nbody + j, obody + j)
5481                           || CHAR_GLYPH_PADDING_P (nbody[j])))                           || CHAR_GLYPH_PADDING_P (nbody[j])))
5482                  ++j;                  ++j;
5483                        
5484                /* Output this run of non-matching chars.  */                /* Output this run of non-matching chars.  */
5485                cursor_to (vpos, i);                cursor_to (vpos, i);
5486                write_glyphs (nbody + i, j - i);                write_glyphs (nbody + i, j - i);
5487                i = j - 1;                i = j - 1;
# Line 5641  update_frame_line (f, vpos) Line 5641  update_frame_line (f, vpos)
5641            int del;            int del;
5642    
5643            cursor_to (vpos, nsp + begmatch);            cursor_to (vpos, nsp + begmatch);
5644              
5645            /* Calculate columns we can actually overwrite.  */            /* Calculate columns we can actually overwrite.  */
5646            while (CHAR_GLYPH_PADDING_P (nbody[nsp + begmatch + out]))            while (CHAR_GLYPH_PADDING_P (nbody[nsp + begmatch + out]))
5647              out--;              out--;
5648            write_glyphs (nbody + nsp + begmatch, out);            write_glyphs (nbody + nsp + begmatch, out);
5649              
5650            /* If we left columns to be overwritten, we must delete them.  */            /* If we left columns to be overwritten, we must delete them.  */
5651            del = olen - tem - out;            del = olen - tem - out;
5652            if (del > 0)            if (del > 0)
5653              delete_glyphs (del);              delete_glyphs (del);
5654              
5655            /* At last, we insert columns not yet written out.  */            /* At last, we insert columns not yet written out.  */
5656            insert_glyphs (nbody + nsp + begmatch + out, nlen - olen + del);            insert_glyphs (nbody + nsp + begmatch + out, nlen - olen + del);
5657            olen = nlen;            olen = nlen;
# Line 5705  buffer_posn_from_coords (w, x, y, object Line 5705  buffer_posn_from_coords (w, x, y, object
5705    CHARPOS (startp) = min (ZV, max (BEGV, CHARPOS (startp)));    CHARPOS (startp) = min (ZV, max (BEGV, CHARPOS (startp)));
5706    BYTEPOS (startp) = min (ZV_BYTE, max (BEGV_BYTE, BYTEPOS (startp)));    BYTEPOS (startp) = min (ZV_BYTE, max (BEGV_BYTE, BYTEPOS (startp)));
5707    start_display (&it, w, startp);    start_display (&it, w, startp);
5708      
5709    left_area_width = WINDOW_DISPLAY_LEFT_AREA_PIXEL_WIDTH (w);    left_area_width = WINDOW_DISPLAY_LEFT_AREA_PIXEL_WIDTH (w);
5710    move_it_to (&it, -1, *x + it.first_visible_x - left_area_width, *y, -1,    move_it_to (&it, -1, *x + it.first_visible_x - left_area_width, *y, -1,
5711                MOVE_TO_X | MOVE_TO_Y);                MOVE_TO_X | MOVE_TO_Y);
5712      
5713    *x = it.current_x - it.first_visible_x + left_area_width;    *x = it.current_x - it.first_visible_x + left_area_width;
5714    *y = it.current_y;    *y = it.current_y;
5715    current_buffer = old_current_buffer;    current_buffer = old_current_buffer;
# Line 5873  do_pending_window_change (safe) Line 5873  do_pending_window_change (safe)
5873    /* If window_change_signal should have run before, run it now.  */    /* If window_change_signal should have run before, run it now.  */
5874    if (redisplaying_p && !safe)    if (redisplaying_p && !safe)
5875      return;      return;
5876      
5877    while (delayed_size_change)    while (delayed_size_change)
5878      {      {
5879        Lisp_Object tail, frame;        Lisp_Object tail, frame;
# Line 5895  do_pending_window_change (safe) Line 5895  do_pending_window_change (safe)
5895    
5896    
5897  /* Change the frame height and/or width.  Values may be given as zero to  /* Change the frame height and/or width.  Values may be given as zero to
5898     indicate no change is to take place.     indicate no change is to take place.
5899    
5900     If DELAY is non-zero, then assume we're being called from a signal     If DELAY is non-zero, then assume we're being called from a signal
5901     handler, and queue the change for later - perhaps the next     handler, and queue the change for later - perhaps the next
# Line 6017  change_frame_size_1 (f, newheight, newwi Line 6017  change_frame_size_1 (f, newheight, newwi
6017    {    {
6018      struct window *w = XWINDOW (FRAME_SELECTED_WINDOW (f));      struct window *w = XWINDOW (FRAME_SELECTED_WINDOW (f));
6019      int text_area_x, text_area_y, text_area_width, text_area_height;      int text_area_x, text_area_y, text_area_width, text_area_height;
6020        
6021      window_box (w, TEXT_AREA, &text_area_x, &text_area_y, &text_area_width,      window_box (w, TEXT_AREA, &text_area_x, &text_area_y, &text_area_width,
6022                  &text_area_height);                  &text_area_height);
6023      if (w->cursor.x >= text_area_x + text_area_width)      if (w->cursor.x >= text_area_x + text_area_width)
# Line 6190  Emacs was built without floating point s Line 6190  Emacs was built without floating point s
6190  #ifdef VMS  #ifdef VMS
6191    sys_sleep (sec);    sys_sleep (sec);
6192  #else /* not VMS */  #else /* not VMS */
6193  /* The reason this is done this way  /* The reason this is done this way
6194      (rather than defined (H_S) && defined (H_T))      (rather than defined (H_S) && defined (H_T))
6195     is because the VMS preprocessor doesn't grok `defined'.  */     is because the VMS preprocessor doesn't grok `defined'.  */
6196  #ifdef HAVE_SELECT  #ifdef HAVE_SELECT
6197    EMACS_GET_TIME (end_time);    EMACS_GET_TIME (end_time);
6198    EMACS_SET_SECS_USECS (timeout, sec, usec);    EMACS_SET_SECS_USECS (timeout, sec, usec);
6199    EMACS_ADD_TIME (end_time, end_time, timeout);    EMACS_ADD_TIME (end_time, end_time, timeout);
6200    
6201    while (1)    while (1)
6202      {      {
6203        EMACS_GET_TIME (timeout);        EMACS_GET_TIME (timeout);
# Line 6210  Emacs was built without floating point s Line 6210  Emacs was built without floating point s
6210    sleep (sec);    sleep (sec);
6211  #endif /* HAVE_SELECT */  #endif /* HAVE_SELECT */
6212  #endif /* not VMS */  #endif /* not VMS */
6213      
6214    immediate_quit = 0;    immediate_quit = 0;
6215  #endif /* no subprocesses */  #endif /* no subprocesses */
6216    
# Line 6439  init_display () Line 6439  init_display ()
6439        display_arg = (display != 0 && *display != 0);        display_arg = (display != 0 && *display != 0);
6440      }      }
6441    
6442    if (!inhibit_window_system && display_arg    if (!inhibit_window_system && display_arg
6443  #ifndef CANNOT_DUMP  #ifndef CANNOT_DUMP
6444       && initialized       && initialized
6445  #endif  #endif
# Line 6463  init_display () Line 6463  init_display ()
6463  #endif /* HAVE_X_WINDOWS */  #endif /* HAVE_X_WINDOWS */
6464    
6465  #ifdef HAVE_NTGUI  #ifdef HAVE_NTGUI
6466    if (!inhibit_window_system)    if (!inhibit_window_system)
6467      {      {
6468        Vwindow_system = intern ("w32");        Vwindow_system = intern ("w32");
6469        Vwindow_system_version = make_number (1);        Vwindow_system_version = make_number (1);
# Line 6473  init_display () Line 6473  init_display ()
6473  #endif /* HAVE_NTGUI */  #endif /* HAVE_NTGUI */
6474    
6475  #ifdef MAC_OS  #ifdef MAC_OS
6476    if (!inhibit_window_system)    if (!inhibit_window_system)
6477      {      {
6478        Vwindow_system = intern ("mac");        Vwindow_system = intern ("mac");
6479        Vwindow_system_version = make_number (1);        Vwindow_system_version = make_number (1);
# Line 6518  For types not defined in VMS, use  defin Line 6518  For types not defined in VMS, use  defin
6518          *p = tolower (*p);          *p = tolower (*p);
6519    
6520      terminal_type = new;      terminal_type = new;
6521    }        }
6522  #endif /* VMS */  #endif /* VMS */
6523    
6524    term_init (terminal_type);    term_init (terminal_type);
6525      
6526    {    {
6527      struct frame *sf = SELECTED_FRAME ();      struct frame *sf = SELECTED_FRAME ();
6528      int width = FRAME_WINDOW_WIDTH (sf);      int width = FRAME_WINDOW_WIDTH (sf);
# Line 6591  don't show a cursor.  */) Line 6591  don't show a cursor.  */)
6591          window = selected_window;          window = selected_window;
6592        else        else
6593          CHECK_WINDOW (window);          CHECK_WINDOW (window);
6594          
6595        XWINDOW (window)->cursor_off_p = NILP (show);        XWINDOW (window)->cursor_off_p = NILP (show);
6596      }      }
6597    
# Line 6607  WINDOW nil or omitted means report on th Line 6607  WINDOW nil or omitted means report on th
6607       Lisp_Object window;       Lisp_Object window;
6608  {  {
6609    struct window *w;    struct window *w;
6610      
6611    if (NILP (window))    if (NILP (window))
6612      window = selected_window;      window = selected_window;
6613    else    else
6614      CHECK_WINDOW (window);      CHECK_WINDOW (window);
6615      
6616    w = XWINDOW (window);    w = XWINDOW (window);
6617    return w->cursor_off_p ? Qnil : Qt;        return w->cursor_off_p ? Qnil : Qt;
6618  }  }
6619    
6620    
# Line 6652  syms_of_display () Line 6652  syms_of_display ()
6652                doc: /* *The output baud rate of the terminal.                doc: /* *The output baud rate of the terminal.
6653  On most systems, changing this value will affect the amount of padding  On most systems, changing this value will affect the amount of padding
6654  and the other strategic decisions made during redisplay.  */);  and the other strategic decisions made during redisplay.  */);
6655      
6656    DEFVAR_BOOL ("inverse-video", &inverse_video,    DEFVAR_BOOL ("inverse-video", &inverse_video,
6657                 doc: /* *Non-nil means invert the entire frame display.                 doc: /* *Non-nil means invert the entire frame display.
6658  This means everything is in inverse video which otherwise would not be.  */);  This means everything is in inverse video which otherwise would not be.  */);
6659      
6660    DEFVAR_BOOL ("visible-bell", &visible_bell,    DEFVAR_BOOL ("visible-bell", &visible_bell,
6661                 doc: /* *Non-nil means try to flash the frame to represent a bell.                 doc: /* *Non-nil means try to flash the frame to represent a bell.
6662    
6663  See also `ring-bell-function'.  */);  See also `ring-bell-function'.  */);
6664      
6665    DEFVAR_BOOL ("no-redraw-on-reenter", &no_redraw_on_reenter,    DEFVAR_BOOL ("no-redraw-on-reenter", &no_redraw_on_reenter,
6666                 doc: /* *Non-nil means no need to redraw entire frame after suspending.                 doc: /* *Non-nil means no need to redraw entire frame after suspending.
6667  A non-nil value is useful if the terminal can automatically preserve  A non-nil value is useful if the terminal can automatically preserve
6668  Emacs's frame display when you reenter Emacs.  Emacs's frame display when you reenter Emacs.
6669  It is up to you to set this variable if your terminal can do that.  */);  It is up to you to set this variable if your terminal can do that.  */);
6670      
6671    DEFVAR_LISP ("window-system", &Vwindow_system,    DEFVAR_LISP ("window-system", &Vwindow_system,
6672                 doc: /* Name of window system that Emacs is displaying through.                 doc: /* Name of window system that Emacs is displaying through.
6673  The value is a symbol--for instance, `x' for X windows.  The value is a symbol--for instance, `x' for X windows.
6674  The value is nil if Emacs is using a text-only terminal.  */);  The value is nil if Emacs is using a text-only terminal.  */);
6675      
6676    DEFVAR_LISP ("window-system-version", &Vwindow_system_version,    DEFVAR_LISP ("window-system-version", &Vwindow_system_version,
6677                 doc: /* The version number of the window system in use.                 doc: /* The version number of the window system in use.
6678  For X windows, this is 10 or 11.  */);  For X windows, this is 10 or 11.  */);
6679      
6680    DEFVAR_BOOL ("cursor-in-echo-area", &cursor_in_echo_area,    DEFVAR_BOOL ("cursor-in-echo-area", &cursor_in_echo_area,
6681                 doc: /* Non-nil means put cursor in minibuffer, at end of any message there.  */);                 doc: /* Non-nil means put cursor in minibuffer, at end of any message there.  */);
6682      
6683    DEFVAR_LISP ("glyph-table", &Vglyph_table,    DEFVAR_LISP ("glyph-table", &Vglyph_table,
6684                 doc: /* Table defining how to output a glyph code to the frame.                 doc: /* Table defining how to output a glyph code to the frame.
6685  If not nil, this is a vector indexed by glyph code to define the glyph.  If not nil, this is a vector indexed by glyph code to define the glyph.

Legend:
Removed from v.1.312  
changed lines
  Added in v.1.313

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