Method
GtkWidgetdrag_begin_with_coordinates
since: 3.10
Declaration [src]
GdkDragContext*
gtk_drag_begin_with_coordinates (
GtkWidget* widget,
GtkTargetList* targets,
GdkDragAction actions,
gint button,
GdkEvent* event,
gint x,
gint y
)
Description [src]
Initiates a drag on the source side. The function only needs to be used
when the application is starting drags itself, and is not needed when
gtk_drag_source_set() is used.
The event is used to retrieve the timestamp that will be used internally to
grab the pointer. If event is NULL, then GDK_CURRENT_TIME will be used.
However, you should try to pass a real event in all cases, since that can be
used to get information about the drag.
Generally there are three cases when you want to start a drag by hand by calling this function:
-
During a
GtkWidget::button-press-eventhandler, if you want to start a drag immediately when the user presses the mouse button. Pass theeventthat you have in yourGtkWidget::button-press-eventhandler. -
During a
GtkWidget::motion-notify-eventhandler, if you want to start a drag when the mouse moves past a certain threshold distance after a button-press. Pass theeventthat you have in yourGtkWidget::motion-notify-eventhandler. -
During a timeout handler, if you want to start a drag after the mouse button is held down for some time. Try to save the last event that you got from the mouse, using gdk_event_copy(), and pass it to this function (remember to free the event with
gdk_event_free()when you are done). If you really cannot pass a real event, passNULLinstead.
Available since: 3.10
Parameters
targets-
Type:
GtkTargetListThe targets (data formats) in which the source can provide the data.
The data is owned by the caller of the method. actions-
Type:
GdkDragActionA bitmask of the allowed drag actions for this drag.
button-
Type:
gintThe button the user clicked to start the drag.
event-
Type:
GdkEventThe event that triggered the start of the drag, or
NULLif none can be obtained.The argument can be NULL.The data is owned by the caller of the method. x-
Type:
gintThe initial x coordinate to start dragging from, in the coordinate space of
widget. If -1 is passed, the coordinates are retrieved fromeventor the current pointer position. y-
Type:
gintThe initial y coordinate to start dragging from, in the coordinate space of
widget. If -1 is passed, the coordinates are retrieved fromeventor the current pointer position.
Return value
Type: GdkDragContext
The context for this drag.
| The returned data is owned by the instance. |