diff options
| author | Eli Zaretskii | 2014-10-18 16:09:18 +0300 |
|---|---|---|
| committer | Eli Zaretskii | 2014-10-18 16:09:18 +0300 |
| commit | a4c80e35cc48376a3e35b11ee41cf3859b93efd5 (patch) | |
| tree | e8f5965310768d4e5668d6c051fabf3a60ef115a /src | |
| parent | 6b247d287327777dfd29e20eac177c2005e99b45 (diff) | |
| download | emacs-a4c80e35cc48376a3e35b11ee41cf3859b93efd5.tar.gz emacs-a4c80e35cc48376a3e35b11ee41cf3859b93efd5.zip | |
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.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 7 | ||||
| -rw-r--r-- | src/xdisp.c | 5 | ||||
| -rw-r--r-- | 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 @@ | |||
| 1 | 2014-10-18 Eli Zaretskii <eliz@gnu.org> | 1 | 2014-10-18 Eli Zaretskii <eliz@gnu.org> |
| 2 | 2 | ||
| 3 | * xterm.c (x_draw_bar_cursor, x_draw_hollow_cursor): Subtract 1 | ||
| 4 | pixel from the window's cursor glyph width, since X renders hollow | ||
| 5 | blocks 1 pixel wider than the 'width' parameter. | ||
| 6 | |||
| 7 | * xdisp.c (get_phys_cursor_geometry): Don't subtract 1 pixel from | ||
| 8 | glyph->pixel_width; this is now done in xterm.c. | ||
| 9 | |||
| 3 | Fix reordering of bracket characters in isolates. | 10 | Fix reordering of bracket characters in isolates. |
| 4 | * bidi.c (bidi_cache_find): Rename the argument NEUTRALS_OK to | 11 | * bidi.c (bidi_cache_find): Rename the argument NEUTRALS_OK to |
| 5 | RESOLVED_ONLY; when non-zero, return from the cache only fully | 12 | 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, | |||
| 2302 | glyph, and `x-stretch-block-cursor' is nil, don't draw a | 2302 | glyph, and `x-stretch-block-cursor' is nil, don't draw a |
| 2303 | rectangle as wide as the glyph, but use a canonical character | 2303 | rectangle as wide as the glyph, but use a canonical character |
| 2304 | width instead. */ | 2304 | width instead. */ |
| 2305 | wd = glyph->pixel_width - 1; | 2305 | wd = glyph->pixel_width; |
| 2306 | #if defined (HAVE_NTGUI) || defined (HAVE_NS) | ||
| 2307 | wd++; /* Why? */ | ||
| 2308 | #endif | ||
| 2309 | 2306 | ||
| 2310 | x = w->phys_cursor.x; | 2307 | x = w->phys_cursor.x; |
| 2311 | if (x < 0) | 2308 | 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) | |||
| 7965 | 7965 | ||
| 7966 | /* Compute frame-relative coordinates for phys cursor. */ | 7966 | /* Compute frame-relative coordinates for phys cursor. */ |
| 7967 | get_phys_cursor_geometry (w, row, cursor_glyph, &x, &y, &h); | 7967 | get_phys_cursor_geometry (w, row, cursor_glyph, &x, &y, &h); |
| 7968 | wd = w->phys_cursor_width; | 7968 | wd = w->phys_cursor_width - 1; |
| 7969 | 7969 | ||
| 7970 | /* The foreground of cursor_gc is typically the same as the normal | 7970 | /* The foreground of cursor_gc is typically the same as the normal |
| 7971 | background color, which can cause the cursor box to be invisible. */ | 7971 | 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) | |||
| 7981 | glyph, unless the cursor box is as wide as the glyph or wider | 7981 | glyph, unless the cursor box is as wide as the glyph or wider |
| 7982 | (the latter happens when x-stretch-cursor is non-nil). */ | 7982 | (the latter happens when x-stretch-cursor is non-nil). */ |
| 7983 | if ((cursor_glyph->resolved_level & 1) != 0 | 7983 | if ((cursor_glyph->resolved_level & 1) != 0 |
| 7984 | && cursor_glyph->pixel_width > w->phys_cursor_width) | 7984 | && cursor_glyph->pixel_width > wd) |
| 7985 | { | 7985 | { |
| 7986 | x += cursor_glyph->pixel_width - w->phys_cursor_width; | 7986 | x += cursor_glyph->pixel_width - wd; |
| 7987 | if (wd > 0) | 7987 | if (wd > 0) |
| 7988 | wd -= 1; | 7988 | wd -= 1; |
| 7989 | } | 7989 | } |
| @@ -8086,12 +8086,12 @@ x_draw_bar_cursor (struct window *w, struct glyph_row *row, int width, enum text | |||
| 8086 | &dummy_y, &dummy_h); | 8086 | &dummy_y, &dummy_h); |
| 8087 | 8087 | ||
| 8088 | if ((cursor_glyph->resolved_level & 1) != 0 | 8088 | if ((cursor_glyph->resolved_level & 1) != 0 |
| 8089 | && cursor_glyph->pixel_width > w->phys_cursor_width) | 8089 | && cursor_glyph->pixel_width > w->phys_cursor_width - 1) |
| 8090 | x += cursor_glyph->pixel_width - w->phys_cursor_width; | 8090 | x += cursor_glyph->pixel_width - w->phys_cursor_width + 1; |
| 8091 | XFillRectangle (dpy, window, gc, x, | 8091 | XFillRectangle (dpy, window, gc, x, |
| 8092 | WINDOW_TO_FRAME_PIXEL_Y (w, w->phys_cursor.y + | 8092 | WINDOW_TO_FRAME_PIXEL_Y (w, w->phys_cursor.y + |
| 8093 | row->height - width), | 8093 | row->height - width), |
| 8094 | w->phys_cursor_width, width); | 8094 | w->phys_cursor_width - 1, width); |
| 8095 | } | 8095 | } |
| 8096 | 8096 | ||
| 8097 | XSetClipMask (dpy, gc, None); | 8097 | XSetClipMask (dpy, gc, None); |