[gtk+] selection: Add another surface api



commit 27e89c69cd939c987bf4c9d153802ac229308a5e
Author: Matthias Clasen <mclasen redhat com>
Date:   Mon Oct 23 05:22:28 2017 +0200

    selection: Add another surface api
    
    Of course, we need a getter too.

 gtk/gtkselection.c |   13 +++++++++++++
 gtk/gtkselection.h |    2 ++
 2 files changed, 15 insertions(+), 0 deletions(-)
---
diff --git a/gtk/gtkselection.c b/gtk/gtkselection.c
index 166e29f..6590fac 100644
--- a/gtk/gtkselection.c
+++ b/gtk/gtkselection.c
@@ -1750,6 +1750,19 @@ gtk_selection_data_set_surface (GtkSelectionData *selection_data,
   return retval;
 }
 
+cairo_surface_t *
+gtk_selection_data_get_surface (GtkSelectionData *selection_data)
+{
+  GdkPixbuf *pixbuf;
+  cairo_surface_t *surface;
+
+  pixbuf = gtk_selection_data_get_pixbuf (selection_data);
+  surface = gdk_cairo_surface_create_from_pixbuf (pixbuf, 1, NULL);
+  g_object_unref (pixbuf);
+
+  return surface;
+}
+
 /**
  * gtk_selection_data_get_pixbuf:
  * @selection_data: a #GtkSelectionData
diff --git a/gtk/gtkselection.h b/gtk/gtkselection.h
index e151571..200272c 100644
--- a/gtk/gtkselection.h
+++ b/gtk/gtkselection.h
@@ -225,6 +225,8 @@ GDK_AVAILABLE_IN_ALL
 gboolean gtk_selection_data_set_pixbuf   (GtkSelectionData  *selection_data,
                                           GdkPixbuf         *pixbuf);
 GDK_AVAILABLE_IN_3_94
+cairo_surface_t *gtk_selection_data_get_surface (GtkSelectionData *selection_data);
+GDK_AVAILABLE_IN_3_94
 gboolean gtk_selection_data_set_surface (GtkSelectionData  *selection_data,
                                          cairo_surface_t   *surface);
 GDK_AVAILABLE_IN_ALL


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]