diff -Nru psensor-1.1.3/debian/changelog psensor-1.1.3/debian/changelog --- psensor-1.1.3/debian/changelog 2015-11-02 16:40:28.000000000 +0100 +++ psensor-1.1.3/debian/changelog 2016-07-11 10:59:55.000000000 +0200 @@ -1,3 +1,11 @@ +psensor (1.1.3-2ubuntu4) xenial; urgency=medium + + * debian/patches/lp1582930.diff + - Fixed CPU overuse when focus is lost. (LP: #1582930) + - Fixed compilation failure with recent version of MHD. + + -- Jean-Philippe Orsini Mon, 06 Jun 2016 16:16:50 +0200 + psensor (1.1.3-2ubuntu3) xenial; urgency=medium * No-change rebuild against new gnome libraries diff -Nru psensor-1.1.3/debian/patches/lp1582930.diff psensor-1.1.3/debian/patches/lp1582930.diff --- psensor-1.1.3/debian/patches/lp1582930.diff 1970-01-01 01:00:00.000000000 +0100 +++ psensor-1.1.3/debian/patches/lp1582930.diff 2016-07-11 11:56:17.000000000 +0200 @@ -0,0 +1,175 @@ +Description: Fixed CPU overuse when focus is lost. +Author: Jean-Philippe Orsini +Origin: upstream, https://wpitchoune.net/gitweb/?p=psensor.git;a=commit;h=9a85d16663d7837698a3b00574a0652db1f849af +Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/psensor/+bug/1582930 +--- a/src/graph.c ++++ b/src/graph.c +@@ -52,13 +52,26 @@ + int height; + /* Width of the drawing canvas */ + int width; +- +- /* Background color of the current desktop theme */ +- GdkRGBA theme_bg_color; +- /* Foreground color of the current desktop theme */ +- GdkRGBA theme_fg_color; + }; + ++static GtkStyleContext *style; ++/* Foreground color of the current desktop theme */ ++static GdkRGBA theme_fg_color; ++/* Background color of the current desktop theme */ ++static GdkRGBA theme_bg_color; ++ ++static void update_theme(GtkWidget *w) ++{ ++ style = gtk_widget_get_style_context(w); ++ ++ gtk_style_context_get_background_color(style, ++ GTK_STATE_FLAG_NORMAL, ++ &theme_bg_color); ++ gtk_style_context_get_color(style, ++ GTK_STATE_FLAG_NORMAL, ++ &theme_fg_color); ++} ++ + /* Return the end time of the graph i.e. the more recent measure. If + * no measure are available, return 0. + * If Bezier curves are used return the measure n-3 to avoid to +@@ -137,9 +150,9 @@ + static void draw_left_region(cairo_t *cr, struct graph_info *info) + { + cairo_set_source_rgb(cr, +- info->theme_bg_color.red, +- info->theme_bg_color.green, +- info->theme_bg_color.blue); ++ theme_bg_color.red, ++ theme_bg_color.green, ++ theme_bg_color.blue); + + cairo_rectangle(cr, 0, 0, info->g_xoff, info->height); + cairo_fill(cr); +@@ -148,9 +161,9 @@ + static void draw_right_region(cairo_t *cr, struct graph_info *info) + { + cairo_set_source_rgb(cr, +- info->theme_bg_color.red, +- info->theme_bg_color.green, +- info->theme_bg_color.blue); ++ theme_bg_color.red, ++ theme_bg_color.green, ++ theme_bg_color.blue); + + + cairo_rectangle(cr, +@@ -172,15 +185,15 @@ + + if (config->alpha_channel_enabled) + cairo_set_source_rgba(cr, +- info->theme_bg_color.red, +- info->theme_bg_color.green, +- info->theme_bg_color.blue, ++ theme_bg_color.red, ++ theme_bg_color.green, ++ theme_bg_color.blue, + config->graph_bg_alpha); + else + cairo_set_source_rgb(cr, +- info->theme_bg_color.red, +- info->theme_bg_color.green, +- info->theme_bg_color.blue); ++ theme_bg_color.red, ++ theme_bg_color.green, ++ theme_bg_color.blue); + + cairo_rectangle(cr, info->g_xoff, 0, info->g_width, info->height); + cairo_fill(cr); +@@ -448,6 +461,9 @@ + if (!gtk_widget_is_drawable(w_graph)) + return; + ++ if (!style) ++ update_theme(window); ++ + enabled_sensors = psensor_list_filter_graph_enabled(sensors); + + min_rpm = get_min_rpm(enabled_sensors); +@@ -508,14 +524,6 @@ + + info.g_xoff = g_xoff; + +- style_ctx = gtk_widget_get_style_context(window); +- gtk_style_context_get_background_color(style_ctx, +- GTK_STATE_FLAG_NORMAL, +- &info.theme_bg_color); +- gtk_style_context_get_color(style_ctx, +- GTK_STATE_FLAG_NORMAL, +- &info.theme_fg_color); +- + g_width = width - g_xoff - GRAPH_H_PADDING; + info.g_width = g_width; + +@@ -523,9 +531,9 @@ + + /* Set the color for text drawing */ + cairo_set_source_rgb(cr, +- info.theme_fg_color.red, +- info.theme_fg_color.green, +- info.theme_fg_color.blue); ++ theme_fg_color.red, ++ theme_fg_color.green, ++ theme_fg_color.blue); + + /* draw graph begin time */ + cairo_move_to(cr, g_xoff, height - GRAPH_V_PADDING); +@@ -589,9 +597,9 @@ + + /* draw min and max temp */ + cairo_set_source_rgb(cr, +- info.theme_fg_color.red, +- info.theme_fg_color.green, +- info.theme_fg_color.blue); ++ theme_fg_color.red, ++ theme_fg_color.green, ++ theme_fg_color.blue); + + cairo_move_to(cr, GRAPH_H_PADDING, te_max.height + GRAPH_V_PADDING); + cairo_show_text(cr, strmax); +--- a/src/server/server.c ++++ b/src/server/server.c +@@ -192,8 +192,8 @@ + if (page) { + *rp_code = MHD_HTTP_OK; + +- resp = MHD_create_response_from_data(strlen(page), page, +- MHD_YES, MHD_NO); ++ resp = MHD_create_response_from_buffer(strlen(page), page, ++ MHD_RESPMEM_MUST_FREE); + + MHD_add_response_header(resp, MHD_HTTP_HEADER_CONTENT_TYPE, + "application/json"); +@@ -223,8 +223,8 @@ + + if (!st.st_size) { + fclose(file); +- return MHD_create_response_from_data +- (0, NULL, MHD_NO, MHD_NO); ++ return MHD_create_response_from_buffer ++ (0, NULL, 0); + } + + return MHD_create_response_from_callback +@@ -263,10 +263,9 @@ + char *page = strdup(PAGE_NOT_FOUND); + *rp_code = MHD_HTTP_NOT_FOUND; + +- return MHD_create_response_from_data(strlen(page), +- page, +- MHD_YES, +- MHD_NO); ++ return MHD_create_response_from_buffer(strlen(page), ++ page, ++ MHD_RESPMEM_MUST_FREE); + } + + static int cbk_http_request(void *cls, diff -Nru psensor-1.1.3/debian/patches/series psensor-1.1.3/debian/patches/series --- psensor-1.1.3/debian/patches/series 1970-01-01 01:00:00.000000000 +0100 +++ psensor-1.1.3/debian/patches/series 2016-07-11 10:40:23.000000000 +0200 @@ -0,0 +1 @@ +lp1582930.diff