emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] trunk r118149: A better fix for drawing hollow cursor on X


From: Eli Zaretskii
Subject: [Emacs-diffs] trunk r118149: A better fix for drawing hollow cursor on X on 1-pixel thin space characters.
Date: Sat, 18 Oct 2014 13:10:31 +0000
User-agent: Bazaar (2.6b2)

------------------------------------------------------------
revno: 118149
revision-id: address@hidden
parent: address@hidden
committer: Eli Zaretskii <address@hidden>
branch nick: trunk
timestamp: Sat 2014-10-18 16:09:18 +0300
message:
  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.
modified:
  src/ChangeLog                  changelog-20091113204419-o5vbwnq5f7feedwu-1438
  src/xdisp.c                    xdisp.c-20091113204419-o5vbwnq5f7feedwu-240
  src/xterm.c                    xterm.c-20091113204419-o5vbwnq5f7feedwu-244
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2014-10-18 12:47:57 +0000
+++ b/src/ChangeLog     2014-10-18 13:09:18 +0000
@@ -1,5 +1,12 @@
 2014-10-18  Eli Zaretskii  <address@hidden>
 
+       * 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

=== modified file 'src/xdisp.c'
--- a/src/xdisp.c       2014-10-14 18:10:37 +0000
+++ b/src/xdisp.c       2014-10-18 13:09:18 +0000
@@ -2302,10 +2302,7 @@
      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)

=== modified file 'src/xterm.c'
--- a/src/xterm.c       2014-10-17 16:14:37 +0000
+++ b/src/xterm.c       2014-10-18 13:09:18 +0000
@@ -7965,7 +7965,7 @@
 
   /* 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 @@
      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 @@
                                    &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);


reply via email to

[Prev in Thread] Current Thread [Next in Thread]