diff src/dispnew.c @ 83112:30dd490f06f2

Merged in changes from CVS trunk. Patches applied: * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-230 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-231 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-232 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-233 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-234 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-235 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-236 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-237 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-238 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-239 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-240 Update from CVS git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-152
author Karoly Lorentey <lorentey@elte.hu>
date Fri, 23 Apr 2004 14:44:11 +0000
parents 4970ad4995f5 78fbab658433
children 3708519cf113
line wrap: on
line diff
--- a/src/dispnew.c	Fri Apr 23 13:56:26 2004 +0000
+++ b/src/dispnew.c	Fri Apr 23 14:44:11 2004 +0000
@@ -5740,6 +5740,9 @@
   struct text_pos startp;
   Lisp_Object string;
   struct glyph_row *row;
+#ifdef HAVE_WINDOW_SYSTEM
+  struct image *img = 0;
+#endif
   int x0, x1;
 
   current_buffer = XBUFFER (w->buffer);
@@ -5765,7 +5768,6 @@
 #ifdef HAVE_WINDOW_SYSTEM
   if (it.what == IT_IMAGE)
     {
-      struct image *img;
       if ((img = IMAGE_FROM_ID (it.f, it.image_id)) != NULL
 	  && !NILP (img->spec))
 	*object = img->spec;
@@ -5778,12 +5780,22 @@
       if (it.hpos < row->used[TEXT_AREA])
 	{
 	  struct glyph *glyph = row->glyphs[TEXT_AREA] + it.hpos;
-	  *width = glyph->pixel_width;
-	  *height = glyph->ascent + glyph->descent;
 #ifdef HAVE_WINDOW_SYSTEM
-	  if (glyph->type == IMAGE_GLYPH)
-	    *dy -= row->ascent - glyph->ascent;
+	  if (img)
+	    {
+	      *dy -= row->ascent - glyph->ascent;
+	      *dx += glyph->slice.x;
+	      *dy += glyph->slice.y;
+	      /* Image slices positions are still relative to the entire image */
+	      *width = img->width;
+	      *height = img->height;
+	    }
+	  else
 #endif
+	    {
+	      *width = glyph->pixel_width;
+	      *height = glyph->ascent + glyph->descent;
+	    }
 	}
       else
 	{
@@ -5949,6 +5961,8 @@
 	      if (img != NULL)
 		*object = img->spec;
 	      y0 -= row->ascent - glyph->ascent;
+	      x0 += glyph->slice.x;
+	      y0 += glyph->slice.y;
 	    }
 #endif
 	}