[Xfce4-commits] <tumbler:jeromeg/webkit-thumbnailer> Move the capturing routine in a idle handler.
Jérôme Guelfucci
noreply at xfce.org
Sat Jun 4 13:38:01 CEST 2011
Updating branch refs/heads/jeromeg/webkit-thumbnailer
to 5da5de92e1d68f3a2ba64cd8fea3286f52c037c6 (commit)
from 900a5f52a925bfb6db5cdcc4e03e9add6db052e8 (commit)
commit 5da5de92e1d68f3a2ba64cd8fea3286f52c037c6
Author: Jérôme Guelfucci <jeromeg at xfce.org>
Date: Sat Jun 4 13:35:58 2011 +0200
Move the capturing routine in a idle handler.
plugins/webkit-thumbnailer/webkit-thumbnailer.c | 28 +++++++++++++++++-----
1 files changed, 21 insertions(+), 7 deletions(-)
diff --git a/plugins/webkit-thumbnailer/webkit-thumbnailer.c b/plugins/webkit-thumbnailer/webkit-thumbnailer.c
index f79dcfe..4314091 100644
--- a/plugins/webkit-thumbnailer/webkit-thumbnailer.c
+++ b/plugins/webkit-thumbnailer/webkit-thumbnailer.c
@@ -99,6 +99,25 @@ webkit_thumbnailer_class_finalize (WebkitThumbnailerClass *klass)
+static gboolean
+cb_view_loaded_idle (gpointer webkit_thumbnailer)
+{
+ WebkitThumbnailer *thumbnailer;
+
+ thumbnailer = WEBKIT_THUMBNAILER (webkit_thumbnailer);
+
+ /* snapshot the offscreen window */
+ thumbnailer->tmp =
+ gtk_offscreen_window_get_pixbuf (GTK_OFFSCREEN_WINDOW (thumbnailer->offscreen));
+
+ /* done, exit the main loop */
+ gtk_main_quit ();
+
+ return FALSE;
+}
+
+
+
static void
cb_view_load_finished (GtkWidget *web_view,
WebKitWebFrame *web_frame,
@@ -106,16 +125,11 @@ cb_view_load_finished (GtkWidget *web_view,
{
/* force a redraw of the offscreen window to make sure we snapshot
* the latest visual changes */
- gtk_widget_queue_draw (web_view);
+ gtk_widget_queue_draw (thumbnailer->view);
gdk_window_process_updates (gtk_widget_get_window (thumbnailer->offscreen),
TRUE);
- /* snapshot the offscreen window */
- thumbnailer->tmp =
- gtk_offscreen_window_get_pixbuf (GTK_OFFSCREEN_WINDOW (thumbnailer->offscreen));
-
- /* done, exit the main loop */
- gtk_main_quit ();
+ g_idle_add (cb_view_loaded_idle, thumbnailer);
}
More information about the Xfce4-commits
mailing list