aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/macterm.c25
-rw-r--r--src/w32term.c30
2 files changed, 7 insertions, 48 deletions
diff --git a/src/macterm.c b/src/macterm.c
index 60eee6a4a84..9304a2d62f9 100644
--- a/src/macterm.c
+++ b/src/macterm.c
@@ -4731,29 +4731,10 @@ x_draw_hollow_cursor (w, row)
4731 if (cursor_glyph == NULL) 4731 if (cursor_glyph == NULL)
4732 return; 4732 return;
4733 4733
4734 /* Compute the width of the rectangle to draw. If on a stretch 4734 /* Compute frame-relative coordinates for phys cursor. */
4735 glyph, and `x-stretch-block-cursor' is nil, don't draw a
4736 rectangle as wide as the glyph, but use a canonical character
4737 width instead. */
4738 wd = cursor_glyph->pixel_width - 1;
4739 if (cursor_glyph->type == STRETCH_GLYPH
4740 && !x_stretch_cursor_p)
4741 wd = min (FRAME_COLUMN_WIDTH (f), wd);
4742 w->phys_cursor_width = wd;
4743
4744 /* Compute frame-relative coordinates from window-relative
4745 coordinates. */
4746 x = WINDOW_TEXT_TO_FRAME_PIXEL_X (w, w->phys_cursor.x); 4735 x = WINDOW_TEXT_TO_FRAME_PIXEL_X (w, w->phys_cursor.x);
4747 y = WINDOW_TO_FRAME_PIXEL_Y (w, w->phys_cursor.y); 4736 y = get_phys_cursor_geometry (w, row, cursor_glyph, &h);
4748 4737 wd = w->phys_cursor_width;
4749 /* Compute the proper height and ascent of the rectangle, based
4750 on the actual glyph. Using the full height of the row looks
4751 bad when there are tall images on that row. */
4752 h = max (min (FRAME_LINE_HEIGHT (f), row->height),
4753 cursor_glyph->ascent + cursor_glyph->descent);
4754 if (h < row->height)
4755 y += row->ascent /* - w->phys_cursor_ascent */ + cursor_glyph->descent - h;
4756 h--;
4757 4738
4758 /* The foreground of cursor_gc is typically the same as the normal 4739 /* The foreground of cursor_gc is typically the same as the normal
4759 background color, which can cause the cursor box to be invisible. */ 4740 background color, which can cause the cursor box to be invisible. */
diff --git a/src/w32term.c b/src/w32term.c
index 838e1f57222..738f676ceaf 100644
--- a/src/w32term.c
+++ b/src/w32term.c
@@ -4937,7 +4937,7 @@ x_draw_hollow_cursor (w, row)
4937 struct frame *f = XFRAME (WINDOW_FRAME (w)); 4937 struct frame *f = XFRAME (WINDOW_FRAME (w));
4938 HDC hdc; 4938 HDC hdc;
4939 RECT rect; 4939 RECT rect;
4940 int wd, h; 4940 int h;
4941 struct glyph *cursor_glyph; 4941 struct glyph *cursor_glyph;
4942 HBRUSH hb = CreateSolidBrush (f->output_data.w32->cursor_pixel); 4942 HBRUSH hb = CreateSolidBrush (f->output_data.w32->cursor_pixel);
4943 4943
@@ -4947,34 +4947,12 @@ x_draw_hollow_cursor (w, row)
4947 if (cursor_glyph == NULL) 4947 if (cursor_glyph == NULL)
4948 return; 4948 return;
4949 4949
4950 /* Compute frame-relative coordinates from window-relative 4950 /* Compute frame-relative coordinates for phys cursor. */
4951 coordinates. */
4952 rect.left = WINDOW_TEXT_TO_FRAME_PIXEL_X (w, w->phys_cursor.x); 4951 rect.left = WINDOW_TEXT_TO_FRAME_PIXEL_X (w, w->phys_cursor.x);
4953 rect.top = (WINDOW_TO_FRAME_PIXEL_Y (w, w->phys_cursor.y) 4952 rect.top = get_phys_cursor_geometry (w, row, cursor_glyph, &h);
4954 + row->ascent - w->phys_cursor_ascent);
4955
4956 /* Compute the proper height and ascent of the rectangle, based
4957 on the actual glyph. Using the full height of the row looks
4958 bad when there are tall images on that row. */
4959 h = max (min (FRAME_LINE_HEIGHT (f), row->height),
4960 cursor_glyph->ascent + cursor_glyph->descent);
4961 if (h < row->height)
4962 rect.top += row->ascent /* - w->phys_cursor_ascent */ + cursor_glyph->descent - h;
4963 h--;
4964
4965 rect.bottom = rect.top + h; 4953 rect.bottom = rect.top + h;
4954 rect.right = rect.left + w->phys_cursor_width;
4966 4955
4967 /* Compute the width of the rectangle to draw. If on a stretch
4968 glyph, and `x-stretch-block-cursor' is nil, don't draw a
4969 rectangle as wide as the glyph, but use a canonical character
4970 width instead. */
4971 wd = cursor_glyph->pixel_width; /* TODO: Why off by one compared with X? */
4972 if (cursor_glyph->type == STRETCH_GLYPH
4973 && !x_stretch_cursor_p)
4974 wd = min (FRAME_COLUMN_WIDTH (f), wd);
4975 w->phys_cursor_width = wd;
4976
4977 rect.right = rect.left + wd;
4978 hdc = get_frame_dc (f); 4956 hdc = get_frame_dc (f);
4979 /* Set clipping, draw the rectangle, and reset clipping again. */ 4957 /* Set clipping, draw the rectangle, and reset clipping again. */
4980 w32_clip_to_row (w, row, TEXT_AREA, hdc); 4958 w32_clip_to_row (w, row, TEXT_AREA, hdc);