mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-11-10 10:50:10 +00:00
drop: Ensure all relevant formats are available
1. GdkDrop does deserialization, so add the deserialize formats 2. If the drop is local, we can copy straight from the drag, so we can also copy all its formats. This fixes cases where the backend would drop formats it doesn't support.
This commit is contained in:
parent
5f7054862b
commit
a824da66d9
@ -162,6 +162,23 @@ gdk_drop_read_local_finish (GdkDrop *self,
|
||||
return g_task_propagate_pointer (G_TASK (result), error);
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_drop_add_formats (GdkDrop *self,
|
||||
GdkContentFormats *formats)
|
||||
{
|
||||
GdkDropPrivate *priv = gdk_drop_get_instance_private (self);
|
||||
|
||||
formats = gdk_content_formats_union_deserialize_gtypes (gdk_content_formats_ref (formats));
|
||||
|
||||
if (priv->formats)
|
||||
{
|
||||
formats = gdk_content_formats_union (formats, priv->formats);
|
||||
gdk_content_formats_unref (priv->formats);
|
||||
}
|
||||
|
||||
priv->formats = formats;
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_drop_set_property (GObject *gobject,
|
||||
guint prop_id,
|
||||
@ -186,10 +203,11 @@ gdk_drop_set_property (GObject *gobject,
|
||||
|
||||
case PROP_DRAG:
|
||||
priv->drag = g_value_dup_object (value);
|
||||
gdk_drop_add_formats (self, gdk_drag_get_formats (priv->drag));
|
||||
break;
|
||||
|
||||
case PROP_FORMATS:
|
||||
priv->formats = g_value_dup_boxed (value);
|
||||
gdk_drop_add_formats (self, g_value_get_boxed (value));
|
||||
g_assert (priv->formats != NULL);
|
||||
break;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user