gtkdnd-quartz: fix gtk_drag_begin_internal

gtk_drag_begin_internal was changed to take a GtkImageDefinition
instead of a GtkIconHelper. This adjusts the quartz variant
accordingly.

https://bugzilla.gnome.org/show_bug.cgi?id=759607
This commit is contained in:
Christoph Reiter
2015-12-17 18:02:13 +01:00
committed by Christoph Reiter
parent a90926c7f0
commit 558fb1ecdd

View File

@ -1179,13 +1179,13 @@ gtk_drag_begin_idle (gpointer arg)
GdkDragContext * GdkDragContext *
gtk_drag_begin_internal (GtkWidget *widget, gtk_drag_begin_internal (GtkWidget *widget,
GtkIconHelper *icon_helper, GtkImageDefinition *icon,
GtkTargetList *target_list, GtkTargetList *target_list,
GdkDragAction actions, GdkDragAction actions,
gint button, gint button,
GdkEvent *event, const GdkEvent *event,
gint x, int x,
gint y) int y)
{ {
GtkDragSourceInfo *info; GtkDragSourceInfo *info;
GdkDevice *pointer; GdkDevice *pointer;
@ -1272,37 +1272,34 @@ gtk_drag_begin_internal (GtkWidget *widget,
* application may have set one in ::drag_begin, or it may * application may have set one in ::drag_begin, or it may
* not have set one. * not have set one.
*/ */
if (!info->icon_surface) if (!info->icon_surface && icon)
{ {
if (!icon_helper || _gtk_icon_helper_get_is_empty (icon_helper)) switch (gtk_image_definition_get_storage_type (icon))
gtk_drag_set_icon_default (context);
else
{ {
switch (_gtk_icon_helper_get_storage_type (icon_helper)) case GTK_IMAGE_PIXBUF:
{ gtk_drag_set_icon_pixbuf (context,
case GTK_IMAGE_PIXBUF: gtk_image_definition_get_pixbuf (icon),
gtk_drag_set_icon_pixbuf (context, -2, -2);
_gtk_icon_helper_peek_pixbuf (icon_helper), break;
-2, -2); case GTK_IMAGE_STOCK:
break; gtk_drag_set_icon_stock (context,
case GTK_IMAGE_STOCK: gtk_image_definition_get_stock (icon),
gtk_drag_set_icon_stock (context, -2, -2);
_gtk_icon_helper_get_stock_id (icon_helper), break;
-2, -2); case GTK_IMAGE_ICON_NAME:
break; gtk_drag_set_icon_name (context,
case GTK_IMAGE_ICON_NAME: gtk_image_definition_get_icon_name (icon),
gtk_drag_set_icon_name (context, -2, -2);
_gtk_icon_helper_get_icon_name (icon_helper), break;
-2, -2); default:
break; break;
case GTK_IMAGE_EMPTY:
default:
g_assert_not_reached();
break;
}
} }
} }
/* no image def or no supported type -> set the default */
if (!info->icon_surface)
gtk_drag_set_icon_default (context);
/* drag will begin in an idle handler to avoid nested run loops */ /* drag will begin in an idle handler to avoid nested run loops */
g_idle_add_full (G_PRIORITY_HIGH_IDLE, gtk_drag_begin_idle, context, NULL); g_idle_add_full (G_PRIORITY_HIGH_IDLE, gtk_drag_begin_idle, context, NULL);