From a4c80e35cc48376a3e35b11ee41cf3859b93efd5 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sat, 18 Oct 2014 16:09:18 +0300 Subject: [PATCH] A better fix for drawing hollow cursor on X on 1-pixel thin space characters. src/xterm.c (x_draw_bar_cursor, x_draw_hollow_cursor): Subtract 1 pixel from the window's cursor glyph width, since X renders hollow blocks 1 pixel wider than the 'width' parameter. src/xdisp.c (get_phys_cursor_geometry): Don't subtract 1 pixel from glyph->pixel_width; this is now done in xterm.c. --- src/ChangeLog | 7 +++++++ src/xdisp.c | 5 +---- src/xterm.c | 12 ++++++------ 3 files changed, 14 insertions(+), 10 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index 66306bd5fb6..a28ae469001 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,12 @@ 2014-10-18 Eli Zaretskii + * xterm.c (x_draw_bar_cursor, x_draw_hollow_cursor): Subtract 1 + pixel from the window's cursor glyph width, since X renders hollow + blocks 1 pixel wider than the 'width' parameter. + + * xdisp.c (get_phys_cursor_geometry): Don't subtract 1 pixel from + glyph->pixel_width; this is now done in xterm.c. + Fix reordering of bracket characters in isolates. * bidi.c (bidi_cache_find): Rename the argument NEUTRALS_OK to RESOLVED_ONLY; when non-zero, return from the cache only fully diff --git a/src/xdisp.c b/src/xdisp.c index 7c3aaa2042e..ad28dacf4e5 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -2302,10 +2302,7 @@ get_phys_cursor_geometry (struct window *w, struct glyph_row *row, 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 = glyph->pixel_width - 1; -#if defined (HAVE_NTGUI) || defined (HAVE_NS) - wd++; /* Why? */ -#endif + wd = glyph->pixel_width; x = w->phys_cursor.x; if (x < 0) diff --git a/src/xterm.c b/src/xterm.c index 334eafcd3fe..a1e338b54ee 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -7965,7 +7965,7 @@ x_draw_hollow_cursor (struct window *w, struct glyph_row *row) /* Compute frame-relative coordinates for phys cursor. */ get_phys_cursor_geometry (w, row, cursor_glyph, &x, &y, &h); - wd = w->phys_cursor_width; + wd = w->phys_cursor_width - 1; /* The foreground of cursor_gc is typically the same as the normal background color, which can cause the cursor box to be invisible. */ @@ -7981,9 +7981,9 @@ x_draw_hollow_cursor (struct window *w, struct glyph_row *row) glyph, unless the cursor box is as wide as the glyph or wider (the latter happens when x-stretch-cursor is non-nil). */ if ((cursor_glyph->resolved_level & 1) != 0 - && cursor_glyph->pixel_width > w->phys_cursor_width) + && cursor_glyph->pixel_width > wd) { - x += cursor_glyph->pixel_width - w->phys_cursor_width; + x += cursor_glyph->pixel_width - wd; if (wd > 0) wd -= 1; } @@ -8086,12 +8086,12 @@ x_draw_bar_cursor (struct window *w, struct glyph_row *row, int width, enum text &dummy_y, &dummy_h); if ((cursor_glyph->resolved_level & 1) != 0 - && cursor_glyph->pixel_width > w->phys_cursor_width) - x += cursor_glyph->pixel_width - w->phys_cursor_width; + && cursor_glyph->pixel_width > w->phys_cursor_width - 1) + x += cursor_glyph->pixel_width - w->phys_cursor_width + 1; XFillRectangle (dpy, window, gc, x, WINDOW_TO_FRAME_PIXEL_Y (w, w->phys_cursor.y + row->height - width), - w->phys_cursor_width, width); + w->phys_cursor_width - 1, width); } XSetClipMask (dpy, gc, None); -- 2.39.5