### Function

# Gdk Drag begin

#### Declaration [src]

    GdkDrag*
    gdk_drag_begin (
      GdkSurface* surface,
      GdkDevice* device,
      GdkContentProvider* content,
      GdkDragAction actions,
      double dx,
      double dy
    )

#### Description [src]

Starts a drag and creates a new drag context for it.

This function is called by the drag source. After this call, you probably want to set up the drag icon using the surface returned by gdk_drag_get_drag_surface().

This function returns a reference to the `GdkDrag` object, but GTK keeps its own reference as well, as long as the DND operation is going on.

Note: if `actions` include `GDK_ACTION_MOVE`, you need to listen for the `GdkDrag::dnd-finished` signal and delete the data at the source if gdk_drag_get_selected_action() returns `GDK_ACTION_MOVE`.

#### Parameters

`surface` | `GdkSurface`
| The source surface for this drag.
| The data is owned by the caller of the function.
`device` | `GdkDevice`
| The device that controls this drag.
| The data is owned by the caller of the function.
`content` | `GdkContentProvider`
| The offered content.
| The data is owned by the caller of the function.
`actions` | `GdkDragAction`
| The actions supported by this drag.
`dx` | `double`
| The x offset to `device`‘s position where the drag nominally started.
`dy` | `double`
| The y offset to `device`‘s position where the drag nominally started.

#### Return value

Returns: | `GdkDrag`
| A newly created `GdkDrag`.
| The caller of the function takes ownership of the data, and is responsible for freeing it.
| The return value can be `NULL`.