diff options
author | Benjamin Otte <otte@redhat.com> | 2018-05-23 18:30:14 +0200 |
---|---|---|
committer | Benjamin Otte <otte@redhat.com> | 2018-06-18 23:49:52 +0200 |
commit | 05bf87cf14097880238064d47d76265d5bc1a003 (patch) | |
tree | a847ec038b92564466c0e11ec44bd2f4d18f4adf /gdk/gdkdrop.c | |
parent | 4aedf3d0034f16347f64b1d9070728a7e7ab67c9 (diff) | |
download | gtk+-05bf87cf14097880238064d47d76265d5bc1a003.tar.gz |
drop: Add GdkDrop:surface property
This replaces gdk_drag_context_get_dest_surface().
Diffstat (limited to 'gdk/gdkdrop.c')
-rw-r--r-- | gdk/gdkdrop.c | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/gdk/gdkdrop.c b/gdk/gdkdrop.c index 46ff8bc196..ad3da7a5f3 100644 --- a/gdk/gdkdrop.c +++ b/gdk/gdkdrop.c @@ -36,6 +36,7 @@ struct _GdkDropPrivate { GdkDevice *device; GdkDragContext *drag; GdkContentFormats *formats; + GdkSurface *surface; GdkDragAction actions; }; @@ -46,6 +47,7 @@ enum { PROP_DISPLAY, PROP_DRAG, PROP_FORMATS, + PROP_SURFACE, N_PROPERTIES }; @@ -118,6 +120,8 @@ gdk_drop_set_property (GObject *gobject, case PROP_DEVICE: priv->device = g_value_dup_object (value); g_assert (priv->device != NULL); + if (priv->surface) + g_assert (gdk_surface_get_display (priv->surface) == gdk_device_get_display (priv->device)); break; case PROP_DRAG: @@ -131,6 +135,15 @@ gdk_drop_set_property (GObject *gobject, #endif break; + case PROP_SURFACE: + priv->surface = g_value_dup_object (value); +#ifdef DROP_SUBCLASS + g_assert (priv->surface != NULL); + if (priv->device) + g_assert (gdk_surface_get_display (priv->surface) == gdk_device_get_display (priv->device)); +#endif + break; + default: G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec); break; @@ -168,6 +181,10 @@ gdk_drop_get_property (GObject *gobject, g_value_set_boxed (value, priv->formats); break; + case PROP_SURFACE: + g_value_set_object (value, priv->surface); + break; + default: G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, prop_id, pspec); break; @@ -271,6 +288,22 @@ gdk_drop_class_init (GdkDropClass *klass) G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS | G_PARAM_EXPLICIT_NOTIFY); + + /** + * GdkDrop:surface: + * + * The #GdkSurface the drop happens on + */ + properties[PROP_SURFACE] = + g_param_spec_object ("surface", + "Surface", + "The surface the drop is happening on", + GDK_TYPE_SURFACE, + G_PARAM_READWRITE | + G_PARAM_CONSTRUCT_ONLY | + G_PARAM_STATIC_STRINGS | + G_PARAM_EXPLICIT_NOTIFY); + g_object_class_install_properties (object_class, N_PROPERTIES, properties); } @@ -335,6 +368,24 @@ gdk_drop_get_formats (GdkDrop *self) } /** + * gdk_drop_get_surface: + * @self: a #GdkDrop + * + * Returns the #GdkSurface performing the drop. + * + * Returns: (transfer none): The #GdkSurface performing the drop. + **/ +GdkSurface * +gdk_drop_get_surface (GdkDrop *self) +{ + GdkDropPrivate *priv = gdk_drop_get_instance_private (self); + + g_return_val_if_fail (GDK_IS_DROP (self), NULL); + + return priv->surface; +} + +/** * gdk_drop_get_actions: * @self: a #GdkDrop * |