changeset 92276:1dc7b04a4d95

(line_draw_cost): Adapt to new glyph type. (build_frame_matrix_from_leaf_window): Adapt to new glyph type and new glyph code encoding. (spec_glyph_lookup_face): No return value; update passed glyph instead. (init_display): Use SET_CHAR_GLYPH to initialize space_glyph.
author Kim F. Storm <storm@cua.dk>
date Wed, 27 Feb 2008 22:48:52 +0000
parents fe4c6489cfdf
children d86b04f18152
files src/dispnew.c
diffstat 1 files changed, 36 insertions(+), 30 deletions(-) [+]
line wrap: on
line diff
--- a/src/dispnew.c	Wed Feb 27 22:48:44 2008 +0000
+++ b/src/dispnew.c	Wed Feb 27 22:48:52 2008 +0000
@@ -1468,9 +1468,11 @@
       len = 0;
       while (beg < end)
 	{
-	  GLYPH g = GLYPH_FROM_CHAR_GLYPH (*beg);
-
-	  if (g < 0
+	  GLYPH g;
+
+	  SET_GLYPH_FROM_CHAR_GLYPH (g, *beg);
+
+	  if (GLYPH_INVALID_P (g) < 0
 	      || GLYPH_SIMPLE_P (glyph_table_base, glyph_table_len, g))
 	    len += 1;
 	  else
@@ -2175,7 +2177,7 @@
       else if (!NILP (w->left_margin_cols)
 	       || !NILP (w->right_margin_cols))
 	return 1;
- 
+
       w = NILP (w->next) ? 0 : XWINDOW (w->next);
     }
   return 0;
@@ -2740,7 +2742,9 @@
   struct glyph_matrix *window_matrix;
   int window_y, frame_y;
   /* If non-zero, a glyph to insert at the right border of W.  */
-  GLYPH right_border_glyph = 0;
+  GLYPH right_border_glyph;
+
+  SET_GLYPH_FROM_CHAR (right_border_glyph, 0);
 
   /* Set window_matrix to the matrix we have to add to FRAME_MATRIX.  */
   if (w->must_be_updated_p)
@@ -2751,15 +2755,19 @@
       if (!WINDOW_RIGHTMOST_P (w))
 	{
 	  struct Lisp_Char_Table *dp = window_display_table (w);
-
-	  right_border_glyph
-	    = ((dp && INTEGERP (DISP_BORDER_GLYPH (dp)))
-	       ? spec_glyph_lookup_face (w, XINT (DISP_BORDER_GLYPH (dp)))
-	       : '|');
-
-	  if (FAST_GLYPH_FACE (right_border_glyph) <= 0)
-	    right_border_glyph
-	      = FAST_MAKE_GLYPH (right_border_glyph, VERTICAL_BORDER_FACE_ID);
+	  Lisp_Object gc;
+
+	  SET_GLYPH_FROM_CHAR (right_border_glyph, '|');
+	  if (dp
+	      && (gc = DISP_BORDER_GLYPH (dp), GLYPH_CODE_P (gc))
+	      && GLYPH_CODE_CHAR_VALID_P (gc))
+	    {
+	      SET_GLYPH_FROM_GLYPH_CODE (right_border_glyph, gc);
+	      spec_glyph_lookup_face (w, &right_border_glyph);
+	    }
+
+	  if (GLYPH_FACE (right_border_glyph) <= 0)
+	    SET_GLYPH_FACE (right_border_glyph, VERTICAL_BORDER_FACE_ID);
 	}
     }
   else
@@ -2809,7 +2817,7 @@
 
           /* Maybe insert a vertical border between horizontally adjacent
 	     windows.  */
-          if (right_border_glyph)
+          if (GLYPH_CHAR (right_border_glyph) != 0)
 	    {
               struct glyph *border = window_row->glyphs[LAST_AREA] - 1;
 	      SET_CHAR_GLYPH_FROM_GLYPH (*border, right_border_glyph);
@@ -2845,21 +2853,19 @@
    This is used for glyphs displayed specially and not part of the text;
    for instance, vertical separators, truncation markers, etc.  */
 
-GLYPH
+void
 spec_glyph_lookup_face (w, glyph)
      struct window *w;
-     GLYPH glyph;
+     GLYPH *glyph;
 {
-  int lface_id = FAST_GLYPH_FACE (glyph);
+  int lface_id = GLYPH_FACE (*glyph);
   /* Convert the glyph's specified face to a realized (cache) face.  */
   if (lface_id > 0)
     {
       int face_id = merge_faces (XFRAME (w->frame),
 				 Qt, lface_id, DEFAULT_FACE_ID);
-      glyph
-	= FAST_MAKE_GLYPH (FAST_GLYPH_CHAR (glyph), face_id);
-    }
-  return glyph;
+      SET_GLYPH_FACE (*glyph, face_id);
+    }
 }
 
 /* Add spaces to a glyph row ROW in a window matrix.
@@ -4058,7 +4064,7 @@
 {
   int i;
   struct frame *f = XFRAME (WINDOW_FRAME (w));
-  
+
   /* If rows overlapping others have been changed, the rows being
      overlapped have to be redrawn.  This won't draw lines that have
      already been drawn in update_window_line because overlapped_p in
@@ -4109,7 +4115,7 @@
   int i, bottom_y;
   struct glyph_row *row;
   struct redisplay_interface *rif = FRAME_RIF (XFRAME (WINDOW_FRAME (w)));
-  
+
   for (i = 0; i < w->current_matrix->nrows; ++i)
     {
       row = w->current_matrix->rows + i;
@@ -6196,10 +6202,10 @@
       continue;
 
     get_tty_size (fileno (tty->input), &width, &height);
-    
+
     if (width > 5 && height > 2) {
       Lisp_Object tail, frame;
-      
+
       FOR_EACH_FRAME (tail, frame)
         if (FRAME_TERMCAP_P (XFRAME (frame)) && FRAME_TTY (XFRAME (frame)) == tty)
           /* Record the new sizes, but don't reallocate the data
@@ -6208,7 +6214,7 @@
           change_frame_size (XFRAME (frame), height, width, 0, 1, 0);
     }
   }
-  
+
   errno = old_errno;
 }
 #endif /* SIGWINCH */
@@ -6453,7 +6459,7 @@
     error ("Unknown terminal device");
 
   tty = t->display_info.tty;
-  
+
   if (tty->termscript)
     {
       fwrite (SDATA (string), 1, SBYTES (string), tty->termscript);
@@ -6792,7 +6798,7 @@
 
   /* Construct the space glyph.  */
   space_glyph.type = CHAR_GLYPH;
-  SET_CHAR_GLYPH_FROM_GLYPH (space_glyph, ' ');
+  SET_CHAR_GLYPH (space_glyph, ' ', DEFAULT_FACE_ID, 0);
   space_glyph.charpos = -1;
 
   inverse_video = 0;
@@ -6963,7 +6969,7 @@
                                      Ftty_type (selected_frame)), Qnil));
     Fmodify_frame_parameters (selected_frame, Fcons (Fcons (Qtty, Qnil), Qnil));
   }
-  
+
   {
     struct frame *sf = SELECTED_FRAME ();
     int width = FRAME_TOTAL_COLS (sf);