aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPaul Eggert2011-08-30 14:16:49 -0700
committerPaul Eggert2011-08-30 14:16:49 -0700
commit542f2c78acd26112754474223c85311d6c9cc2eb (patch)
tree40b7b8d083fca48e389c2126b126e8c681782cc7 /src
parent2be7d7020619ebbdfb3df2bc2c3fcc3123bcedc0 (diff)
parent1f87634f0a68f181c4b5aa526fe2985f6c10328c (diff)
downloademacs-542f2c78acd26112754474223c85311d6c9cc2eb.tar.gz
emacs-542f2c78acd26112754474223c85311d6c9cc2eb.zip
Merge from trunk.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog14
-rw-r--r--src/dispextern.h3
-rw-r--r--src/image.c3
-rw-r--r--src/term.c86
-rw-r--r--src/xdisp.c110
5 files changed, 100 insertions, 116 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index e6c58903f03..b38c11ace93 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -104,6 +104,20 @@
104 104
105 * xterm.h (x_check_errors): Add ATTRIBUTE_FORMAT_PRINTF. 105 * xterm.h (x_check_errors): Add ATTRIBUTE_FORMAT_PRINTF.
106 106
1072011-08-30 Eli Zaretskii <eliz@gnu.org>
108
109 * image.c (x_bitmap_pixmap): Cast to int to avoid compiler warnings.
110
111 * xdisp.c (produce_stretch_glyph): No longer static, compiled also
112 when HAVE_WINDOW_SYSTEM is not defined. Support both GUI and TTY
113 frames. Call tty_append_glyph in the TTY case. (Bug#9402)
114
115 * term.c (tty_append_glyph): New function.
116 (produce_stretch_glyph): Static function and its prototype deleted.
117
118 * dispextern.h (produce_stretch_glyph, tty_append_glyph): Add
119 prototypes.
120
1072011-08-29 Paul Eggert <eggert@cs.ucla.edu> 1212011-08-29 Paul Eggert <eggert@cs.ucla.edu>
108 122
109 * image.c (parse_image_spec): Check for nonnegative, not for positive, 123 * image.c (parse_image_spec): Check for nonnegative, not for positive,
diff --git a/src/dispextern.h b/src/dispextern.h
index f0be8ec136b..831803f58f4 100644
--- a/src/dispextern.h
+++ b/src/dispextern.h
@@ -3043,6 +3043,8 @@ extern EMACS_INT compute_display_string_pos (struct text_pos *,
3043 int, int *); 3043 int, int *);
3044extern EMACS_INT compute_display_string_end (EMACS_INT, 3044extern EMACS_INT compute_display_string_end (EMACS_INT,
3045 struct bidi_string_data *); 3045 struct bidi_string_data *);
3046extern void produce_stretch_glyph (struct it *);
3047
3046 3048
3047#ifdef HAVE_WINDOW_SYSTEM 3049#ifdef HAVE_WINDOW_SYSTEM
3048 3050
@@ -3337,6 +3339,7 @@ extern struct terminal *get_named_tty (const char *);
3337EXFUN (Ftty_type, 1); 3339EXFUN (Ftty_type, 1);
3338extern void create_tty_output (struct frame *); 3340extern void create_tty_output (struct frame *);
3339extern struct terminal *init_tty (const char *, const char *, int); 3341extern struct terminal *init_tty (const char *, const char *, int);
3342extern void tty_append_glyph (struct it *);
3340 3343
3341 3344
3342/* Defined in scroll.c */ 3345/* Defined in scroll.c */
diff --git a/src/image.c b/src/image.c
index d6bfc4050ca..c5dcbb32e5d 100644
--- a/src/image.c
+++ b/src/image.c
@@ -196,7 +196,8 @@ x_bitmap_width (FRAME_PTR f, ptrdiff_t id)
196int 196int
197x_bitmap_pixmap (FRAME_PTR f, ptrdiff_t id) 197x_bitmap_pixmap (FRAME_PTR f, ptrdiff_t id)
198{ 198{
199 return FRAME_X_DISPLAY_INFO (f)->bitmaps[id - 1].pixmap; 199 /* HAVE_NTGUI needs the explicit cast here. */
200 return (int) FRAME_X_DISPLAY_INFO (f)->bitmaps[id - 1].pixmap;
200} 201}
201#endif 202#endif
202 203
diff --git a/src/term.c b/src/term.c
index fb07fc4490e..10416090b80 100644
--- a/src/term.c
+++ b/src/term.c
@@ -1440,7 +1440,6 @@ term_get_fkeys_1 (void)
1440 Character Display Information 1440 Character Display Information
1441 ***********************************************************************/ 1441 ***********************************************************************/
1442static void append_glyph (struct it *); 1442static void append_glyph (struct it *);
1443static void produce_stretch_glyph (struct it *);
1444static void append_composite_glyph (struct it *); 1443static void append_composite_glyph (struct it *);
1445static void produce_composite_glyph (struct it *); 1444static void produce_composite_glyph (struct it *);
1446static void append_glyphless_glyph (struct it *, int, const char *); 1445static void append_glyphless_glyph (struct it *, int, const char *);
@@ -1512,6 +1511,14 @@ append_glyph (struct it *it)
1512 } 1511 }
1513} 1512}
1514 1513
1514/* For external use. */
1515void
1516tty_append_glyph (struct it *it)
1517{
1518 append_glyph (it);
1519}
1520
1521
1515/* Produce glyphs for the display element described by IT. *IT 1522/* Produce glyphs for the display element described by IT. *IT
1516 specifies what we want to produce a glyph for (character, image, ...), 1523 specifies what we want to produce a glyph for (character, image, ...),
1517 and where in the glyph matrix we currently are (glyph row and hpos). 1524 and where in the glyph matrix we currently are (glyph row and hpos).
@@ -1638,83 +1645,6 @@ produce_glyphs (struct it *it)
1638 it->descent = it->max_descent = it->phys_descent = it->max_phys_descent = 1; 1645 it->descent = it->max_descent = it->phys_descent = it->max_phys_descent = 1;
1639} 1646}
1640 1647
1641
1642/* Produce a stretch glyph for iterator IT. IT->object is the value
1643 of the glyph property displayed. The value must be a list
1644 `(space KEYWORD VALUE ...)' with the following KEYWORD/VALUE pairs
1645 being recognized:
1646
1647 1. `:width WIDTH' specifies that the space should be WIDTH *
1648 canonical char width wide. WIDTH may be an integer or floating
1649 point number.
1650
1651 2. `:align-to HPOS' specifies that the space should be wide enough
1652 to reach HPOS, a value in canonical character units. */
1653
1654static void
1655produce_stretch_glyph (struct it *it)
1656{
1657 /* (space :width WIDTH ...) */
1658 Lisp_Object prop, plist;
1659 int width = 0, align_to = -1;
1660 int zero_width_ok_p = 0;
1661 double tem;
1662
1663 /* List should start with `space'. */
1664 xassert (CONSP (it->object) && EQ (XCAR (it->object), Qspace));
1665 plist = XCDR (it->object);
1666
1667 /* Compute the width of the stretch. */
1668 if ((prop = Fplist_get (plist, QCwidth), !NILP (prop))
1669 && calc_pixel_width_or_height (&tem, it, prop, 0, 1, 0))
1670 {
1671 /* Absolute width `:width WIDTH' specified and valid. */
1672 zero_width_ok_p = 1;
1673 width = (int)(tem + 0.5);
1674 }
1675 else if ((prop = Fplist_get (plist, QCalign_to), !NILP (prop))
1676 && calc_pixel_width_or_height (&tem, it, prop, 0, 1, &align_to))
1677 {
1678 if (it->glyph_row == NULL || !it->glyph_row->mode_line_p)
1679 align_to = (align_to < 0
1680 ? 0
1681 : align_to - window_box_left_offset (it->w, TEXT_AREA));
1682 else if (align_to < 0)
1683 align_to = window_box_left_offset (it->w, TEXT_AREA);
1684 width = max (0, (int)(tem + 0.5) + align_to - it->current_x);
1685 zero_width_ok_p = 1;
1686 }
1687 else
1688 /* Nothing specified -> width defaults to canonical char width. */
1689 width = FRAME_COLUMN_WIDTH (it->f);
1690
1691 if (width <= 0 && (width < 0 || !zero_width_ok_p))
1692 width = 1;
1693
1694 if (width > 0 && it->line_wrap != TRUNCATE
1695 && it->current_x + width > it->last_visible_x)
1696 width = it->last_visible_x - it->current_x - 1;
1697
1698 if (width > 0 && it->glyph_row)
1699 {
1700 Lisp_Object o_object = it->object;
1701 Lisp_Object object = it->stack[it->sp - 1].string;
1702 int n = width;
1703
1704 if (!STRINGP (object))
1705 object = it->w->buffer;
1706 it->object = object;
1707 it->char_to_display = ' ';
1708 it->pixel_width = it->len = 1;
1709 while (n--)
1710 append_glyph (it);
1711 it->object = o_object;
1712 }
1713 it->pixel_width = width;
1714 it->nglyphs = width;
1715}
1716
1717
1718/* Append glyphs to IT's glyph_row for the composition IT->cmp_id. 1648/* Append glyphs to IT's glyph_row for the composition IT->cmp_id.
1719 Called from produce_composite_glyph for terminal frames if 1649 Called from produce_composite_glyph for terminal frames if
1720 IT->glyph_row != NULL. IT->face_id contains the character's 1650 IT->glyph_row != NULL. IT->face_id contains the character's
diff --git a/src/xdisp.c b/src/xdisp.c
index 2afc8fc9af1..1716cc82188 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -23086,6 +23086,7 @@ append_stretch_glyph (struct it *it, Lisp_Object object,
23086 IT_EXPAND_MATRIX_WIDTH (it, area); 23086 IT_EXPAND_MATRIX_WIDTH (it, area);
23087} 23087}
23088 23088
23089#endif /* HAVE_WINDOW_SYSTEM */
23089 23090
23090/* Produce a stretch glyph for iterator IT. IT->object is the value 23091/* Produce a stretch glyph for iterator IT. IT->object is the value
23091 of the glyph property displayed. The value must be a list 23092 of the glyph property displayed. The value must be a list
@@ -23118,19 +23119,28 @@ append_stretch_glyph (struct it *it, Lisp_Object object,
23118 of the stretch should be used for the ascent of the stretch. 23119 of the stretch should be used for the ascent of the stretch.
23119 ASCENT must be in the range 0 <= ASCENT <= 100. */ 23120 ASCENT must be in the range 0 <= ASCENT <= 100. */
23120 23121
23121static void 23122void
23122produce_stretch_glyph (struct it *it) 23123produce_stretch_glyph (struct it *it)
23123{ 23124{
23124 /* (space :width WIDTH :height HEIGHT ...) */ 23125 /* (space :width WIDTH :height HEIGHT ...) */
23125 Lisp_Object prop, plist; 23126 Lisp_Object prop, plist;
23126 int width = 0, height = 0, align_to = -1; 23127 int width = 0, height = 0, align_to = -1;
23127 int zero_width_ok_p = 0, zero_height_ok_p = 0; 23128 int zero_width_ok_p = 0;
23128 int ascent = 0; 23129 int ascent = 0;
23129 double tem; 23130 double tem;
23130 struct face *face = FACE_FROM_ID (it->f, it->face_id); 23131 struct face *face = NULL;
23131 struct font *font = face->font ? face->font : FRAME_FONT (it->f); 23132 struct font *font = NULL;
23132 23133
23133 PREPARE_FACE_FOR_DISPLAY (it->f, face); 23134#ifdef HAVE_WINDOW_SYSTEM
23135 int zero_height_ok_p = 0;
23136
23137 if (FRAME_WINDOW_P (it->f))
23138 {
23139 face = FACE_FROM_ID (it->f, it->face_id);
23140 font = face->font ? face->font : FRAME_FONT (it->f);
23141 PREPARE_FACE_FOR_DISPLAY (it->f, face);
23142 }
23143#endif
23134 23144
23135 /* List should start with `space'. */ 23145 /* List should start with `space'. */
23136 xassert (CONSP (it->object) && EQ (XCAR (it->object), Qspace)); 23146 xassert (CONSP (it->object) && EQ (XCAR (it->object), Qspace));
@@ -23144,8 +23154,9 @@ produce_stretch_glyph (struct it *it)
23144 zero_width_ok_p = 1; 23154 zero_width_ok_p = 1;
23145 width = (int)tem; 23155 width = (int)tem;
23146 } 23156 }
23147 else if (prop = Fplist_get (plist, QCrelative_width), 23157#ifdef HAVE_WINDOW_SYSTEM
23148 NUMVAL (prop) > 0) 23158 else if (FRAME_WINDOW_P (it->f)
23159 && (prop = Fplist_get (plist, QCrelative_width), NUMVAL (prop) > 0))
23149 { 23160 {
23150 /* Relative width `:relative-width FACTOR' specified and valid. 23161 /* Relative width `:relative-width FACTOR' specified and valid.
23151 Compute the width of the characters having the `glyph' 23162 Compute the width of the characters having the `glyph'
@@ -23168,6 +23179,7 @@ produce_stretch_glyph (struct it *it)
23168 x_produce_glyphs (&it2); 23179 x_produce_glyphs (&it2);
23169 width = NUMVAL (prop) * it2.pixel_width; 23180 width = NUMVAL (prop) * it2.pixel_width;
23170 } 23181 }
23182#endif /* HAVE_WINDOW_SYSTEM */
23171 else if ((prop = Fplist_get (plist, QCalign_to), !NILP (prop)) 23183 else if ((prop = Fplist_get (plist, QCalign_to), !NILP (prop))
23172 && calc_pixel_width_or_height (&tem, it, prop, font, 1, &align_to)) 23184 && calc_pixel_width_or_height (&tem, it, prop, font, 1, &align_to))
23173 { 23185 {
@@ -23187,33 +23199,40 @@ produce_stretch_glyph (struct it *it)
23187 if (width <= 0 && (width < 0 || !zero_width_ok_p)) 23199 if (width <= 0 && (width < 0 || !zero_width_ok_p))
23188 width = 1; 23200 width = 1;
23189 23201
23202#ifdef HAVE_WINDOW_SYSTEM
23190 /* Compute height. */ 23203 /* Compute height. */
23191 if ((prop = Fplist_get (plist, QCheight), !NILP (prop)) 23204 if (FRAME_WINDOW_P (it->f))
23192 && calc_pixel_width_or_height (&tem, it, prop, font, 0, 0))
23193 { 23205 {
23194 height = (int)tem; 23206 if ((prop = Fplist_get (plist, QCheight), !NILP (prop))
23195 zero_height_ok_p = 1; 23207 && calc_pixel_width_or_height (&tem, it, prop, font, 0, 0))
23196 } 23208 {
23197 else if (prop = Fplist_get (plist, QCrelative_height), 23209 height = (int)tem;
23198 NUMVAL (prop) > 0) 23210 zero_height_ok_p = 1;
23199 height = FONT_HEIGHT (font) * NUMVAL (prop); 23211 }
23200 else 23212 else if (prop = Fplist_get (plist, QCrelative_height),
23201 height = FONT_HEIGHT (font); 23213 NUMVAL (prop) > 0)
23214 height = FONT_HEIGHT (font) * NUMVAL (prop);
23215 else
23216 height = FONT_HEIGHT (font);
23202 23217
23203 if (height <= 0 && (height < 0 || !zero_height_ok_p)) 23218 if (height <= 0 && (height < 0 || !zero_height_ok_p))
23204 height = 1; 23219 height = 1;
23205 23220
23206 /* Compute percentage of height used for ascent. If 23221 /* Compute percentage of height used for ascent. If
23207 `:ascent ASCENT' is present and valid, use that. Otherwise, 23222 `:ascent ASCENT' is present and valid, use that. Otherwise,
23208 derive the ascent from the font in use. */ 23223 derive the ascent from the font in use. */
23209 if (prop = Fplist_get (plist, QCascent), 23224 if (prop = Fplist_get (plist, QCascent),
23210 NUMVAL (prop) > 0 && NUMVAL (prop) <= 100) 23225 NUMVAL (prop) > 0 && NUMVAL (prop) <= 100)
23211 ascent = height * NUMVAL (prop) / 100.0; 23226 ascent = height * NUMVAL (prop) / 100.0;
23212 else if (!NILP (prop) 23227 else if (!NILP (prop)
23213 && calc_pixel_width_or_height (&tem, it, prop, font, 0, 0)) 23228 && calc_pixel_width_or_height (&tem, it, prop, font, 0, 0))
23214 ascent = min (max (0, (int)tem), height); 23229 ascent = min (max (0, (int)tem), height);
23230 else
23231 ascent = (height * FONT_BASE (font)) / FONT_HEIGHT (font);
23232 }
23215 else 23233 else
23216 ascent = (height * FONT_BASE (font)) / FONT_HEIGHT (font); 23234#endif /* HAVE_WINDOW_SYSTEM */
23235 height = 1;
23217 23236
23218 if (width > 0 && it->line_wrap != TRUNCATE 23237 if (width > 0 && it->line_wrap != TRUNCATE
23219 && it->current_x + width > it->last_visible_x) 23238 && it->current_x + width > it->last_visible_x)
@@ -23221,20 +23240,37 @@ produce_stretch_glyph (struct it *it)
23221 23240
23222 if (width > 0 && height > 0 && it->glyph_row) 23241 if (width > 0 && height > 0 && it->glyph_row)
23223 { 23242 {
23243 Lisp_Object o_object = it->object;
23224 Lisp_Object object = it->stack[it->sp - 1].string; 23244 Lisp_Object object = it->stack[it->sp - 1].string;
23245 int n = width;
23246
23225 if (!STRINGP (object)) 23247 if (!STRINGP (object))
23226 object = it->w->buffer; 23248 object = it->w->buffer;
23227 append_stretch_glyph (it, object, width, height, ascent); 23249#ifdef HAVE_WINDOW_SYSTEM
23250 if (FRAME_WINDOW_P (it->f))
23251 {
23252 append_stretch_glyph (it, object, width, height, ascent);
23253 it->ascent = it->phys_ascent = ascent;
23254 it->descent = it->phys_descent = height - it->ascent;
23255 it->nglyphs = width > 0 && height > 0 ? 1 : 0;
23256 take_vertical_position_into_account (it);
23257 }
23258 else
23259#endif
23260 {
23261 it->object = object;
23262 it->char_to_display = ' ';
23263 it->pixel_width = it->len = 1;
23264 while (n--)
23265 tty_append_glyph (it);
23266 it->object = o_object;
23267 it->pixel_width = width;
23268 }
23228 } 23269 }
23229
23230 it->pixel_width = width;
23231 it->ascent = it->phys_ascent = ascent;
23232 it->descent = it->phys_descent = height - it->ascent;
23233 it->nglyphs = width > 0 && height > 0 ? 1 : 0;
23234
23235 take_vertical_position_into_account (it);
23236} 23270}
23237 23271
23272#ifdef HAVE_WINDOW_SYSTEM
23273
23238/* Calculate line-height and line-spacing properties. 23274/* Calculate line-height and line-spacing properties.
23239 An integer value specifies explicit pixel value. 23275 An integer value specifies explicit pixel value.
23240 A float value specifies relative value to current face height. 23276 A float value specifies relative value to current face height.