[gtk/getters-and-setters: 3/3] Add missing GdkDrag getters



commit 8e42286aaa23fdba8fda1c14d0ef4594eeebaa2d
Author: Matthias Clasen <mclasen redhat com>
Date:   Mon Feb 24 08:32:15 2020 -0500

    Add missing GdkDrag getters

 docs/reference/gdk/gdk4-sections.txt |  2 ++
 gdk/gdkdrag.c                        | 36 ++++++++++++++++++++++++++++++++++++
 gdk/gdkdrag.h                        |  7 +++++++
 3 files changed, 45 insertions(+)
---
diff --git a/docs/reference/gdk/gdk4-sections.txt b/docs/reference/gdk/gdk4-sections.txt
index 1a7e81db96..cb090b4f66 100644
--- a/docs/reference/gdk/gdk4-sections.txt
+++ b/docs/reference/gdk/gdk4-sections.txt
@@ -750,10 +750,12 @@ GdkDragAction
 GDK_ACTION_ALL
 
 gdk_drag_get_display
+gdk_drag_get_content
 gdk_drag_get_actions
 gdk_drag_get_selected_action
 gdk_drag_get_formats
 gdk_drag_get_device
+gdk_drag_get_surface
 gdk_drag_get_drag_surface
 gdk_drag_set_hotspot
 
diff --git a/gdk/gdkdrag.c b/gdk/gdkdrag.c
index 7dfc79e6e0..15cb169603 100644
--- a/gdk/gdkdrag.c
+++ b/gdk/gdkdrag.c
@@ -214,6 +214,42 @@ gdk_drag_get_device (GdkDrag *drag)
   return priv->device;
 }
 
+/**
+ * gdk_drag_get_content:
+ * @drag: a #GdkDrag
+ *
+ * Returns the #GdkContentProvider associated to the GdkDrag object.
+ *
+ * Returns: (transfer none): The #GdkContentProvider associated to @drag.
+ **/
+GdkContentProvider *
+gdk_drag_get_content (GdkDrag *drag)
+{
+  GdkDragPrivate *priv = gdk_drag_get_instance_private (drag);
+
+  g_return_val_if_fail (GDK_IS_DRAG (drag), NULL);
+
+  return priv->content;
+}
+
+/**
+ * gdk_drag_get_surface:
+ * @drag: a #GdkDrag
+ *
+ * Returns the #GdkSurface where the drag originates.
+ *
+ * Returns: (transfer none): The #GdkSurface where the drag originates
+ **/
+GdkSurface *
+gdk_drag_get_surface (GdkDrag *drag)
+{
+  GdkDragPrivate *priv = gdk_drag_get_instance_private (drag);
+
+  g_return_val_if_fail (GDK_IS_DRAG (drag), NULL);
+
+  return priv->surface;
+}
+
 static void
 gdk_drag_init (GdkDrag *drag)
 {
diff --git a/gdk/gdkdrag.h b/gdk/gdkdrag.h
index 80301eb293..2c093c4eb2 100644
--- a/gdk/gdkdrag.h
+++ b/gdk/gdkdrag.h
@@ -91,6 +91,13 @@ void            gdk_drag_set_hotspot (GdkDrag *drag,
                                       gint     hot_x,
                                       gint     hot_y);
 
+GDK_AVAILABLE_IN_ALL
+GdkContentProvider *
+                gdk_drag_get_content (GdkDrag *drag);
+
+GDK_AVAILABLE_IN_ALL
+GdkSurface *    gdk_drag_get_surface (GdkDrag *drag);
+
 G_END_DECLS
 
 #endif /* __GDK_DND_H__ */


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