diff src/xterm.c @ 103023:30ed0fca4cdd

The following changes fix Bug#3005 for wide glyphs on each platform, without reintroducing Bug#1258 for stretch glyphs. * xterm.c (x_draw_bar_cursor): Limit cursor width differently for BAR_CURSOR and HBAR_CURSOR. Calculate width of HBAR_CURSOR using get_phys_cursor_geometry. * w32term.c (x_draw_bar_cursor): Limit cursor width differently for BAR_CURSOR and HBAR_CURSOR. Calculate width of HBAR_CURSOR using get_phys_cursor_geometry. * nsterm.m (ns_draw_window_cursor): HBAR_CURSOR width already correctly calculated.
author Jason Rumney <jasonr@gnu.org>
date Sun, 19 Apr 2009 15:09:25 +0000
parents 5f5d66aa8cda
children 5a5e07d71f3c
line wrap: on
line diff
--- a/src/xterm.c	Sun Apr 19 10:53:15 2009 +0000
+++ b/src/xterm.c	Sun Apr 19 15:09:25 2009 +0000
@@ -7426,7 +7426,7 @@
       XGCValues xgcv;
 
       /* If the glyph's background equals the color we normally draw
-	 the bar cursor in, the bar cursor in its normal color is
+	 the bars cursor in, the bar cursor in its normal color is
 	 invisible.  Use the glyph's foreground color instead in this
 	 case, on the assumption that the glyph's colors are chosen so
 	 that the glyph is legible.  */
@@ -7444,25 +7444,39 @@
 	  FRAME_X_DISPLAY_INFO (f)->scratch_cursor_gc = gc;
 	}
 
-      if (width < 0)
-	width = FRAME_CURSOR_WIDTH (f);
-      width = min (cursor_glyph->pixel_width, width);
-
-      w->phys_cursor_width = width;
       x_clip_to_row (w, row, TEXT_AREA, gc);
 
       if (kind == BAR_CURSOR)
+	{
+	  if (width < 0)
+	    width = FRAME_CURSOR_WIDTH (f);
+	  width = min (cursor_glyph->pixel_width, width);
+
+	  w->phys_cursor_width = width;
+
 	  XFillRectangle (dpy, window, gc,
 			  WINDOW_TEXT_TO_FRAME_PIXEL_X (w, w->phys_cursor.x),
 			  WINDOW_TO_FRAME_PIXEL_Y (w, w->phys_cursor.y),
 			  width, row->height);
+	}
       else
+	{
+	  int dummy_x, dummy_y, dummy_h;
+
+	  if (width < 0)
+	    width = row->height;
+
+	  width = min (row->height, width);
+
+	  get_phys_cursor_geometry (w, row, cursor_glyph, &dummy_x,
+				    &dummy_y, &dummy_h);
+
 	  XFillRectangle (dpy, window, gc,
 			  WINDOW_TEXT_TO_FRAME_PIXEL_X (w, w->phys_cursor.x),
 			  WINDOW_TO_FRAME_PIXEL_Y (w, w->phys_cursor.y +
 						   row->height - width),
-			  min (FRAME_COLUMN_WIDTH (f), cursor_glyph->pixel_width),
-			  width);
+			  w->phys_cursor_width, width);
+	}
 
       XSetClipMask (dpy, gc, None);
     }