[gnome-calendar/gnome-3-18] year-view: save context before retrieving font description



commit ee9bb968db9cf4f854c8c98bcdb7e360993e3fe4
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date:   Tue Mar 8 13:27:03 2016 -0300

    year-view: save context before retrieving font description
    
    It seems that this call to gtk_style_context_get(...) causes
    a drawing loop which consumes lots of CPU cycles. Thanks to
    Sebastien Bacher for figuring this out.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=762724

 src/gcal-year-view.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)
---
diff --git a/src/gcal-year-view.c b/src/gcal-year-view.c
index ee796ab..68ac21e 100644
--- a/src/gcal-year-view.c
+++ b/src/gcal-year-view.c
@@ -545,7 +545,12 @@ draw_month_grid (GcalYearView *year_view,
   x = priv->navigator_grid->coordinates[month_nr].x;
   y = priv->navigator_grid->coordinates[month_nr].y;
 
+  /* Get the font description */
+  gtk_style_context_save (context);
+  gtk_style_context_set_state (context, state_flags | GTK_STATE_FLAG_SELECTED);
   gtk_style_context_get (context, state_flags | GTK_STATE_FLAG_SELECTED, "font", &sfont_desc, NULL);
+  gtk_style_context_restore (context);
+
   slayout = gtk_widget_create_pango_layout (widget, NULL);
   pango_layout_set_font_description (slayout, sfont_desc);
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]