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.
This commit is contained in:
Geert Janssens 2017-02-01 19:18:00 +01:00
parent 5a144699b9
commit 02adf447fd
3 changed files with 12 additions and 26 deletions

View File

@ -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 );
}

View File

@ -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();
}

View File

@ -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