Functions
gdk_drag_get_selection ()
GdkAtom
gdk_drag_get_selection (GdkDragContext *context);
Returns the selection atom for the current source window.
Returns
the selection atom, or GDK_NONE.
[transfer none]
gdk_drag_abort ()
void
gdk_drag_abort (GdkDragContext *context,
guint32 time_);
Aborts a drag without dropping.
This function is called by the drag source.
This function does not need to be called in managed drag and drop
operations. See gdk_drag_context_manage_dnd() for more information.
gdk_drop_reply ()
void
gdk_drop_reply (GdkDragContext *context,
gboolean accepted,
guint32 time_);
Accepts or rejects a drop.
This function is called by the drag destination in response
to a drop initiated by the drag source.
gdk_drag_drop ()
void
gdk_drag_drop (GdkDragContext *context,
guint32 time_);
Drops on the current destination.
This function is called by the drag source.
This function does not need to be called in managed drag and drop
operations. See gdk_drag_context_manage_dnd() for more information.
gdk_drag_drop_done ()
void
gdk_drag_drop_done (GdkDragContext *context,
gboolean success);
Inform GDK if the drop ended successfully. Passing FALSE
for success
may trigger a drag cancellation animation.
This function is called by the drag source, and should
be the last call before dropping the reference to the
context
.
The GdkDragContext will only take the first gdk_drag_drop_done()
call as effective, if this function is called multiple times,
all subsequent calls will be ignored.
Since: 3.20
gdk_drag_find_window_for_screen ()
void
gdk_drag_find_window_for_screen (GdkDragContext *context,
GdkWindow *drag_window,
GdkScreen *screen,
gint x_root,
gint y_root,
GdkWindow **dest_window,
GdkDragProtocol *protocol);
Finds the destination window and DND protocol to use at the
given pointer position.
This function is called by the drag source to obtain the
dest_window
and protocol
parameters for gdk_drag_motion().
Since: 2.2
gdk_drag_begin ()
GdkDragContext *
gdk_drag_begin (GdkWindow *window,
GList *targets);
Starts a drag and creates a new drag context for it.
This function assumes that the drag is controlled by the
client pointer device, use gdk_drag_begin_for_device() to
begin a drag with a different device.
This function is called by the drag source.
gdk_drag_begin_for_device ()
GdkDragContext *
gdk_drag_begin_for_device (GdkWindow *window,
GdkDevice *device,
GList *targets);
Starts a drag and creates a new drag context for it.
This function is called by the drag source.
gdk_drag_begin_from_point ()
GdkDragContext *
gdk_drag_begin_from_point (GdkWindow *window,
GdkDevice *device,
GList *targets,
gint x_root,
gint y_root);
Starts a drag and creates a new drag context for it.
This function is called by the drag source.
Since: 3.20
gdk_drop_finish ()
void
gdk_drop_finish (GdkDragContext *context,
gboolean success,
guint32 time_);
Ends the drag operation after a drop.
This function is called by the drag destination.
gdk_drag_status ()
void
gdk_drag_status (GdkDragContext *context,
GdkDragAction action,
guint32 time_);
Selects one of the actions offered by the drag source.
This function is called by the drag destination in response to
gdk_drag_motion() called by the drag source.
gdk_drag_drop_succeeded ()
gboolean
gdk_drag_drop_succeeded (GdkDragContext *context);
Returns whether the dropped data has been successfully
transferred. This function is intended to be used while
handling a GDK_DROP_FINISHED event, its return value is
meaningless at other times.
Returns
TRUE if the drop was successful.
Since: 2.6
gdk_window_get_drag_protocol ()
GdkDragProtocol
gdk_window_get_drag_protocol (GdkWindow *window,
GdkWindow **target);
Finds out the DND protocol supported by a window.
Returns
the supported DND protocol.
Since: 3.0
gdk_drag_context_get_suggested_action ()
GdkDragAction
gdk_drag_context_get_suggested_action (GdkDragContext *context);
Determines the suggested drag action of the context.
Since: 2.22
gdk_drag_context_get_selected_action ()
GdkDragAction
gdk_drag_context_get_selected_action (GdkDragContext *context);
Determines the action chosen by the drag destination.
Since: 2.22
gdk_drag_context_list_targets ()
GList *
gdk_drag_context_list_targets (GdkDragContext *context);
Retrieves the list of targets of the context.
Returns
a GList of targets.
[transfer none][element-type GdkAtom]
Since: 2.22
gdk_drag_context_get_device ()
GdkDevice *
gdk_drag_context_get_device (GdkDragContext *context);
Returns the GdkDevice associated to the drag context.
Returns
The GdkDevice associated to context
.
[transfer none]
gdk_drag_context_set_device ()
void
gdk_drag_context_set_device (GdkDragContext *context,
GdkDevice *device);
Associates a GdkDevice to context
, so all Drag and Drop events
for context
are emitted as if they came from this device.
gdk_drag_context_get_source_window ()
GdkWindow *
gdk_drag_context_get_source_window (GdkDragContext *context);
Returns the GdkWindow where the DND operation started.
Since: 2.22
gdk_drag_context_get_dest_window ()
GdkWindow *
gdk_drag_context_get_dest_window (GdkDragContext *context);
Returns the destination window for the DND operation.
Since: 3.0
gdk_drag_context_get_protocol ()
GdkDragProtocol
gdk_drag_context_get_protocol (GdkDragContext *context);
Returns the drag protocol that is used by this context.
Returns
the drag protocol
Since: 3.0
gdk_drag_context_get_drag_window ()
GdkWindow *
gdk_drag_context_get_drag_window (GdkDragContext *context);
Returns the window on which the drag icon should be rendered
during the drag operation. Note that the window may not be
available until the drag operation has begun. GDK will move
the window in accordance with the ongoing drag operation.
The window is owned by context
and will be destroyed when
the drag operation is over.
Returns
the drag window, or NULL.
[nullable][transfer none]
Since: 3.20
gdk_drag_context_set_hotspot ()
void
gdk_drag_context_set_hotspot (GdkDragContext *context,
gint hot_x,
gint hot_y);
Sets the position of the drag window that will be kept
under the cursor hotspot. Initially, the hotspot is at the
top left corner of the drag window.
Since: 3.20
gdk_drag_context_manage_dnd ()
gboolean
gdk_drag_context_manage_dnd (GdkDragContext *context,
GdkWindow *ipc_window,
GdkDragAction actions);
Requests the drag and drop operation to be managed by context
.
When a drag and drop operation becomes managed, the GdkDragContext
will internally handle all input and source-side GdkEventDND events
as required by the windowing system.
Once the drag and drop operation is managed, the drag context will
emit the following signals:
The “action-changed” signal whenever the final action
to be performed by the drag and drop operation changes.
The “drop-performed” signal after the user performs
the drag and drop gesture (typically by releasing the mouse button).
The “dnd-finished” signal after the drag and drop
operation concludes (after all GdkSelection transfers happen).
The “cancel” signal if the drag and drop operation is
finished but doesn't happen over an accepting destination, or is
cancelled through other means.
Returns
TRUE if the drag and drop operation is managed.
Since: 3.20
Signal Details
The “dnd-finished” signal
void
user_function (GdkDragContext *context,
gpointer user_data)
The drag and drop operation was finished, the drag destination
finished reading all data. The drag source can now free all
miscellaneous data.
This signal will only be emitted if the GdkDragContext manages
the drag and drop operation. See gdk_drag_context_manage_dnd()
for more information.
Flags: Run Last
Since: 3.20