Index: gtk/gtkstyle.c
===================================================================
--- gtk/gtkstyle.c	(revision 17943)
+++ gtk/gtkstyle.c	(working copy)
@@ -1663,6 +1663,12 @@ gtk_style_real_init_from_rc (GtkStyle   
 	style->base[i] = rc_style->base[i];
     }
 
+  /* Cursor color is style->text[GTK_STATE_NORMAL] if not set
+   * explicitly; and secondary cursor color is average of text and base
+   * colors. Destroy cursor gc's if those colors changed. */
+  if (rc_style->color_flags[GTK_STATE_NORMAL] & (GTK_RC_TEXT | GTK_RC_BASE))
+    style_unrealize_cursor_gcs (style);
+
   if (rc_style->xthickness >= 0)
     style->xthickness = rc_style->xthickness;
   if (rc_style->ythickness >= 0)
@@ -6641,24 +6647,36 @@ get_insertion_cursor_gc (GtkWidget *widg
 	}
     }
 
+  /* The natural color for cursor is the text color, and
+   * it will change as expected if one uses
+   * gtk_widget_modify_text() and gtk_widget_modify_base().
+   * Keep this in sync with gtk_style_real_init_from_rc(). */
   if (is_primary)
     {
       if (!cursor_info->primary_gc)
 	cursor_info->primary_gc = make_cursor_gc (widget,
 						  "cursor-color",
-						  &widget->style->black);
-	
+						  &widget->style->text[GTK_STATE_NORMAL]);
+
       return cursor_info->primary_gc;
     }
   else
     {
-      static const GdkColor gray = { 0, 0x8888, 0x8888, 0x8888 };
-      
       if (!cursor_info->secondary_gc)
-	cursor_info->secondary_gc = make_cursor_gc (widget,
-						    "secondary-cursor-color",
-						    &gray);
-	
+	{
+	  GdkColor gray = {0, 0x8888, 0x8888, 0x8888};
+	  GdkColor *text = &widget->style->text[GTK_STATE_NORMAL];
+	  GdkColor *base = &widget->style->base[GTK_STATE_NORMAL];
+
+	  gray.red = (text->red*17 + base->red*15) / 32;
+	  gray.green = (text->green*17 + base->green*15) / 32;
+	  gray.blue = (text->blue*17 + base->blue*15) / 32;
+
+	  cursor_info->secondary_gc = make_cursor_gc (widget,
+						      "secondary-cursor-color",
+						      &gray);
+	}
+
       return cursor_info->secondary_gc;
     }
 }
@@ -6782,5 +6800,46 @@ gtk_draw_insertion_cursor (GtkWidget    
     gdk_gc_set_clip_rectangle (gc, NULL);
 }
 
+/**
+ * _gtk_draw_block_cursor:
+ * @widget:  a #GtkWidget
+ * @drawable: a #GdkDrawable 
+ * @area: rectangle to which the output is clipped, or %NULL if the
+ *        output should not be clipped
+ * @location: location where to draw the cursor
+ * 
+ * Draws a block cursor on @drawable at @location. This is not a style function
+ * but merely a convenience function for drawing the standard cursor shape.
+ *
+ * Since: 2.12
+ **/
+void
+_gtk_draw_block_cursor (GtkWidget    *widget,
+			GdkDrawable  *drawable,
+			GdkRectangle *area,
+			GdkRectangle *location)
+{
+  GdkGC *gc;
+
+  g_return_if_fail (GTK_IS_WIDGET (widget));
+  g_return_if_fail (GDK_IS_DRAWABLE (drawable));
+  g_return_if_fail (location != NULL);
+
+  gc = get_insertion_cursor_gc (widget, TRUE);
+  if (area)
+    gdk_gc_set_clip_rectangle (gc, area);
+
+  gdk_gc_set_function (gc, GDK_OR_REVERSE);
+
+  gdk_draw_rectangle (drawable, gc, TRUE,
+		      location->x, location->y,
+		      location->width, location->height);
+
+  gdk_gc_set_function (gc, GDK_COPY);
+
+  if (area)
+    gdk_gc_set_clip_rectangle (gc, NULL);
+}
+
 #define __GTK_STYLE_C__
 #include "gtkaliasdef.c"
