[vinagre] Added a default implementation for tab_get_screenshot()
- From: Jonh Wendell <jwendell src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vinagre] Added a default implementation for tab_get_screenshot()
- Date: Fri, 8 Oct 2010 19:49:02 +0000 (UTC)
commit fde9c322bd35543c5fc3d477625d55b1c21be440
Author: Jonh Wendell <jwendell gnome org>
Date: Fri Oct 8 16:25:29 2010 -0300
Added a default implementation for tab_get_screenshot()
Which relies on gtk_widget_draw, and might not work on all
sort of widgets
vinagre/vinagre-tab.c | 25 ++++++++++++++++++++++++-
1 files changed, 24 insertions(+), 1 deletions(-)
---
diff --git a/vinagre/vinagre-tab.c b/vinagre/vinagre-tab.c
index 43a72cf..3385988 100644
--- a/vinagre/vinagre-tab.c
+++ b/vinagre/vinagre-tab.c
@@ -219,6 +219,29 @@ default_get_extra_title (VinagreTab *tab)
return NULL;
}
+static GdkPixbuf *
+default_get_screenshot (VinagreTab *tab)
+{
+ cairo_t *cr;
+ cairo_surface_t *s;
+ GtkAllocation alloc;
+ GdkPixbuf *pix;
+
+ gtk_widget_get_allocation (tab->priv->view, &alloc);
+ s = cairo_image_surface_create (CAIRO_FORMAT_RGB24, alloc.width, alloc.height);
+ cr = cairo_create (s);
+ gtk_widget_draw (tab->priv->view, cr);
+ pix = gdk_pixbuf_get_from_surface (cairo_get_target (cr),
+ 0,
+ 0,
+ alloc.width,
+ alloc.height);
+ cairo_destroy (cr);
+ cairo_surface_destroy (s);
+
+ return pix;
+}
+
static void
menu_position (GtkMenu *menu,
gint *x,
@@ -380,7 +403,7 @@ vinagre_tab_class_init (VinagreTabClass *klass)
object_class->constructed = vinagre_tab_constructed;
klass->impl_get_tooltip = NULL;
- klass->impl_get_screenshot = NULL;
+ klass->impl_get_screenshot = default_get_screenshot;
klass->impl_get_dimensions = default_get_dimensions;
klass->impl_get_always_sensitive_actions = default_get_always_sensitive_actions;
klass->impl_get_connected_actions = default_get_connected_actions;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]