How to set style in a GTK+ 2 widget's realize function?

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

How to set style in a GTK+ 2 widget's realize function?

Brent Baccala-2
Hi -

I've got a GTK+ 2 "external" widget (gtkdatabox from gtkdatabox.sf.net) that isn't displaying right after I've patched it to compile with GSEAL_ENABLED.

The relevant code in the older version was:

widget->style = gtk_style_attach (widget->style, widget->window);

which we changed to:

gtk_widget_set_style (widget, gtk_style_attach (gtk_widget_get_style (widget), window));

...and now the background color doesn't display right on an application (xoscope from xoscope.sf.net) that loads style from an "rc" file using gtk_rc_parse().

I don't understand GTK+ internals well enough to understand why.  If I take this line of code out completely, the background displays correctly, but colored lines in other applications (the gtkdatabox examples) don't display.

The solution I've got at the moment (other than convert the entire widget library and application to GTK+ 3) is to compile the widget without GSEAL_ENABLED and go back to the older code.

Can somebody who knows GTK+ 2 well help me out?  Any idea what's causing this and how to fix it?

Thanks.

    agape
    brent



_______________________________________________
gtk-devel-list mailing list
[hidden email]
https://mail.gnome.org/mailman/listinfo/gtk-devel-list
Reply | Threaded
Open this post in threaded view
|

Re: How to set style in a GTK+ 2 widget's realize function?

Paul Davis
I can't answer your question. But I can say that we never use gtk_style*. Instead we just parse the RC file that includes "widget/style" associations, and then we use gtk_widget_set_name() on our widgets to get them to use the right style.

On Fri, Nov 16, 2018 at 5:32 AM Brent W. Baccala <[hidden email]> wrote:
Hi -

I've got a GTK+ 2 "external" widget (gtkdatabox from gtkdatabox.sf.net) that isn't displaying right after I've patched it to compile with GSEAL_ENABLED.

The relevant code in the older version was:

widget->style = gtk_style_attach (widget->style, widget->window);

which we changed to:

gtk_widget_set_style (widget, gtk_style_attach (gtk_widget_get_style (widget), window));

...and now the background color doesn't display right on an application (xoscope from xoscope.sf.net) that loads style from an "rc" file using gtk_rc_parse().

I don't understand GTK+ internals well enough to understand why.  If I take this line of code out completely, the background displays correctly, but colored lines in other applications (the gtkdatabox examples) don't display.

The solution I've got at the moment (other than convert the entire widget library and application to GTK+ 3) is to compile the widget without GSEAL_ENABLED and go back to the older code.

Can somebody who knows GTK+ 2 well help me out?  Any idea what's causing this and how to fix it?

Thanks.

    agape
    brent


_______________________________________________
gtk-devel-list mailing list
[hidden email]
https://mail.gnome.org/mailman/listinfo/gtk-devel-list

_______________________________________________
gtk-devel-list mailing list
[hidden email]
https://mail.gnome.org/mailman/listinfo/gtk-devel-list