From 02adf447fd245486927f1fa6e8ec9c502d8b0c69 Mon Sep 17 00:00:00 2001 From: Geert Janssens Date: Wed, 1 Feb 2017 19:18:00 +0100 Subject: [PATCH] Bug 777875 - Reports with charts are flickering in certain circumstances This flickering was triggered by interference between scrollbar visibility changes and report reloading. Both should not happen at the same time. --- src/html/gnc-html-webkit.c | 3 +-- src/html/gnc-html.c | 14 ------------- .../report-gnome/gnc-plugin-page-report.c | 21 ++++++++++--------- 3 files changed, 12 insertions(+), 26 deletions(-) diff --git a/src/html/gnc-html-webkit.c b/src/html/gnc-html-webkit.c index 56bfd3b8f9..546ccb0d88 100644 --- a/src/html/gnc-html-webkit.c +++ b/src/html/gnc-html-webkit.c @@ -973,17 +973,16 @@ impl_webkit_show_url( GncHtml* self, URLType type, static void impl_webkit_reload( GncHtml* self, gboolean force_rebuild ) { - gnc_html_history_node * n; GncHtmlWebkitPrivate* priv; g_return_if_fail( self != NULL ); g_return_if_fail( GNC_IS_HTML_WEBKIT(self) ); priv = GNC_HTML_WEBKIT_GET_PRIVATE(self); - n = gnc_html_history_get_current( priv->base.history ); if ( force_rebuild ) { + gnc_html_history_node *n = gnc_html_history_get_current( priv->base.history ); if ( n != NULL ) gnc_html_show_url( self, n->type, n->location, n->label, 0 ); } diff --git a/src/html/gnc-html.c b/src/html/gnc-html.c index 13a2c98d3b..730461ed17 100644 --- a/src/html/gnc-html.c +++ b/src/html/gnc-html.c @@ -94,18 +94,10 @@ gnc_html_class_init( GncHtmlClass* klass ) klass->set_parent = NULL; } -static void -gnc_html_scroll_vis_cb( GtkWidget *widget, gpointer user_data ) -{ - GncHtml* self = user_data; - gnc_html_reload( self, FALSE ); //reload by view -} - static void gnc_html_init( GncHtml* self ) { GncHtmlPrivate* priv; - GtkWidget *vscroll, *hscroll; priv = self->priv = g_new0( GncHtmlPrivate, 1 ); priv->container = gtk_scrolled_window_new( NULL, NULL ); @@ -113,12 +105,6 @@ gnc_html_init( GncHtml* self ) GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC ); - vscroll = GTK_WIDGET(gtk_scrolled_window_get_vscrollbar(GTK_SCROLLED_WINDOW(priv->container))); - hscroll = GTK_WIDGET(gtk_scrolled_window_get_hscrollbar(GTK_SCROLLED_WINDOW(priv->container))); - - g_signal_connect(GTK_WIDGET(vscroll), "show", G_CALLBACK(gnc_html_scroll_vis_cb), self); - g_signal_connect(GTK_WIDGET(hscroll), "show", G_CALLBACK(gnc_html_scroll_vis_cb), self); - priv->request_info = g_hash_table_new( g_str_hash, g_str_equal ); priv->history = gnc_html_history_new(); } diff --git a/src/report/report-gnome/gnc-plugin-page-report.c b/src/report/report-gnome/gnc-plugin-page-report.c index 728ea2d7f4..993248faeb 100644 --- a/src/report/report-gnome/gnc-plugin-page-report.c +++ b/src/report/report-gnome/gnc-plugin-page-report.c @@ -160,7 +160,7 @@ static int gnc_plugin_page_report_check_urltype(URLType t); static void gnc_plugin_page_report_load_cb(GncHtml * html, URLType type, const gchar * location, const gchar * label, gpointer data); -static gboolean gnc_plugin_page_report_expose_event_cb(GtkWidget *widget, GdkEventExpose *event, gpointer user_data); +static void gnc_plugin_page_report_selected_cb(GObject *object, gpointer user_data); static void gnc_plugin_page_report_refresh (gpointer data); static void gnc_plugin_page_report_set_fwd_button(GncPluginPageReport * page, int enabled); static void gnc_plugin_page_report_set_back_button(GncPluginPageReport * page, int enabled); @@ -453,8 +453,8 @@ gnc_plugin_page_report_create_widget( GncPluginPage *page ) /* load uri when view idle */ g_idle_add ((GSourceFunc)gnc_plugin_page_report_load_uri, page); - g_signal_connect(priv->container, "expose-event", - G_CALLBACK(gnc_plugin_page_report_expose_event_cb), report); + g_signal_connect (G_OBJECT (page), "selected", + G_CALLBACK (gnc_plugin_page_report_selected_cb), report); gtk_widget_show_all( GTK_WIDGET(priv->container) ); @@ -731,26 +731,27 @@ gnc_plugin_page_report_history_destroy_cb(gnc_html_history_node * node, #endif } -/* We got a draw event. See if we need to reload the report */ -static gboolean -gnc_plugin_page_report_expose_event_cb(GtkWidget *widget, GdkEventExpose *event, gpointer user_data) +/* This page got selected by the user. See if we need to reload the report. + * This may be needed in case the window got resized while this page was not selected.*/ +static void +gnc_plugin_page_report_selected_cb (GObject *object, gpointer user_data) { - GncPluginPageReport *page = user_data; + GncPluginPageReport *page = GNC_PLUGIN_PAGE_REPORT(user_data); GncPluginPageReportPrivate *priv; - g_return_val_if_fail(GNC_IS_PLUGIN_PAGE_REPORT(page), FALSE); + g_return_if_fail(GNC_IS_PLUGIN_PAGE_REPORT(page)); priv = GNC_PLUGIN_PAGE_REPORT_GET_PRIVATE(page); ENTER( "report_draw" ); if (!priv->need_reload) { LEAVE( "no reload needed" ); - return FALSE; + return; } priv->need_reload = FALSE; gnc_html_reload(priv->html, FALSE); LEAVE( "reload forced" ); - return FALSE; + return; } // @param data is actually GncPluginPageReportPrivate