]> git.eshelyaron.com Git - emacs.git/commitdiff
* nsterm.m (ns_draw_window_cursor): Fix handling of 'cursor_width' parameter for...
authorAdrian Robert <Adrian.B.Robert@gmail.com>
Mon, 7 Mar 2011 09:00:11 +0000 (11:00 +0200)
committerAdrian Robert <Adrian.B.Robert@gmail.com>
Mon, 7 Mar 2011 09:00:11 +0000 (11:00 +0200)
src/ChangeLog
src/nsterm.m

index d7131096995e23c8a661b0ba969cc5c38df3d801..7fbf3e1ef6cdd6e4ac8304f95654f6f5b52baed9 100644 (file)
@@ -1,3 +1,9 @@
+2011-03-07  Adrian Robert  <Adrian.B.Robert@gmail.com>
+
+       * nsterm.m (ns_draw_window_cursor): Fix handling of "cursor_width"
+       parameter for hbar cursors.  Based on a patch by Ben Key
+       <bkey76@gmail.com>.
+
 2011-03-06  Chong Yidong  <cyd@stupidchicken.com>
 
        * xdisp.c (redisplay_window): Revert incorrect logic in 2011-03-06
index cc2c4cf98078049507e305eddab679c854070968..c7cd411c61464a72ea06ee9049ac0c6d3eddf745 100644 (file)
@@ -2235,7 +2235,7 @@ ns_draw_window_cursor (struct window *w, struct glyph_row *glyph_row,
    -------------------------------------------------------------------------- */
 {
   NSRect r, s;
-  int fx, fy, h;
+  int fx, fy, h, cursor_height;
   struct frame *f = WINDOW_XFRAME (w);
   struct glyph *phys_cursor_glyph;
   int overspill;
@@ -2279,13 +2279,20 @@ ns_draw_window_cursor (struct window *w, struct glyph_row *glyph_row,
   get_phys_cursor_geometry (w, glyph_row, phys_cursor_glyph, &fx, &fy, &h);
 
   /* The above get_phys_cursor_geometry call set w->phys_cursor_width
-     to the glyph width; replace with CURSOR_WIDTH for bar cursors. */
-  if (cursor_type == BAR_CURSOR || cursor_type == HBAR_CURSOR)
+     to the glyph width; replace with CURSOR_WIDTH for (V)BAR cursors. */
+  if (cursor_type == BAR_CURSOR)
     {
       if (cursor_width < 1)
        cursor_width = max (FRAME_CURSOR_WIDTH (f), 1);
       w->phys_cursor_width = cursor_width;
     }
+  /* If we have an HBAR, "cursor_width" MAY specify height. */
+  else if (cursor_type == HBAR_CURSOR)
+    {
+      cursor_height = (cursor_width < 1) ? lrint (0.25 * h) : cursor_width;
+      fy += h - cursor_height;
+      h = cursor_height;
+    }
 
   r.origin.x = fx, r.origin.y = fy;
   r.size.height = h;
@@ -2337,10 +2344,7 @@ ns_draw_window_cursor (struct window *w, struct glyph_row *glyph_row,
       [FRAME_CURSOR_COLOR (f) set];
       break;
     case HBAR_CURSOR:
-      s = r;
-      s.origin.y += lrint (0.75 * s.size.height);
-      s.size.height = lrint (s.size.height * 0.25);
-      NSRectFill (s);
+      NSRectFill (r);
       break;
     case BAR_CURSOR:
       s = r;