GNOME Bugzilla – Bug 396198
custom widget example ignores fg color
Last modified: 2008-02-19 02:37:55 UTC
in examples/book/custom/custom_widget/mywidget.cc, MyWidget::on_realize() sets foreground color to blue, but the triangle is drawn in black.
Even worse, I'm currently seeing nothing but a red square when I run that example.
I think that's because the triangle is drawn using the value of m_scale read from the custom_gtkrc file as a multiplier. But I see this on the output when I run the example: m_scale (example_scale from the theme/rc-file) is: 0 Which implies that that parameter is not being parsed correctly for some reason. Does this have anything to do with the fact that the custom_gtkrc file uses the identifier "Gtkmm__CustomObject_mywidget" (capital G) whereas the output of the program indicates that the GType is "gtkmm__CustomObject_mywidget" (lowercase g)? I tried changing the custom_gtkrc file to use the lowercase version, but I got the following error: custom_gtkrc:3: error: invalid identifier `gtkmm__CustomObject_mywidget', expected valid identifier
Yes, the style stuff won't work until this GTK+ patch is applied: http://bugzilla.gnome.org/show_bug.cgi?id=343012 I guess I need to fix the code to make it more forgiving of that.
By the way, while I was looking at this issue, I thought I'd update this example to use cairo drawing instead of GDK drawing. Would you like me to commit those changes?
Sure. The GtkDrawingArea example used in the book already does this, but we need it here too.
OK, I've committed an update to the example so it uses cairo for drawing now. I didn't make any other changes yet, since I wasn't sure how you wanted to resolve this bug, so it still doesn't actually draw anything.
adding bug #343012 as a dependency
So after adding that as a dependency, I noticed that it's actually fixed, so I've committed the minor change to the gtkrc file and this example now works again.