Re: caret-color (and caret-width?)




From: Colomban Wendling <lists ban herbesfolles org>
To: gtk-app-devel-list gnome org
Subject: Re: caret-color (and caret-width?)
Message-ID: <6524684c-f52e-ec20-0906-b63224766ecd herbesfolles org>
Content-Type: text/plain; charset=windows-1252

Hi,

Le 26/01/2017 ? 16:57, Richard Shann a ?crit :
I see at

https://developer.gnome.org/gtk3/stable/chap-css-properties.html

that there is a caret-color property. Is it possible to change the
thickness of the text caret?

Yes:
https://developer.gnome.org/gtk3/stable/GtkWidget.html#GtkWidget--s-cursor-aspect-ratio,
that is "-GtkWidget-cursor-aspect-ratio".


I see - I did spot that cursor-aspect-ratio style item, but could not
guess that I had to prefix it with -GtkWidget-
So I have the following code which now works:

str =  "GtkTextView {-GtkWidget-cursor-aspect-ratio: 0.2;}";
gcp= gtk_css_provider_new();
gtk_css_provider_load_from_data(gcp, str, -1, 0);
gtk_style_context_add_provider(gsc, GTK_STYLE_PROVIDER(gcp), 
    GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);


and, how exactly is caret-color supposed to be set I have:

str = "GtkTextView {caret-color: rgb(255,0,80);}";

Which GTK version do you use?  this property is new in 3.20, before that
you had to use "-GtkWidget-cursor-color" instead.

ah, yes, that was the trouble, well that and not finding anything to
suggest that I needed to prefix the style property name with -GtkWidget-

thank you very much for this I'm now back on course.

Richard




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