5461
5462
g_return_val_if_fail (MIDORI_IS_VIEW (view), NULL);
5464
#ifdef HAVE_WEBKIT2_A
5465
webkit_web_view_get_snapshot (WEBKIT_WEB_VIEW (view->web_view),
5466
WEBKIT_SNAPSHOT_REGION_VISIBLE, WEBKIT_SNAPSHOT_OPTIONS_NONE,
5467
NULL, midori_view_get_snapshot_cb, view);
5469
GtkAllocation allocation;
5472
#if !GTK_CHECK_VERSION (3, 0, 0)
5478
GdkColormap* colormap;
5480
cairo_surface_t* surface;
5484
gtk_widget_get_allocation (view->web_view, &allocation);
5488
#if GTK_CHECK_VERSION (3, 0, 0)
5489
surface = cairo_image_surface_create (CAIRO_FORMAT_RGB24,
5490
allocation.width, allocation.height);
5491
cr = cairo_create (surface);
5492
cairo_rectangle (cr, x, y, width, height);
5494
gtk_widget_draw (view->web_view, cr);
5495
pixbuf = gdk_pixbuf_get_from_surface (surface, x, y, width, height);
5496
cairo_surface_destroy (surface);
5499
w = allocation.width;
5500
h = allocation.height;
5506
window = gtk_widget_get_window (view->web_view);
5507
g_return_val_if_fail (window != NULL, NULL);
5509
pixmap = gdk_pixmap_new (window, w, h, gdk_drawable_get_depth (window));
5510
event.expose.type = GDK_EXPOSE;
5511
event.expose.window = pixmap;
5512
event.expose.send_event = FALSE;
5513
event.expose.count = 0;
5514
event.expose.area.x = 0;
5515
event.expose.area.y = 0;
5516
gdk_drawable_get_size (GDK_DRAWABLE (window),
5517
&event.expose.area.width, &event.expose.area.height);
5518
event.expose.region = gdk_region_rectangle (&event.expose.area);
5520
g_signal_emit_by_name (view->web_view, "expose-event", &event, &result);
5522
colormap = gdk_drawable_get_colormap (pixmap);
5523
pixbuf = gdk_pixbuf_get_from_drawable (NULL, pixmap, colormap, 0, 0,
5524
0, 0, rect.width, rect.height);
5525
g_object_unref (pixmap);
5529
GdkPixbuf* scaled = gdk_pixbuf_scale_simple (pixbuf, width, height,
5531
g_object_unref (pixbuf);
5464
return view->icon ? g_object_ref (view->icon) : NULL;