]> code.delx.au - gnu-emacs/commitdiff
(x_draw_hollow_cursor): Sync with xterm.c
authorJason Rumney <jasonr@gnu.org>
Sat, 1 May 2004 10:10:36 +0000 (10:10 +0000)
committerJason Rumney <jasonr@gnu.org>
Sat, 1 May 2004 10:10:36 +0000 (10:10 +0000)
src/ChangeLog
src/w32term.c

index f8a9e5fb767658bc90e7352fee27e123e95928d1..46dbdcb2fc0e5bf8ac17efbaf142740f30f0e807 100644 (file)
@@ -1,3 +1,7 @@
+2004-05-01  Jason Rumney  <jasonr@gnu.org>
+
+       * w32term.c (x_draw_hollow_cursor): Sync with xterm.c
+
 2004-04-30  Kim F. Storm  <storm@cua.dk>
 
        * buffer.c (syms_of_buffer) <line-spacing>: Allow float value.
index 6654b1a4087f2348289f67502857db7558cf8eae..93a3d7d61c9d89f71f594aaf567c5b737ceb7087 100644 (file)
@@ -4177,8 +4177,7 @@ w32_read_socket (sd, expected, hold_quit)
   /* 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 @@ x_draw_hollow_cursor (w, row)
   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);