From 558fb1ecddc9510eaff2fa0b002ee759ae92ea49 Mon Sep 17 00:00:00 2001 From: Christoph Reiter Date: Thu, 17 Dec 2015 18:02:13 +0100 Subject: [PATCH] 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 --- gtk/gtkdnd-quartz.c | 57 +++++++++++++++++++++------------------------ 1 file changed, 27 insertions(+), 30 deletions(-) diff --git a/gtk/gtkdnd-quartz.c b/gtk/gtkdnd-quartz.c index 08240b0979..df2dbff4e4 100644 --- a/gtk/gtkdnd-quartz.c +++ b/gtk/gtkdnd-quartz.c @@ -1179,13 +1179,13 @@ gtk_drag_begin_idle (gpointer arg) GdkDragContext * gtk_drag_begin_internal (GtkWidget *widget, - GtkIconHelper *icon_helper, + GtkImageDefinition *icon, GtkTargetList *target_list, GdkDragAction actions, gint button, - GdkEvent *event, - gint x, - gint y) + const GdkEvent *event, + int x, + int y) { GtkDragSourceInfo *info; GdkDevice *pointer; @@ -1272,37 +1272,34 @@ gtk_drag_begin_internal (GtkWidget *widget, * application may have set one in ::drag_begin, or it may * not have set one. */ - if (!info->icon_surface) + if (!info->icon_surface && icon) { - if (!icon_helper || _gtk_icon_helper_get_is_empty (icon_helper)) - gtk_drag_set_icon_default (context); - else + switch (gtk_image_definition_get_storage_type (icon)) { - switch (_gtk_icon_helper_get_storage_type (icon_helper)) - { - case GTK_IMAGE_PIXBUF: - gtk_drag_set_icon_pixbuf (context, - _gtk_icon_helper_peek_pixbuf (icon_helper), - -2, -2); - break; - case GTK_IMAGE_STOCK: - gtk_drag_set_icon_stock (context, - _gtk_icon_helper_get_stock_id (icon_helper), - -2, -2); - break; - case GTK_IMAGE_ICON_NAME: - gtk_drag_set_icon_name (context, - _gtk_icon_helper_get_icon_name (icon_helper), - -2, -2); - break; - case GTK_IMAGE_EMPTY: - default: - g_assert_not_reached(); - break; - } + case GTK_IMAGE_PIXBUF: + gtk_drag_set_icon_pixbuf (context, + gtk_image_definition_get_pixbuf (icon), + -2, -2); + break; + case GTK_IMAGE_STOCK: + gtk_drag_set_icon_stock (context, + gtk_image_definition_get_stock (icon), + -2, -2); + break; + case GTK_IMAGE_ICON_NAME: + gtk_drag_set_icon_name (context, + gtk_image_definition_get_icon_name (icon), + -2, -2); + break; + default: + 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 */ g_idle_add_full (G_PRIORITY_HIGH_IDLE, gtk_drag_begin_idle, context, NULL);