On Sun, 2017-05-07 at 10:05 +0200, Johan Vromans wrote:
> On Sat, 06 May 2017 21:56:40 +0100, Richard Shann <[email protected]>
> wrote:
>
> > On Sat, 2017-05-06 at 22:21 +0200, Johan Vromans wrote:
> > > Built from latest git. The VK is empty except for the letter "C". It
> > > *is* sensitive (clicking with the mouse enters notes).
> > >
> > > Fedora 25.
> >
> > Try
> >
> > denemo --version
> >
> > to find the Gtk version you are compiling and running with.
>
> Gtk versions runtime: 3.22.11, compiled against: 3.22.12,
It sounds like they are changing the CSS style syntax between different
versions of Gtk. The documentation is often missing, so I can't be sure.
Can you compile and run this small test code (the first line gives the
command for compiling and linking at the command line. Then you run the
resultant executable as
./TextStyleChange
which should popup a label with yellow background and red (?) text.
the virtual keyboard should be showing black and white, but is not.
Richard
//gcc -Wall TestStyleChange.c -o TestStyleChange `pkg-config --cflags --libs gtk+-3.0`
//Tested on debian 3.16.0 and GTK3.14.5
#include<gtk/gtk.h>
void set_background_color(GtkWidget *w, gchar *color)
{
GtkCssProvider *gcp;
GtkStyleContext *gsc;
gsc = gtk_widget_get_style_context(w);
const gchar *type = g_type_name (G_TYPE_FROM_INSTANCE (w));
gchar *str = g_strdup_printf ("%s {background-color: %s;}", type, color);
gcp= gtk_css_provider_new();
gtk_css_provider_load_from_data(gcp, str, -1, 0);
g_free (str);
gtk_style_context_add_provider(gsc, GTK_STYLE_PROVIDER(gcp),
GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
}
void set_foreground_color(GtkWidget *w, gchar *color)
{
GtkCssProvider *gcp;
GtkStyleContext *gsc;
gsc = gtk_widget_get_style_context(w);
const gchar *type = g_type_name (G_TYPE_FROM_INSTANCE (w));
gchar *str = g_strdup_printf ("%s {color: %s;}", type, color);
gcp= gtk_css_provider_new();
gtk_css_provider_load_from_data(gcp, str, -1, 0);
g_free (str);
gtk_style_context_add_provider(gsc, GTK_STYLE_PROVIDER(gcp),
GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
}
int main(int argc, char **argv)
{
gtk_init(&argc, &argv);
GtkWidget *top_window=gtk_window_new(GTK_WINDOW_TOPLEVEL);
g_signal_connect (top_window, "destroy", G_CALLBACK(gtk_main_quit), NULL);
GtkWidget *eventbox = gtk_event_box_new ();
GtkWidget *label=gtk_label_new("Label");
set_background_color (label, "#FFFF00");
set_foreground_color (label, "#FF00FF");
gtk_widget_set_size_request(label, 400, 400);
gtk_container_add (GTK_CONTAINER (eventbox), label);
gtk_container_add (GTK_CONTAINER(top_window), eventbox);
gtk_widget_show_all (top_window);
gtk_main();
return 0;
}
_______________________________________________
Denemo-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/denemo-devel