Re: Insertion cursor drawing improvements



On 24 Sep 2001, Owen Taylor wrote:

>  static void
> +gtk_text_view_realize_cursor_gc (GtkTextView *text_view)
> +{
> +  GdkColor *cursor_color;
> +  
> +  if (text_view->cursor_gc)
> +    gdk_gc_unref (text_view->cursor_gc);
> +
> +  gtk_widget_style_get (GTK_WIDGET (text_view), "cursor_color", &cursor_color, NULL);
> +  if (cursor_color)
> +    {
> +      text_view->cursor_gc = gdk_gc_new (text_view->text_window->bin_window);
> +      gdk_gc_set_rgb_fg_color (text_view->cursor_gc, cursor_color);
> +    }
> +  else
> +    text_view->cursor_gc = gdk_gc_ref (GTK_WIDGET (text_view)->style->base_gc[GTK_STATE_SELECTED]);
> +}


GtkEntry and GtkLabel currently does:

  GdkColor *cursor_color;
  GdkColor red = {0, 0xffff, 0x0000, 0x0000};
  
  if (entry->cursor_gc)
    gdk_gc_unref (entry->cursor_gc);

  gtk_widget_style_get (GTK_WIDGET (entry), "cursor_color", &cursor_color, NULL);
      entry->cursor_gc = gdk_gc_new (entry->text_area);
  if (cursor_color)
    gdk_gc_set_rgb_fg_color (entry->cursor_gc, cursor_color);
  else
    gdk_gc_set_rgb_fg_color (entry->cursor_gc, &red);

I.e. It uses red as the default cursor instead of base[selected], since 
using the (currently) light base[selected] color makes the cursor slightly 
hard to see.

/ Alex







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