[gimp] plug-ins: wait one second before calling webkit_web_view_get_snapshot()
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] plug-ins: wait one second before calling webkit_web_view_get_snapshot()
- Date: Wed, 27 Jun 2018 14:09:07 +0000 (UTC)
commit 2e076f82052efcf87af093aeeb087586628403bd
Author: Michael Natterer <mitch gimp org>
Date: Wed Jun 27 16:07:24 2018 +0200
plug-ins: wait one second before calling webkit_web_view_get_snapshot()
See https://bugs.webkit.org/show_bug.cgi?id=164180
plug-ins/common/web-page.c | 34 +++++++++++++++++++++++++++-------
1 file changed, 27 insertions(+), 7 deletions(-)
---
diff --git a/plug-ins/common/web-page.c b/plug-ins/common/web-page.c
index 0a8842e91e..fe87ce1c07 100644
--- a/plug-ins/common/web-page.c
+++ b/plug-ins/common/web-page.c
@@ -411,7 +411,7 @@ snapshot_ready (GObject *source_object,
gimp_image_undo_disable (webpagevals.image);
layer = gimp_layer_new_from_surface (webpagevals.image, _("Webpage"),
surface,
- 0.0, 1.0);
+ 0.25, 1.0);
gimp_image_insert_layer (webpagevals.image, layer, -1, 0);
gimp_image_undo_enable (webpagevals.image);
@@ -423,6 +423,30 @@ snapshot_ready (GObject *source_object,
gtk_main_quit ();
}
+static gboolean
+load_finished_idle (gpointer data)
+{
+ static gint count = 0;
+
+ gimp_progress_update ((gdouble) count * 0.025);
+
+ count++;
+
+ if (count < 10)
+ return G_SOURCE_CONTINUE;
+
+ webkit_web_view_get_snapshot (WEBKIT_WEB_VIEW (data),
+ WEBKIT_SNAPSHOT_REGION_FULL_DOCUMENT,
+ WEBKIT_SNAPSHOT_OPTIONS_NONE,
+ NULL,
+ snapshot_ready,
+ NULL);
+
+ count = 0;
+
+ return G_SOURCE_REMOVE;
+}
+
static void
load_changed_cb (WebKitWebView *view,
WebKitLoadEvent event,
@@ -435,12 +459,8 @@ load_changed_cb (WebKitWebView *view,
gimp_progress_init_printf (_("Transferring webpage image for '%s'"),
webpagevals.url);
- webkit_web_view_get_snapshot (view,
- WEBKIT_SNAPSHOT_REGION_FULL_DOCUMENT,
- WEBKIT_SNAPSHOT_OPTIONS_NONE,
- NULL,
- snapshot_ready,
- user_data);
+ g_timeout_add (100, load_finished_idle, view);
+
return;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]