diff src/w32term.c @ 83117:46882e012e30

Merged in changes from CVS trunk. Patches applied: * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-268 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-269 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-270 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-271 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-272 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-273 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-274 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-275 Update from CVS: man/makefile.w32-in: Revert last change * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-276 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-277 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-278 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-279 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-280 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-281 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-282 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-283 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-284 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-285 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-286 Update from CVS git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-157
author Karoly Lorentey <lorentey@elte.hu>
date Fri, 07 May 2004 14:20:00 +0000
parents 30dd490f06f2 b4bf3dd67827
children ad01ab3c6f4d
line wrap: on
line diff
--- a/src/w32term.c	Sat May 01 19:23:22 2004 +0000
+++ b/src/w32term.c	Fri May 07 14:20:00 2004 +0000
@@ -4177,8 +4177,7 @@
   /* So people can tell when we have read the available input.  */
   input_signal_count++;
 
-  /* TODO: tool-bars, ghostscript integration, mouse
-     cursors. */
+  /* TODO: ghostscript integration. */
   while (get_next_msg (&msg, FALSE))
     {
       struct input_event inev;
@@ -4934,28 +4933,38 @@
   struct frame *f = XFRAME (WINDOW_FRAME (w));
   HDC hdc;
   RECT rect;
-  int wd;
+  int wd, h;
   struct glyph *cursor_glyph;
   HBRUSH hb = CreateSolidBrush (f->output_data.w32->cursor_pixel);
 
+  /* Get the glyph the cursor is on.  If we can't tell because
+     the current matrix is invalid or such, give up.  */
+  cursor_glyph = get_phys_cursor_glyph (w);
+  if (cursor_glyph == NULL)
+    return;
+
   /* Compute frame-relative coordinates from window-relative
      coordinates.  */
   rect.left = WINDOW_TEXT_TO_FRAME_PIXEL_X (w, w->phys_cursor.x);
   rect.top = (WINDOW_TO_FRAME_PIXEL_Y (w, w->phys_cursor.y)
               + row->ascent - w->phys_cursor_ascent);
-  rect.bottom = rect.top + row->height;
-
-  /* Get the glyph the cursor is on.  If we can't tell because
-     the current matrix is invalid or such, give up.  */
-  cursor_glyph = get_phys_cursor_glyph (w);
-  if (cursor_glyph == NULL)
-    return;
+
+  /* Compute the proper height and ascent of the rectangle, based
+     on the actual glyph.  Using the full height of the row looks
+     bad when there are tall images on that row.  */
+  h = max (min (FRAME_LINE_HEIGHT (f), row->height),
+	   cursor_glyph->ascent + cursor_glyph->descent);
+  if (h < row->height)
+    rect.top += row->ascent /* - w->phys_cursor_ascent */ + cursor_glyph->descent - h;
+  h--;
+
+  rect.bottom = rect.top + h;
 
   /* Compute the width of the rectangle to draw.  If on a stretch
      glyph, and `x-stretch-block-cursor' is nil, don't draw a
      rectangle as wide as the glyph, but use a canonical character
      width instead.  */
-  wd = cursor_glyph->pixel_width;
+  wd = cursor_glyph->pixel_width; /* TODO: Why off by one compared with X? */
   if (cursor_glyph->type == STRETCH_GLYPH
       && !x_stretch_cursor_p)
     wd = min (FRAME_COLUMN_WIDTH (f), wd);