g_return_if_fail (GTK_IS_WIDGET (widget));
g_return_if_fail (!proxy_window || GDK_IS_WINDOW (proxy_window));
- site = g_new (GtkDragDestSite, 1);
+ site = g_slice_new (GtkDragDestSite);
site->flags = 0;
site->have_drag = FALSE;
pointer = gdk_event_get_device (event);
- if (pointer->source == GDK_SOURCE_KEYBOARD)
+ if (gdk_device_get_source (pointer) == GDK_SOURCE_KEYBOARD)
{
keyboard = pointer;
pointer = gdk_device_get_associated_device (keyboard);
if (stock_id)
{
- pixbuf = gtk_widget_render_icon (window, stock_id,
- GTK_ICON_SIZE_DND, NULL);
+ pixbuf = gtk_widget_render_icon_pixbuf (window, stock_id,
+ GTK_ICON_SIZE_DND);
if (!pixbuf)
{
/**
* gtk_drag_set_icon_surface:
- * @context: the context for a drag. (This must be called
- * with a context for the source side of a drag)
- * @surface: the surface to use as icon
- *
+ * @context: the context for a drag. (This must be called
+ * with a context for the source side of a drag)
+ * @surface: the surface to use as icon
+ *
* Sets @surface as the icon for a given drag. GTK+ retains
* references for the arguments, and will release them when
* they are no longer needed.
+ *
+ * To position the surface relative to the mouse, use
+ * cairo_surface_set_device_offset() on @surface. The mouse
+ * cursor will be positioned at the (0,0) coordinate of the
+ * surface.
**/
void
gtk_drag_set_icon_surface (GdkDragContext *context,
cairo_t *cr;
region = gdk_cairo_region_create_from_surface (surface);
+ cairo_region_translate (region, -extents.x, -extents.y);
+
gtk_widget_shape_combine_region (window, region);
cairo_region_destroy (region);
cr = cairo_create (saturated);
cairo_push_group_with_content (cr, CAIRO_CONTENT_COLOR_ALPHA);
- cairo_set_source_surface (cr, surface, extents.x, extents.y);
+ cairo_set_source_surface (cr, surface, -extents.x, -extents.y);
cairo_paint (cr);
cairo_set_operator (cr, CAIRO_OPERATOR_SATURATE);
cairo_paint (cr);