GNOME Bugzilla – Bug 763677
Resrource graphs broken against latest gtk+
Last modified: 2016-09-20 08:15:55 UTC
The graphs show a thick line and I see the following all over the console: (gnome-boxes:6429): Gtk-WARNING **: State 0 for BoxesResourceGraph 0x2a1fbe0 doesn't match state 128 set via gtk_style_context_set_state ()
Things like Gdk.cairo_set_source_rgba (cr, style.get_color (Gtk.StateFlags.NORMAL)); don't work anymore. You get the warning unless you pass the style's state into get_color. And if you want to use a fixed state, like NORMAL, you have to save the context, set its state and then call get_color. But what this code does looks a bit fishy anyway: you render background according to the widgets actual state (nevermind that you should use gtk_render_background instead of get_background_color), and then draw on top with the color according to the NORMAL state. That really should use the same state both times, anything else is a recipe for bad color combinations.
Turns out graph is rendered correctly, just that the resources weren't very much used at the time so the graphs were just a line at the bottom. :) However, there was a regression with regards to drawing of background and also this warning..
commit: 4f16e8e 4f16e8e8abfedc21fb7fe9bbcbd83ba636e7d975 Date: Tue Mar 15 18:15:06 2016 +0000 resource-graph: Don't style using classnames This doesn't work anymore with latest gtk+. commit: 134f297 134f29782663a1471ac7a2431823d029dbe7c875 Date: Tue Mar 15 18:21:30 2016 +0000 res-graph: Make use of GtkStyle.render_background() commit: 745383c 745383cb96f4d22e2998344ccb9bf948b3843710 Date: Tue Mar 15 18:22:48 2016 +0000 graph: Use style's state to draw rather than widget's Passing a fixed state to Gtk.StyleContext.get_color() will result in warnings on the console with latest gtk+ and is not supported way of doing things anymore. This patch sets the required state on the style and then uses the style's state to get the color for that state.