aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKim F. Storm2003-12-28 00:10:12 +0000
committerKim F. Storm2003-12-28 00:10:12 +0000
commit60bf162981c3f6fada160812ed248c0f9c6ebc92 (patch)
treeab289ae38bf1aa5eff700e793351b0f8c7dad1b8 /src
parent01b1f0c05b794f86c98e6ad36086e02aa8927482 (diff)
downloademacs-60bf162981c3f6fada160812ed248c0f9c6ebc92.tar.gz
emacs-60bf162981c3f6fada160812ed248c0f9c6ebc92.zip
(buffer_posn_from_coords): Fix calculation of dy for
image glyph using image's ascent. (mode_line_string): Return image glyph as object clicked on. Adjust y0 for image glyph using image's ascent.
Diffstat (limited to 'src')
-rw-r--r--src/dispnew.c51
1 files changed, 39 insertions, 12 deletions
diff --git a/src/dispnew.c b/src/dispnew.c
index 279c1f10e58..09a651d5d7c 100644
--- a/src/dispnew.c
+++ b/src/dispnew.c
@@ -5702,8 +5702,6 @@ buffer_posn_from_coords (w, x, y, dx, dy, object, pos)
5702 struct it it; 5702 struct it it;
5703 struct buffer *old_current_buffer = current_buffer; 5703 struct buffer *old_current_buffer = current_buffer;
5704 struct text_pos startp; 5704 struct text_pos startp;
5705 struct glyph_row *row;
5706 struct image *img;
5707 int x0, x1; 5705 int x0, x1;
5708 5706
5709 current_buffer = XBUFFER (w->buffer); 5707 current_buffer = XBUFFER (w->buffer);
@@ -5716,25 +5714,44 @@ buffer_posn_from_coords (w, x, y, dx, dy, object, pos)
5716 move_it_to (&it, -1, x0 + it.first_visible_x, *y, -1, 5714 move_it_to (&it, -1, x0 + it.first_visible_x, *y, -1,
5717 MOVE_TO_X | MOVE_TO_Y); 5715 MOVE_TO_X | MOVE_TO_Y);
5718 5716
5719 /* Add extra (default width) columns if clicked after EOL. */
5720 x1 = max(0, it.current_x + it.pixel_width - it.first_visible_x);
5721 if (x0 > x1)
5722 it.hpos += (x0 - x1) / WINDOW_FRAME_COLUMN_WIDTH (w);
5723
5724 current_buffer = old_current_buffer; 5717 current_buffer = old_current_buffer;
5725 5718
5726 *dx = x0 + it.first_visible_x - it.current_x; 5719 *dx = x0 + it.first_visible_x - it.current_x;
5727 *dy = *y - it.current_y; 5720 *dy = *y - it.current_y;
5728 5721
5722 *object = w->buffer;
5723
5729#ifdef HAVE_WINDOW_SYSTEM 5724#ifdef HAVE_WINDOW_SYSTEM
5730 if (it.what == IT_IMAGE 5725 if (it.what == IT_IMAGE)
5731 && (img = IMAGE_FROM_ID (it.f, it.image_id)) != NULL 5726 {
5732 && !NILP (img->spec)) 5727 struct image *img;
5733 *object = img->spec; 5728 if ((img = IMAGE_FROM_ID (it.f, it.image_id)) != NULL
5729 && !NILP (img->spec))
5730 {
5731 struct glyph_row *row = MATRIX_ROW (w->current_matrix, it.vpos);
5732 struct glyph *glyph;
5733
5734 if (it.hpos < row->used[TEXT_AREA]
5735 && (glyph = row->glyphs[TEXT_AREA] + it.hpos,
5736 glyph->type == IMAGE_GLYPH))
5737 {
5738 *dy -= row->ascent - glyph->ascent;
5739 *object = img->spec;
5740 }
5741 }
5742 }
5734 else 5743 else
5735#endif 5744#endif
5736 *object = STRINGP (it.string) ? it.string : w->buffer; 5745 if (STRINGP (it.string))
5746 *object = it.string;
5747
5737 *pos = it.current; 5748 *pos = it.current;
5749
5750 /* Add extra (default width) columns if clicked after EOL. */
5751 x1 = max(0, it.current_x + it.pixel_width - it.first_visible_x);
5752 if (x0 > x1)
5753 it.hpos += (x0 - x1) / WINDOW_FRAME_COLUMN_WIDTH (w);
5754
5738 *x = it.hpos; 5755 *x = it.hpos;
5739 *y = it.vpos; 5756 *y = it.vpos;
5740} 5757}
@@ -5854,6 +5871,16 @@ marginal_area_string (w, x, y, dx, dy, part, charpos)
5854 { 5871 {
5855 string = glyph->object; 5872 string = glyph->object;
5856 *charpos = glyph->charpos; 5873 *charpos = glyph->charpos;
5874#ifdef HAVE_WINDOW_SYSTEM
5875 if (glyph->type == IMAGE_GLYPH)
5876 {
5877 struct image *img;
5878 img = IMAGE_FROM_ID (WINDOW_XFRAME (w), glyph->u.img_id);
5879 if (img != NULL)
5880 string = img->spec;
5881 y0 -= row->ascent - glyph->ascent;
5882 }
5883#endif
5857 } 5884 }
5858 else 5885 else
5859 /* Add extra (default width) columns if clicked after EOL. */ 5886 /* Add extra (default width) columns if clicked after EOL. */