After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 763677 - Resrource graphs broken against latest gtk+
Resrource graphs broken against latest gtk+
Status: RESOLVED FIXED
Product: gnome-boxes
Classification: Applications
Component: properties
unspecified
Other Linux
: Normal normal
: --
Assigned To: GNOME Boxes maintainer(s)
GNOME Boxes maintainer(s)
Depends on:
Blocks:
 
 
Reported: 2016-03-15 12:27 UTC by Zeeshan Ali
Modified: 2016-09-20 08:15 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Zeeshan Ali 2016-03-15 12:27:21 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 ()
Comment 1 Matthias Clasen 2016-03-15 13:31:25 UTC
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.
Comment 2 Zeeshan Ali 2016-03-15 18:03:18 UTC
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..
Comment 3 Zeeshan Ali 2016-03-15 18:41:41 UTC
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.