comparison src/dispnew.c @ 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 c70e45a7acfd
children 41d029d73eac
comparison
equal deleted inserted replaced
92275:fe4c6489cfdf 92276:1dc7b04a4d95
1466 /* Otherwise, scan the glyphs and accumulate their total length 1466 /* Otherwise, scan the glyphs and accumulate their total length
1467 in LEN. */ 1467 in LEN. */
1468 len = 0; 1468 len = 0;
1469 while (beg < end) 1469 while (beg < end)
1470 { 1470 {
1471 GLYPH g = GLYPH_FROM_CHAR_GLYPH (*beg); 1471 GLYPH g;
1472 1472
1473 if (g < 0 1473 SET_GLYPH_FROM_CHAR_GLYPH (g, *beg);
1474
1475 if (GLYPH_INVALID_P (g) < 0
1474 || GLYPH_SIMPLE_P (glyph_table_base, glyph_table_len, g)) 1476 || GLYPH_SIMPLE_P (glyph_table_base, glyph_table_len, g))
1475 len += 1; 1477 len += 1;
1476 else 1478 else
1477 len += GLYPH_LENGTH (glyph_table_base, g); 1479 len += GLYPH_LENGTH (glyph_table_base, g);
1478 1480
2173 return 1; 2175 return 1;
2174 } 2176 }
2175 else if (!NILP (w->left_margin_cols) 2177 else if (!NILP (w->left_margin_cols)
2176 || !NILP (w->right_margin_cols)) 2178 || !NILP (w->right_margin_cols))
2177 return 1; 2179 return 1;
2178 2180
2179 w = NILP (w->next) ? 0 : XWINDOW (w->next); 2181 w = NILP (w->next) ? 0 : XWINDOW (w->next);
2180 } 2182 }
2181 return 0; 2183 return 0;
2182 } 2184 }
2183 2185
2738 struct window *w; 2740 struct window *w;
2739 { 2741 {
2740 struct glyph_matrix *window_matrix; 2742 struct glyph_matrix *window_matrix;
2741 int window_y, frame_y; 2743 int window_y, frame_y;
2742 /* If non-zero, a glyph to insert at the right border of W. */ 2744 /* If non-zero, a glyph to insert at the right border of W. */
2743 GLYPH right_border_glyph = 0; 2745 GLYPH right_border_glyph;
2746
2747 SET_GLYPH_FROM_CHAR (right_border_glyph, 0);
2744 2748
2745 /* Set window_matrix to the matrix we have to add to FRAME_MATRIX. */ 2749 /* Set window_matrix to the matrix we have to add to FRAME_MATRIX. */
2746 if (w->must_be_updated_p) 2750 if (w->must_be_updated_p)
2747 { 2751 {
2748 window_matrix = w->desired_matrix; 2752 window_matrix = w->desired_matrix;
2749 2753
2750 /* Decide whether we want to add a vertical border glyph. */ 2754 /* Decide whether we want to add a vertical border glyph. */
2751 if (!WINDOW_RIGHTMOST_P (w)) 2755 if (!WINDOW_RIGHTMOST_P (w))
2752 { 2756 {
2753 struct Lisp_Char_Table *dp = window_display_table (w); 2757 struct Lisp_Char_Table *dp = window_display_table (w);
2754 2758 Lisp_Object gc;
2755 right_border_glyph 2759
2756 = ((dp && INTEGERP (DISP_BORDER_GLYPH (dp))) 2760 SET_GLYPH_FROM_CHAR (right_border_glyph, '|');
2757 ? spec_glyph_lookup_face (w, XINT (DISP_BORDER_GLYPH (dp))) 2761 if (dp
2758 : '|'); 2762 && (gc = DISP_BORDER_GLYPH (dp), GLYPH_CODE_P (gc))
2759 2763 && GLYPH_CODE_CHAR_VALID_P (gc))
2760 if (FAST_GLYPH_FACE (right_border_glyph) <= 0) 2764 {
2761 right_border_glyph 2765 SET_GLYPH_FROM_GLYPH_CODE (right_border_glyph, gc);
2762 = FAST_MAKE_GLYPH (right_border_glyph, VERTICAL_BORDER_FACE_ID); 2766 spec_glyph_lookup_face (w, &right_border_glyph);
2767 }
2768
2769 if (GLYPH_FACE (right_border_glyph) <= 0)
2770 SET_GLYPH_FACE (right_border_glyph, VERTICAL_BORDER_FACE_ID);
2763 } 2771 }
2764 } 2772 }
2765 else 2773 else
2766 window_matrix = w->current_matrix; 2774 window_matrix = w->current_matrix;
2767 2775
2807 the corresponding frame row to be updated. */ 2815 the corresponding frame row to be updated. */
2808 frame_row->enabled_p = 1; 2816 frame_row->enabled_p = 1;
2809 2817
2810 /* Maybe insert a vertical border between horizontally adjacent 2818 /* Maybe insert a vertical border between horizontally adjacent
2811 windows. */ 2819 windows. */
2812 if (right_border_glyph) 2820 if (GLYPH_CHAR (right_border_glyph) != 0)
2813 { 2821 {
2814 struct glyph *border = window_row->glyphs[LAST_AREA] - 1; 2822 struct glyph *border = window_row->glyphs[LAST_AREA] - 1;
2815 SET_CHAR_GLYPH_FROM_GLYPH (*border, right_border_glyph); 2823 SET_CHAR_GLYPH_FROM_GLYPH (*border, right_border_glyph);
2816 } 2824 }
2817 2825
2843 /* Given a user-specified glyph, possibly including a Lisp-level face 2851 /* Given a user-specified glyph, possibly including a Lisp-level face
2844 ID, return a glyph that has a realized face ID. 2852 ID, return a glyph that has a realized face ID.
2845 This is used for glyphs displayed specially and not part of the text; 2853 This is used for glyphs displayed specially and not part of the text;
2846 for instance, vertical separators, truncation markers, etc. */ 2854 for instance, vertical separators, truncation markers, etc. */
2847 2855
2848 GLYPH 2856 void
2849 spec_glyph_lookup_face (w, glyph) 2857 spec_glyph_lookup_face (w, glyph)
2850 struct window *w; 2858 struct window *w;
2851 GLYPH glyph; 2859 GLYPH *glyph;
2852 { 2860 {
2853 int lface_id = FAST_GLYPH_FACE (glyph); 2861 int lface_id = GLYPH_FACE (*glyph);
2854 /* Convert the glyph's specified face to a realized (cache) face. */ 2862 /* Convert the glyph's specified face to a realized (cache) face. */
2855 if (lface_id > 0) 2863 if (lface_id > 0)
2856 { 2864 {
2857 int face_id = merge_faces (XFRAME (w->frame), 2865 int face_id = merge_faces (XFRAME (w->frame),
2858 Qt, lface_id, DEFAULT_FACE_ID); 2866 Qt, lface_id, DEFAULT_FACE_ID);
2859 glyph 2867 SET_GLYPH_FACE (*glyph, face_id);
2860 = FAST_MAKE_GLYPH (FAST_GLYPH_CHAR (glyph), face_id); 2868 }
2861 }
2862 return glyph;
2863 } 2869 }
2864 2870
2865 /* Add spaces to a glyph row ROW in a window matrix. 2871 /* Add spaces to a glyph row ROW in a window matrix.
2866 2872
2867 Each row has the form: 2873 Each row has the form:
4056 struct window *w; 4062 struct window *w;
4057 int yb; 4063 int yb;
4058 { 4064 {
4059 int i; 4065 int i;
4060 struct frame *f = XFRAME (WINDOW_FRAME (w)); 4066 struct frame *f = XFRAME (WINDOW_FRAME (w));
4061 4067
4062 /* If rows overlapping others have been changed, the rows being 4068 /* If rows overlapping others have been changed, the rows being
4063 overlapped have to be redrawn. This won't draw lines that have 4069 overlapped have to be redrawn. This won't draw lines that have
4064 already been drawn in update_window_line because overlapped_p in 4070 already been drawn in update_window_line because overlapped_p in
4065 desired rows is 0, so after row assignment overlapped_p in 4071 desired rows is 0, so after row assignment overlapped_p in
4066 current rows is 0. */ 4072 current rows is 0. */
4107 int yb; 4113 int yb;
4108 { 4114 {
4109 int i, bottom_y; 4115 int i, bottom_y;
4110 struct glyph_row *row; 4116 struct glyph_row *row;
4111 struct redisplay_interface *rif = FRAME_RIF (XFRAME (WINDOW_FRAME (w))); 4117 struct redisplay_interface *rif = FRAME_RIF (XFRAME (WINDOW_FRAME (w)));
4112 4118
4113 for (i = 0; i < w->current_matrix->nrows; ++i) 4119 for (i = 0; i < w->current_matrix->nrows; ++i)
4114 { 4120 {
4115 row = w->current_matrix->rows + i; 4121 row = w->current_matrix->rows + i;
4116 4122
4117 if (!row->enabled_p) 4123 if (!row->enabled_p)
6194 6200
6195 if (! tty->term_initted) 6201 if (! tty->term_initted)
6196 continue; 6202 continue;
6197 6203
6198 get_tty_size (fileno (tty->input), &width, &height); 6204 get_tty_size (fileno (tty->input), &width, &height);
6199 6205
6200 if (width > 5 && height > 2) { 6206 if (width > 5 && height > 2) {
6201 Lisp_Object tail, frame; 6207 Lisp_Object tail, frame;
6202 6208
6203 FOR_EACH_FRAME (tail, frame) 6209 FOR_EACH_FRAME (tail, frame)
6204 if (FRAME_TERMCAP_P (XFRAME (frame)) && FRAME_TTY (XFRAME (frame)) == tty) 6210 if (FRAME_TERMCAP_P (XFRAME (frame)) && FRAME_TTY (XFRAME (frame)) == tty)
6205 /* Record the new sizes, but don't reallocate the data 6211 /* Record the new sizes, but don't reallocate the data
6206 structures now. Let that be done later outside of the 6212 structures now. Let that be done later outside of the
6207 signal handler. */ 6213 signal handler. */
6208 change_frame_size (XFRAME (frame), height, width, 0, 1, 0); 6214 change_frame_size (XFRAME (frame), height, width, 0, 1, 0);
6209 } 6215 }
6210 } 6216 }
6211 6217
6212 errno = old_errno; 6218 errno = old_errno;
6213 } 6219 }
6214 #endif /* SIGWINCH */ 6220 #endif /* SIGWINCH */
6215 6221
6216 6222
6451 6457
6452 if (!t) 6458 if (!t)
6453 error ("Unknown terminal device"); 6459 error ("Unknown terminal device");
6454 6460
6455 tty = t->display_info.tty; 6461 tty = t->display_info.tty;
6456 6462
6457 if (tty->termscript) 6463 if (tty->termscript)
6458 { 6464 {
6459 fwrite (SDATA (string), 1, SBYTES (string), tty->termscript); 6465 fwrite (SDATA (string), 1, SBYTES (string), tty->termscript);
6460 fflush (tty->termscript); 6466 fflush (tty->termscript);
6461 } 6467 }
6790 extern int display_arg; 6796 extern int display_arg;
6791 #endif 6797 #endif
6792 6798
6793 /* Construct the space glyph. */ 6799 /* Construct the space glyph. */
6794 space_glyph.type = CHAR_GLYPH; 6800 space_glyph.type = CHAR_GLYPH;
6795 SET_CHAR_GLYPH_FROM_GLYPH (space_glyph, ' '); 6801 SET_CHAR_GLYPH (space_glyph, ' ', DEFAULT_FACE_ID, 0);
6796 space_glyph.charpos = -1; 6802 space_glyph.charpos = -1;
6797 6803
6798 inverse_video = 0; 6804 inverse_video = 0;
6799 cursor_in_echo_area = 0; 6805 cursor_in_echo_area = 0;
6800 terminal_type = (char *) 0; 6806 terminal_type = (char *) 0;
6961 Fmodify_frame_parameters 6967 Fmodify_frame_parameters
6962 (selected_frame, Fcons (Fcons (Qtty_type, 6968 (selected_frame, Fcons (Fcons (Qtty_type,
6963 Ftty_type (selected_frame)), Qnil)); 6969 Ftty_type (selected_frame)), Qnil));
6964 Fmodify_frame_parameters (selected_frame, Fcons (Fcons (Qtty, Qnil), Qnil)); 6970 Fmodify_frame_parameters (selected_frame, Fcons (Fcons (Qtty, Qnil), Qnil));
6965 } 6971 }
6966 6972
6967 { 6973 {
6968 struct frame *sf = SELECTED_FRAME (); 6974 struct frame *sf = SELECTED_FRAME ();
6969 int width = FRAME_TOTAL_COLS (sf); 6975 int width = FRAME_TOTAL_COLS (sf);
6970 int height = FRAME_LINES (sf); 6976 int height = FRAME_LINES (sf);
6971 6977