<?xml version="1.0"?>
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
               "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" [
<!ENTITY % local.common.attrib "xmlns:xi  CDATA  #FIXED 'http://www.w3.org/2003/XInclude'">
<!ENTITY version SYSTEM "version.xml">
]>
<refentry id="gdk-Drag-and-Drop">
<refmeta>
<refentrytitle role="top_of_page" id="gdk-Drag-and-Drop.top_of_page">Drag and Drop</refentrytitle>
<manvolnum>3</manvolnum>
<refmiscinfo>GDK Library</refmiscinfo>
</refmeta>

<refnamediv>
<refname>Drag and Drop</refname>
<refpurpose>Functions for controlling drag and drop handling</refpurpose>
</refnamediv>

<refsynopsisdiv id="gdk-Drag-and-Drop.synopsis" role="synopsis">
<title role="synopsis.title">Synopsis</title>

<synopsis>

#include &lt;gdk/gdk.h&gt;

<link linkend="GdkAtom">GdkAtom</link>             <link linkend="gdk-drag-get-selection">gdk_drag_get_selection</link>              (<link linkend="GdkDragContext">GdkDragContext</link> *context);
<link linkend="void">void</link>                <link linkend="gdk-drag-abort">gdk_drag_abort</link>                      (<link linkend="GdkDragContext">GdkDragContext</link> *context,
                                                         <link linkend="guint32">guint32</link> time_);
<link linkend="void">void</link>                <link linkend="gdk-drop-reply">gdk_drop_reply</link>                      (<link linkend="GdkDragContext">GdkDragContext</link> *context,
                                                         <link linkend="gboolean">gboolean</link> ok,
                                                         <link linkend="guint32">guint32</link> time_);
<link linkend="GdkDragContext">GdkDragContext</link> *    <link linkend="gdk-drag-context-new">gdk_drag_context_new</link>                (void);
<link linkend="void">void</link>                <link linkend="gdk-drag-drop">gdk_drag_drop</link>                       (<link linkend="GdkDragContext">GdkDragContext</link> *context,
                                                         <link linkend="guint32">guint32</link> time_);
<link linkend="void">void</link>                <link linkend="gdk-drag-find-window">gdk_drag_find_window</link>                (<link linkend="GdkDragContext">GdkDragContext</link> *context,
                                                         <link linkend="GdkWindow">GdkWindow</link> *drag_window,
                                                         <link linkend="gint">gint</link> x_root,
                                                         <link linkend="gint">gint</link> y_root,
                                                         <link linkend="GdkWindow">GdkWindow</link> **dest_window,
                                                         <link linkend="GdkDragProtocol">GdkDragProtocol</link> *protocol);
<link linkend="void">void</link>                <link linkend="gdk-drag-find-window-for-screen">gdk_drag_find_window_for_screen</link>     (<link linkend="GdkDragContext">GdkDragContext</link> *context,
                                                         <link linkend="GdkWindow">GdkWindow</link> *drag_window,
                                                         <link linkend="GdkScreen">GdkScreen</link> *screen,
                                                         <link linkend="gint">gint</link> x_root,
                                                         <link linkend="gint">gint</link> y_root,
                                                         <link linkend="GdkWindow">GdkWindow</link> **dest_window,
                                                         <link linkend="GdkDragProtocol">GdkDragProtocol</link> *protocol);
<link linkend="void">void</link>                <link linkend="gdk-drag-context-ref">gdk_drag_context_ref</link>                (<link linkend="GdkDragContext">GdkDragContext</link> *context);
<link linkend="GdkDragContext">GdkDragContext</link> *    <link linkend="gdk-drag-begin">gdk_drag_begin</link>                      (<link linkend="GdkWindow">GdkWindow</link> *window,
                                                         <link linkend="GList">GList</link> *targets);
<link linkend="gboolean">gboolean</link>            <link linkend="gdk-drag-motion">gdk_drag_motion</link>                     (<link linkend="GdkDragContext">GdkDragContext</link> *context,
                                                         <link linkend="GdkWindow">GdkWindow</link> *dest_window,
                                                         <link linkend="GdkDragProtocol">GdkDragProtocol</link> protocol,
                                                         <link linkend="gint">gint</link> x_root,
                                                         <link linkend="gint">gint</link> y_root,
                                                         <link linkend="GdkDragAction">GdkDragAction</link> suggested_action,
                                                         <link linkend="GdkDragAction">GdkDragAction</link> possible_actions,
                                                         <link linkend="guint32">guint32</link> time_);
<link linkend="void">void</link>                <link linkend="gdk-drop-finish">gdk_drop_finish</link>                     (<link linkend="GdkDragContext">GdkDragContext</link> *context,
                                                         <link linkend="gboolean">gboolean</link> success,
                                                         <link linkend="guint32">guint32</link> time_);
<link linkend="GdkNativeWindow">GdkNativeWindow</link>     <link linkend="gdk-drag-get-protocol">gdk_drag_get_protocol</link>               (<link linkend="GdkNativeWindow">GdkNativeWindow</link> xid,
                                                         <link linkend="GdkDragProtocol">GdkDragProtocol</link> *protocol);
<link linkend="GdkNativeWindow">GdkNativeWindow</link>     <link linkend="gdk-drag-get-protocol-for-display">gdk_drag_get_protocol_for_display</link>   (<link linkend="GdkDisplay">GdkDisplay</link> *display,
                                                         <link linkend="GdkNativeWindow">GdkNativeWindow</link> xid,
                                                         <link linkend="GdkDragProtocol">GdkDragProtocol</link> *protocol);
enum                <link linkend="GdkDragProtocol">GdkDragProtocol</link>;
<link linkend="void">void</link>                <link linkend="gdk-drag-context-unref">gdk_drag_context_unref</link>              (<link linkend="GdkDragContext">GdkDragContext</link> *context);
                    <link linkend="GdkDragContext">GdkDragContext</link>;
enum                <link linkend="GdkDragAction">GdkDragAction</link>;
<link linkend="void">void</link>                <link linkend="gdk-drag-status">gdk_drag_status</link>                     (<link linkend="GdkDragContext">GdkDragContext</link> *context,
                                                         <link linkend="GdkDragAction">GdkDragAction</link> action,
                                                         <link linkend="guint32">guint32</link> time_);
<link linkend="gboolean">gboolean</link>            <link linkend="gdk-drag-drop-succeeded">gdk_drag_drop_succeeded</link>             (<link linkend="GdkDragContext">GdkDragContext</link> *context);
</synopsis>
</refsynopsisdiv>









<refsect1 id="gdk-Drag-and-Drop.description" role="desc">
<title role="desc.title">Description</title>
<para>
These functions provide a low level interface for drag and drop.
The X backend of GDK supports both the Xdnd and Motif drag and drop protocols
transparently, the Win32 backend supports the WM_DROPFILES protocol.
</para>
<para>
GTK+ provides a higher level abstraction based on top of these functions,
and so they are not normally needed in GTK+ applications.
See the <link linkend="gtk-Drag-and-Drop">Drag and Drop</link> section of
the GTK+ documentation for more information.
</para>
</refsect1>

<refsect1 id="gdk-Drag-and-Drop.details" role="details">
<title role="details.title">Details</title>
<refsect2 id="gdk-drag-get-selection" role="function">
<title>gdk_drag_get_selection ()</title>
<indexterm zone="gdk-drag-get-selection"><primary sortas="drag_get_selection">gdk_drag_get_selection</primary></indexterm><programlisting><link linkend="GdkAtom">GdkAtom</link>             gdk_drag_get_selection              (<link linkend="GdkDragContext">GdkDragContext</link> *context);</programlisting>
<para>
Returns the selection atom for the current source window.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>context</parameter>&#160;:</term>
<listitem><simpara> a <link linkend="GdkDragContext"><type>GdkDragContext</type></link>.
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> the selection atom.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="gdk-drag-abort" role="function">
<title>gdk_drag_abort ()</title>
<indexterm zone="gdk-drag-abort"><primary sortas="drag_abort">gdk_drag_abort</primary></indexterm><programlisting><link linkend="void">void</link>                gdk_drag_abort                      (<link linkend="GdkDragContext">GdkDragContext</link> *context,
                                                         <link linkend="guint32">guint32</link> time_);</programlisting>
<para>
Aborts a drag without dropping. 
</para>
<para>
This function is called by the drag source.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>context</parameter>&#160;:</term>
<listitem><simpara> a <link linkend="GdkDragContext"><type>GdkDragContext</type></link>.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>time_</parameter>&#160;:</term>
<listitem><simpara> the timestamp for this operation.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="gdk-drop-reply" role="function">
<title>gdk_drop_reply ()</title>
<indexterm zone="gdk-drop-reply"><primary sortas="drop_reply">gdk_drop_reply</primary></indexterm><programlisting><link linkend="void">void</link>                gdk_drop_reply                      (<link linkend="GdkDragContext">GdkDragContext</link> *context,
                                                         <link linkend="gboolean">gboolean</link> ok,
                                                         <link linkend="guint32">guint32</link> time_);</programlisting>
<para>
Accepts or rejects a drop. 
</para>
<para>
This function is called by the drag destination in response
to a drop initiated by the drag source.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>context</parameter>&#160;:</term>
<listitem><simpara> a <link linkend="GdkDragContext"><type>GdkDragContext</type></link>.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>ok</parameter>&#160;:</term>
<listitem><simpara> <link linkend="TRUE--CAPS"><literal>TRUE</literal></link> if the drop is accepted.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>time_</parameter>&#160;:</term>
<listitem><simpara> the timestamp for this operation.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="gdk-drag-context-new" role="function">
<title>gdk_drag_context_new ()</title>
<indexterm zone="gdk-drag-context-new"><primary sortas="drag_context_new">gdk_drag_context_new</primary></indexterm><programlisting><link linkend="GdkDragContext">GdkDragContext</link> *    gdk_drag_context_new                (void);</programlisting>
<para>
Creates a new <link linkend="GdkDragContext"><type>GdkDragContext</type></link>.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> the newly created <link linkend="GdkDragContext"><type>GdkDragContext</type></link>.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="gdk-drag-drop" role="function">
<title>gdk_drag_drop ()</title>
<indexterm zone="gdk-drag-drop"><primary sortas="drag_drop">gdk_drag_drop</primary></indexterm><programlisting><link linkend="void">void</link>                gdk_drag_drop                       (<link linkend="GdkDragContext">GdkDragContext</link> *context,
                                                         <link linkend="guint32">guint32</link> time_);</programlisting>
<para>
Drops on the current destination.
</para>
<para>
This function is called by the drag source.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>context</parameter>&#160;:</term>
<listitem><simpara> a <link linkend="GdkDragContext"><type>GdkDragContext</type></link>.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>time_</parameter>&#160;:</term>
<listitem><simpara> the timestamp for this operation.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="gdk-drag-find-window" role="function">
<title>gdk_drag_find_window ()</title>
<indexterm zone="gdk-drag-find-window"><primary sortas="drag_find_window">gdk_drag_find_window</primary></indexterm><programlisting><link linkend="void">void</link>                gdk_drag_find_window                (<link linkend="GdkDragContext">GdkDragContext</link> *context,
                                                         <link linkend="GdkWindow">GdkWindow</link> *drag_window,
                                                         <link linkend="gint">gint</link> x_root,
                                                         <link linkend="gint">gint</link> y_root,
                                                         <link linkend="GdkWindow">GdkWindow</link> **dest_window,
                                                         <link linkend="GdkDragProtocol">GdkDragProtocol</link> *protocol);</programlisting>
<para>
Finds the destination window and DND protocol to use at the
given pointer position. 
</para>
<para>
This function is called by the drag source to obtain the 
<parameter>dest_window</parameter> and <parameter>protocol</parameter> parameters for <link linkend="gdk-drag-motion"><function>gdk_drag_motion()</function></link>.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>context</parameter>&#160;:</term>
<listitem><simpara> a <link linkend="GdkDragContext"><type>GdkDragContext</type></link>.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>drag_window</parameter>&#160;:</term>
<listitem><simpara> a window which may be at the pointer position, but
     should be ignored, since it is put up by the drag source as an icon.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>x_root</parameter>&#160;:</term>
<listitem><simpara> the x position of the pointer in root coordinates.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>y_root</parameter>&#160;:</term>
<listitem><simpara> the y position of the pointer in root coordinates.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>dest_window</parameter>&#160;:</term>
<listitem><simpara> location to store the destination window in.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>protocol</parameter>&#160;:</term>
<listitem><simpara> location to store the DND protocol in.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="gdk-drag-find-window-for-screen" role="function" condition="since:2.2">
<title>gdk_drag_find_window_for_screen ()</title>
<indexterm zone="gdk-drag-find-window-for-screen" role="2.2"><primary sortas="drag_find_window_for_screen">gdk_drag_find_window_for_screen</primary></indexterm><programlisting><link linkend="void">void</link>                gdk_drag_find_window_for_screen     (<link linkend="GdkDragContext">GdkDragContext</link> *context,
                                                         <link linkend="GdkWindow">GdkWindow</link> *drag_window,
                                                         <link linkend="GdkScreen">GdkScreen</link> *screen,
                                                         <link linkend="gint">gint</link> x_root,
                                                         <link linkend="gint">gint</link> y_root,
                                                         <link linkend="GdkWindow">GdkWindow</link> **dest_window,
                                                         <link linkend="GdkDragProtocol">GdkDragProtocol</link> *protocol);</programlisting>
<para>
Finds the destination window and DND protocol to use at the
given pointer position. 
</para>
<para>
This function is called by the drag source to obtain the 
<parameter>dest_window</parameter> and <parameter>protocol</parameter> parameters for <link linkend="gdk-drag-motion"><function>gdk_drag_motion()</function></link>.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>context</parameter>&#160;:</term>
<listitem><simpara> a <link linkend="GdkDragContext"><type>GdkDragContext</type></link>
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>drag_window</parameter>&#160;:</term>
<listitem><simpara> a window which may be at the pointer position, but
should be ignored, since it is put up by the drag source as an icon.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>screen</parameter>&#160;:</term>
<listitem><simpara> the screen where the destination window is sought. 
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>x_root</parameter>&#160;:</term>
<listitem><simpara> the x position of the pointer in root coordinates.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>y_root</parameter>&#160;:</term>
<listitem><simpara> the y position of the pointer in root coordinates.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>dest_window</parameter>&#160;:</term>
<listitem><simpara> location to store the destination window in.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>protocol</parameter>&#160;:</term>
<listitem><simpara> location to store the DND protocol in.
</simpara></listitem></varlistentry>
</variablelist><para role="since">Since 2.2</para></refsect2>
<refsect2 id="gdk-drag-context-ref" role="function" condition="deprecated:">
<title>gdk_drag_context_ref ()</title>
<indexterm zone="gdk-drag-context-ref" role="deprecated"><primary sortas="drag_context_ref">gdk_drag_context_ref</primary></indexterm><programlisting><link linkend="void">void</link>                gdk_drag_context_ref                (<link linkend="GdkDragContext">GdkDragContext</link> *context);</programlisting>
<warning><para><literal>gdk_drag_context_ref</literal> is deprecated and should not be used in newly-written code.</para></warning>
<para>
Deprecated function; use <link linkend="g-object-ref"><function>g_object_ref()</function></link> instead.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>context</parameter>&#160;:</term>
<listitem><simpara> a <link linkend="GdkDragContext"><type>GdkDragContext</type></link>.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="gdk-drag-begin" role="function">
<title>gdk_drag_begin ()</title>
<indexterm zone="gdk-drag-begin"><primary sortas="drag_begin">gdk_drag_begin</primary></indexterm><programlisting><link linkend="GdkDragContext">GdkDragContext</link> *    gdk_drag_begin                      (<link linkend="GdkWindow">GdkWindow</link> *window,
                                                         <link linkend="GList">GList</link> *targets);</programlisting>
<para>
Starts a drag and creates a new drag context for it.
</para>
<para>
This function is called by the drag source.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>window</parameter>&#160;:</term>
<listitem><simpara> the source window for this drag.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>targets</parameter>&#160;:</term>
<listitem><simpara> the list of offered targets.
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> a newly created <link linkend="GdkDragContext"><type>GdkDragContext</type></link>.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="gdk-drag-motion" role="function">
<title>gdk_drag_motion ()</title>
<indexterm zone="gdk-drag-motion"><primary sortas="drag_motion">gdk_drag_motion</primary></indexterm><programlisting><link linkend="gboolean">gboolean</link>            gdk_drag_motion                     (<link linkend="GdkDragContext">GdkDragContext</link> *context,
                                                         <link linkend="GdkWindow">GdkWindow</link> *dest_window,
                                                         <link linkend="GdkDragProtocol">GdkDragProtocol</link> protocol,
                                                         <link linkend="gint">gint</link> x_root,
                                                         <link linkend="gint">gint</link> y_root,
                                                         <link linkend="GdkDragAction">GdkDragAction</link> suggested_action,
                                                         <link linkend="GdkDragAction">GdkDragAction</link> possible_actions,
                                                         <link linkend="guint32">guint32</link> time_);</programlisting>
<para>
Updates the drag context when the pointer moves or the 
set of actions changes.
</para>
<para>
This function is called by the drag source.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>context</parameter>&#160;:</term>
<listitem><simpara> a <link linkend="GdkDragContext"><type>GdkDragContext</type></link>.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>dest_window</parameter>&#160;:</term>
<listitem><simpara> the new destination window, obtained by 
    <link linkend="gdk-drag-find-window"><function>gdk_drag_find_window()</function></link>.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>protocol</parameter>&#160;:</term>
<listitem><simpara> the DND protocol in use, obtained by <link linkend="gdk-drag-find-window"><function>gdk_drag_find_window()</function></link>.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>x_root</parameter>&#160;:</term>
<listitem><simpara> the x position of the pointer in root coordinates.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>y_root</parameter>&#160;:</term>
<listitem><simpara> the y position of the pointer in root coordinates.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>suggested_action</parameter>&#160;:</term>
<listitem><simpara> the suggested action.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>possible_actions</parameter>&#160;:</term>
<listitem><simpara> the possible actions.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>time_</parameter>&#160;:</term>
<listitem><simpara> the timestamp for this operation.
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> FIXME
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="gdk-drop-finish" role="function">
<title>gdk_drop_finish ()</title>
<indexterm zone="gdk-drop-finish"><primary sortas="drop_finish">gdk_drop_finish</primary></indexterm><programlisting><link linkend="void">void</link>                gdk_drop_finish                     (<link linkend="GdkDragContext">GdkDragContext</link> *context,
                                                         <link linkend="gboolean">gboolean</link> success,
                                                         <link linkend="guint32">guint32</link> time_);</programlisting>
<para>
Ends the drag operation after a drop.
</para>
<para>
This function is called by the drag destination.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>context</parameter>&#160;:</term>
<listitem><simpara> a <link linkend="GtkDragContext"><type>GtkDragContext</type></link>.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>success</parameter>&#160;:</term>
<listitem><simpara> <link linkend="TRUE--CAPS"><literal>TRUE</literal></link> if the data was successfully received.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>time_</parameter>&#160;:</term>
<listitem><simpara> the timestamp for this operation.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="gdk-drag-get-protocol" role="function">
<title>gdk_drag_get_protocol ()</title>
<indexterm zone="gdk-drag-get-protocol"><primary sortas="drag_get_protocol">gdk_drag_get_protocol</primary></indexterm><programlisting><link linkend="GdkNativeWindow">GdkNativeWindow</link>     gdk_drag_get_protocol               (<link linkend="GdkNativeWindow">GdkNativeWindow</link> xid,
                                                         <link linkend="GdkDragProtocol">GdkDragProtocol</link> *protocol);</programlisting>
<para>
Finds out the DND protocol supported by a window.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>xid</parameter>&#160;:</term>
<listitem><simpara> the windowing system id of the destination window.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>protocol</parameter>&#160;:</term>
<listitem><simpara> location where the supported DND protocol is returned.
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> the windowing system specific id for the window where
   the drop should happen. This may be <parameter>xid</parameter> or the id of a proxy
   window, or zero if <parameter>xid</parameter> doesn't support Drag and Drop.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="gdk-drag-get-protocol-for-display" role="function" condition="since:2.2">
<title>gdk_drag_get_protocol_for_display ()</title>
<indexterm zone="gdk-drag-get-protocol-for-display" role="2.2"><primary sortas="drag_get_protocol_for_display">gdk_drag_get_protocol_for_display</primary></indexterm><programlisting><link linkend="GdkNativeWindow">GdkNativeWindow</link>     gdk_drag_get_protocol_for_display   (<link linkend="GdkDisplay">GdkDisplay</link> *display,
                                                         <link linkend="GdkNativeWindow">GdkNativeWindow</link> xid,
                                                         <link linkend="GdkDragProtocol">GdkDragProtocol</link> *protocol);</programlisting>
<para>
Finds out the DND protocol supported by a window.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>display</parameter>&#160;:</term>
<listitem><simpara> the <link linkend="GdkDisplay"><type>GdkDisplay</type></link> where the destination window resides
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>xid</parameter>&#160;:</term>
<listitem><simpara> the windowing system id of the destination window.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>protocol</parameter>&#160;:</term>
<listitem><simpara> location where the supported DND protocol is returned.
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> the windowing system id of the window where the drop should happen. This 
    may be <parameter>xid</parameter> or the id of a proxy window, or zero if <parameter>xid</parameter> doesn't
    support Drag and Drop.
</simpara></listitem></varlistentry>
</variablelist><para role="since">Since 2.2</para></refsect2>
<refsect2 id="GdkDragProtocol" role="enum">
<title>enum GdkDragProtocol</title>
<indexterm zone="GdkDragProtocol"><primary sortas="DragProtocol">GdkDragProtocol</primary></indexterm><programlisting>typedef enum
{
  GDK_DRAG_PROTO_MOTIF,
  GDK_DRAG_PROTO_XDND,
  GDK_DRAG_PROTO_ROOTWIN,	  /* A root window with nobody claiming
				   * drags */
  GDK_DRAG_PROTO_NONE,		  /* Not a valid drag window */
  GDK_DRAG_PROTO_WIN32_DROPFILES, /* The simple WM_DROPFILES dnd */
  GDK_DRAG_PROTO_OLE2,		  /* The complex OLE2 dnd (not implemented) */
  GDK_DRAG_PROTO_LOCAL            /* Intra-app */
} GdkDragProtocol;
</programlisting>
<para>
Used in <link linkend="GdkDragContext"><type>GdkDragContext</type></link> to indicate the protocol according to
which DND is done.
</para><variablelist role="enum">
<varlistentry id="GDK-DRAG-PROTO-MOTIF--CAPS" role="constant">
<term><literal>GDK_DRAG_PROTO_MOTIF</literal></term>
<listitem><simpara>The Motif DND protocol.
</simpara></listitem>
</varlistentry>
<varlistentry id="GDK-DRAG-PROTO-XDND--CAPS" role="constant">
<term><literal>GDK_DRAG_PROTO_XDND</literal></term>
<listitem><simpara>The Xdnd protocol.
</simpara></listitem>
</varlistentry>
<varlistentry id="GDK-DRAG-PROTO-ROOTWIN--CAPS" role="constant">
<term><literal>GDK_DRAG_PROTO_ROOTWIN</literal></term>
<listitem><simpara>An extension to the Xdnd protocol for
  unclaimed root window drops.
</simpara></listitem>
</varlistentry>
<varlistentry id="GDK-DRAG-PROTO-NONE--CAPS" role="constant">
<term><literal>GDK_DRAG_PROTO_NONE</literal></term>
<listitem><simpara>no protocol.
</simpara></listitem>
</varlistentry>
<varlistentry id="GDK-DRAG-PROTO-WIN32-DROPFILES--CAPS" role="constant">
<term><literal>GDK_DRAG_PROTO_WIN32_DROPFILES</literal></term>
<listitem><simpara>The simple WM_DROPFILES protocol.
</simpara></listitem>
</varlistentry>
<varlistentry id="GDK-DRAG-PROTO-OLE2--CAPS" role="constant">
<term><literal>GDK_DRAG_PROTO_OLE2</literal></term>
<listitem><simpara>The complex OLE2 DND protocol (not implemented).
</simpara></listitem>
</varlistentry>
<varlistentry id="GDK-DRAG-PROTO-LOCAL--CAPS" role="constant">
<term><literal>GDK_DRAG_PROTO_LOCAL</literal></term>
<listitem><simpara>Intra-application DND.
</simpara></listitem>
</varlistentry>
</variablelist></refsect2>
<refsect2 id="gdk-drag-context-unref" role="function" condition="deprecated:">
<title>gdk_drag_context_unref ()</title>
<indexterm zone="gdk-drag-context-unref" role="deprecated"><primary sortas="drag_context_unref">gdk_drag_context_unref</primary></indexterm><programlisting><link linkend="void">void</link>                gdk_drag_context_unref              (<link linkend="GdkDragContext">GdkDragContext</link> *context);</programlisting>
<warning><para><literal>gdk_drag_context_unref</literal> is deprecated and should not be used in newly-written code.</para></warning>
<para>
Deprecated function; use <link linkend="g-object-unref"><function>g_object_unref()</function></link> instead.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>context</parameter>&#160;:</term>
<listitem><simpara> a <link linkend="GdkDragContext"><type>GdkDragContext</type></link>.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="GdkDragContext" role="struct">
<title>GdkDragContext</title>
<indexterm zone="GdkDragContext"><primary sortas="DragContext">GdkDragContext</primary></indexterm><programlisting>typedef struct {
  GObject parent_instance;

  
  GdkDragProtocol protocol;
  
  gboolean is_source;
  
  GdkWindow *source_window;
  GdkWindow *dest_window;

  GList *targets;
  GdkDragAction actions;
  GdkDragAction suggested_action;
  GdkDragAction action; 

  guint32 start_time;
} GdkDragContext;
</programlisting>
<para>
A <structname>GdkDragContext</structname> holds information about a
drag in progress. It is used on both source and destination sides.
</para><variablelist role="struct">
<varlistentry>
<term><link linkend="GObject">GObject</link>&#160;<structfield>parent_instance</structfield>;</term>
<listitem><simpara>the parent instance
</simpara></listitem>
</varlistentry>
<varlistentry>
<term><link linkend="GdkDragProtocol">GdkDragProtocol</link>&#160;<structfield>protocol</structfield>;</term>
<listitem><simpara>the DND protocol which governs this drag.
</simpara></listitem>
</varlistentry>
<varlistentry>
<term><link linkend="gboolean">gboolean</link>&#160;<structfield>is_source</structfield>;</term>
<listitem><simpara>%TRUE if the context is used on the source side.
</simpara></listitem>
</varlistentry>
<varlistentry>
<term><link linkend="GdkWindow">GdkWindow</link>&#160;*<structfield>source_window</structfield>;</term>
<listitem><simpara>the source of this drag.
</simpara></listitem>
</varlistentry>
<varlistentry>
<term><link linkend="GdkWindow">GdkWindow</link>&#160;*<structfield>dest_window</structfield>;</term>
<listitem><simpara>the destination window of this drag.
</simpara></listitem>
</varlistentry>
<varlistentry>
<term><link linkend="GList">GList</link>&#160;*<structfield>targets</structfield>;</term>
<listitem><simpara>a list of targets offered by the source.
</simpara></listitem>
</varlistentry>
<varlistentry>
<term><link linkend="GdkDragAction">GdkDragAction</link>&#160;<structfield>actions</structfield>;</term>
<listitem><simpara>a bitmask of actions proposed by the source when 
   <parameter>suggested_action</parameter> is <link linkend="GDK-ACTION-ASK--CAPS"><literal>GDK_ACTION_ASK</literal></link>.
</simpara></listitem>
</varlistentry>
<varlistentry>
<term><link linkend="GdkDragAction">GdkDragAction</link>&#160;<structfield>suggested_action</structfield>;</term>
<listitem><simpara>the action suggested by the source.
</simpara></listitem>
</varlistentry>
<varlistentry>
<term><link linkend="GdkDragAction">GdkDragAction</link>&#160;<structfield>action</structfield>;</term>
<listitem><simpara>the action chosen by the destination.
</simpara></listitem>
</varlistentry>
<varlistentry>
<term><link linkend="guint32">guint32</link>&#160;<structfield>start_time</structfield>;</term>
<listitem><simpara>a timestamp recording the start time of this drag.
</simpara></listitem>
</varlistentry>
</variablelist></refsect2>
<refsect2 id="GdkDragAction" role="enum">
<title>enum GdkDragAction</title>
<indexterm zone="GdkDragAction"><primary sortas="DragAction">GdkDragAction</primary></indexterm><programlisting>typedef enum
{
  GDK_ACTION_DEFAULT = 1 &lt;&lt; 0,
  GDK_ACTION_COPY    = 1 &lt;&lt; 1,
  GDK_ACTION_MOVE    = 1 &lt;&lt; 2,
  GDK_ACTION_LINK    = 1 &lt;&lt; 3,
  GDK_ACTION_PRIVATE = 1 &lt;&lt; 4,
  GDK_ACTION_ASK     = 1 &lt;&lt; 5
} GdkDragAction;
</programlisting>
<para>
Used in <link linkend="GdkDragContext"><type>GdkDragContext</type></link> to indicate what the destination
should do with the dropped data.
</para><variablelist role="enum">
<varlistentry id="GDK-ACTION-DEFAULT--CAPS" role="constant">
<term><literal>GDK_ACTION_DEFAULT</literal></term>
<listitem><simpara>Means nothing, and should not be used.
</simpara></listitem>
</varlistentry>
<varlistentry id="GDK-ACTION-COPY--CAPS" role="constant">
<term><literal>GDK_ACTION_COPY</literal></term>
<listitem><simpara>Copy the data.
</simpara></listitem>
</varlistentry>
<varlistentry id="GDK-ACTION-MOVE--CAPS" role="constant">
<term><literal>GDK_ACTION_MOVE</literal></term>
<listitem><simpara>Move the data, i.e. first copy it, then delete
  it from the source using the DELETE target of the X selection protocol.
</simpara></listitem>
</varlistentry>
<varlistentry id="GDK-ACTION-LINK--CAPS" role="constant">
<term><literal>GDK_ACTION_LINK</literal></term>
<listitem><simpara>Add a link to the data. Note that this is only
  useful if source and destination agree on what it means.
</simpara></listitem>
</varlistentry>
<varlistentry id="GDK-ACTION-PRIVATE--CAPS" role="constant">
<term><literal>GDK_ACTION_PRIVATE</literal></term>
<listitem><simpara>Special action which tells the source that the
  destination will do something that the source doesn't understand.
</simpara></listitem>
</varlistentry>
<varlistentry id="GDK-ACTION-ASK--CAPS" role="constant">
<term><literal>GDK_ACTION_ASK</literal></term>
<listitem><simpara>Ask the user what to do with the data.
</simpara></listitem>
</varlistentry>
</variablelist></refsect2>
<refsect2 id="gdk-drag-status" role="function">
<title>gdk_drag_status ()</title>
<indexterm zone="gdk-drag-status"><primary sortas="drag_status">gdk_drag_status</primary></indexterm><programlisting><link linkend="void">void</link>                gdk_drag_status                     (<link linkend="GdkDragContext">GdkDragContext</link> *context,
                                                         <link linkend="GdkDragAction">GdkDragAction</link> action,
                                                         <link linkend="guint32">guint32</link> time_);</programlisting>
<para>
Selects one of the actions offered by the drag source.
</para>
<para>
This function is called by the drag destination in response to
<link linkend="gdk-drag-motion"><function>gdk_drag_motion()</function></link> called by the drag source.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>context</parameter>&#160;:</term>
<listitem><simpara> a <link linkend="GdkDragContext"><type>GdkDragContext</type></link>.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>action</parameter>&#160;:</term>
<listitem><simpara> the selected action which will be taken when a drop happens, 
   or 0 to indicate that a drop will not be accepted.
</simpara></listitem></varlistentry>
<varlistentry><term><parameter>time_</parameter>&#160;:</term>
<listitem><simpara> the timestamp for this operation.
</simpara></listitem></varlistentry>
</variablelist></refsect2>
<refsect2 id="gdk-drag-drop-succeeded" role="function" condition="since:2.6">
<title>gdk_drag_drop_succeeded ()</title>
<indexterm zone="gdk-drag-drop-succeeded" role="2.6"><primary sortas="drag_drop_succeeded">gdk_drag_drop_succeeded</primary></indexterm><programlisting><link linkend="gboolean">gboolean</link>            gdk_drag_drop_succeeded             (<link linkend="GdkDragContext">GdkDragContext</link> *context);</programlisting>
<para>
Returns whether the dropped data has been successfully 
transferred. This function is intended to be used while 
handling a <link linkend="GDK-DROP-FINISHED--CAPS"><literal>GDK_DROP_FINISHED</literal></link> event, its return value is
meaningless at other times.</para>
<para>
</para><variablelist role="params">
<varlistentry><term><parameter>context</parameter>&#160;:</term>
<listitem><simpara> a <link linkend="GdkDragContext"><type>GdkDragContext</type></link>
</simpara></listitem></varlistentry>
<varlistentry><term><emphasis>Returns</emphasis>&#160;:</term><listitem><simpara> <link linkend="TRUE--CAPS"><literal>TRUE</literal></link> if the drop was successful.

</simpara></listitem></varlistentry>
</variablelist><para role="since">Since 2.6</para></refsect2>

</refsect1>




</refentry>
