1
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
4
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
5
<title>Drag and Drop</title>
6
<meta name="generator" content="DocBook XSL Stylesheets V1.72.0">
7
<link rel="start" href="index.html" title="GDK Reference Manual">
8
<link rel="up" href="reference.html" title="API Reference">
9
<link rel="prev" href="gdk-Selections.html" title="Selections">
10
<link rel="next" href="gdk-Properties-and-Atoms.html" title="Properties and Atoms">
11
<meta name="generator" content="GTK-Doc V1.7 (XML mode)">
12
<link rel="stylesheet" href="style.css" type="text/css">
13
<link rel="reference" href="reference.html" title="API Reference">
14
<link rel="index" href="ix01.html" title="Index">
15
<link rel="index" href="ix02.html" title="Index of deprecated symbols">
16
<link rel="index" href="ix03.html" title="Index of new symbols in 2.2">
17
<link rel="index" href="ix04.html" title="Index of new symbols in 2.4">
18
<link rel="index" href="ix05.html" title="Index of new symbols in 2.6">
19
<link rel="index" href="ix06.html" title="Index of new symbols in 2.8">
20
<link rel="index" href="ix07.html" title="Index of new symbols in 2.10">
22
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
23
<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2">
25
<td><a accesskey="p" href="gdk-Selections.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td>
26
<td><a accesskey="u" href="reference.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></a></td>
27
<td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td>
28
<th width="100%" align="center">GDK Reference Manual</th>
29
<td><a accesskey="n" href="gdk-Properties-and-Atoms.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td>
31
<tr><td colspan="5" class="shortcuts"><nobr><a href="#id2776707" class="shortcut">Top</a>
33
<a href="#id2777351" class="shortcut">Description</a></nobr></td></tr>
35
<div class="refentry" lang="en">
36
<a name="gdk-Drag-and-Drop"></a><div class="titlepage"></div>
37
<div class="refnamediv"><table width="100%"><tr>
40
<a name="id2776707"></a><span class="refentrytitle">Drag and Drop</span>
42
<p>Drag and Drop — Functions for controlling drag and drop handling</p>
44
<td valign="top" align="right"></td>
46
<div class="refsynopsisdiv">
48
<pre class="synopsis">
50
#include <gdk/gdk.h>
53
<a href="gdk-Properties-and-Atoms.html#GdkAtom">GdkAtom</a> <a href="gdk-Drag-and-Drop.html#gdk-drag-get-selection">gdk_drag_get_selection</a> (<a href="gdk-Drag-and-Drop.html#GdkDragContext">GdkDragContext</a> *context);
54
void <a href="gdk-Drag-and-Drop.html#gdk-drag-abort">gdk_drag_abort</a> (<a href="gdk-Drag-and-Drop.html#GdkDragContext">GdkDragContext</a> *context,
56
void <a href="gdk-Drag-and-Drop.html#gdk-drop-reply">gdk_drop_reply</a> (<a href="gdk-Drag-and-Drop.html#GdkDragContext">GdkDragContext</a> *context,
59
<a href="gdk-Drag-and-Drop.html#GdkDragContext">GdkDragContext</a>* <a href="gdk-Drag-and-Drop.html#gdk-drag-context-new">gdk_drag_context_new</a> (void);
60
void <a href="gdk-Drag-and-Drop.html#gdk-drag-drop">gdk_drag_drop</a> (<a href="gdk-Drag-and-Drop.html#GdkDragContext">GdkDragContext</a> *context,
62
void <a href="gdk-Drag-and-Drop.html#gdk-drag-find-window">gdk_drag_find_window</a> (<a href="gdk-Drag-and-Drop.html#GdkDragContext">GdkDragContext</a> *context,
63
<a href="gdk-Windows.html#GdkWindow">GdkWindow</a> *drag_window,
66
<a href="gdk-Windows.html#GdkWindow">GdkWindow</a> **dest_window,
67
<a href="gdk-Drag-and-Drop.html#GdkDragProtocol">GdkDragProtocol</a> *protocol);
68
void <a href="gdk-Drag-and-Drop.html#gdk-drag-find-window-for-screen">gdk_drag_find_window_for_screen</a> (<a href="gdk-Drag-and-Drop.html#GdkDragContext">GdkDragContext</a> *context,
69
<a href="gdk-Windows.html#GdkWindow">GdkWindow</a> *drag_window,
70
<a href="GdkScreen.html" title="GdkScreen">GdkScreen</a> *screen,
73
<a href="gdk-Windows.html#GdkWindow">GdkWindow</a> **dest_window,
74
<a href="gdk-Drag-and-Drop.html#GdkDragProtocol">GdkDragProtocol</a> *protocol);
75
void <a href="gdk-Drag-and-Drop.html#gdk-drag-context-ref">gdk_drag_context_ref</a> (<a href="gdk-Drag-and-Drop.html#GdkDragContext">GdkDragContext</a> *context);
76
<a href="gdk-Drag-and-Drop.html#GdkDragContext">GdkDragContext</a>* <a href="gdk-Drag-and-Drop.html#gdk-drag-begin">gdk_drag_begin</a> (<a href="gdk-Windows.html#GdkWindow">GdkWindow</a> *window,
78
gboolean <a href="gdk-Drag-and-Drop.html#gdk-drag-motion">gdk_drag_motion</a> (<a href="gdk-Drag-and-Drop.html#GdkDragContext">GdkDragContext</a> *context,
79
<a href="gdk-Windows.html#GdkWindow">GdkWindow</a> *dest_window,
80
<a href="gdk-Drag-and-Drop.html#GdkDragProtocol">GdkDragProtocol</a> protocol,
83
<a href="gdk-Drag-and-Drop.html#GdkDragAction">GdkDragAction</a> suggested_action,
84
<a href="gdk-Drag-and-Drop.html#GdkDragAction">GdkDragAction</a> possible_actions,
86
void <a href="gdk-Drag-and-Drop.html#gdk-drop-finish">gdk_drop_finish</a> (<a href="gdk-Drag-and-Drop.html#GdkDragContext">GdkDragContext</a> *context,
89
guint32 <a href="gdk-Drag-and-Drop.html#gdk-drag-get-protocol">gdk_drag_get_protocol</a> (guint32 xid,
90
<a href="gdk-Drag-and-Drop.html#GdkDragProtocol">GdkDragProtocol</a> *protocol);
91
guint32 <a href="gdk-Drag-and-Drop.html#gdk-drag-get-protocol-for-display">gdk_drag_get_protocol_for_display</a> (<a href="GdkDisplay.html" title="GdkDisplay">GdkDisplay</a> *display,
93
<a href="gdk-Drag-and-Drop.html#GdkDragProtocol">GdkDragProtocol</a> *protocol);
94
enum <a href="gdk-Drag-and-Drop.html#GdkDragProtocol">GdkDragProtocol</a>;
95
void <a href="gdk-Drag-and-Drop.html#gdk-drag-context-unref">gdk_drag_context_unref</a> (<a href="gdk-Drag-and-Drop.html#GdkDragContext">GdkDragContext</a> *context);
96
<a href="gdk-Drag-and-Drop.html#GdkDragContext">GdkDragContext</a>;
97
enum <a href="gdk-Drag-and-Drop.html#GdkDragAction">GdkDragAction</a>;
98
void <a href="gdk-Drag-and-Drop.html#gdk-drag-status">gdk_drag_status</a> (<a href="gdk-Drag-and-Drop.html#GdkDragContext">GdkDragContext</a> *context,
99
<a href="gdk-Drag-and-Drop.html#GdkDragAction">GdkDragAction</a> action,
101
gboolean <a href="gdk-Drag-and-Drop.html#gdk-drag-drop-succeeded">gdk_drag_drop_succeeded</a> (<a href="gdk-Drag-and-Drop.html#GdkDragContext">GdkDragContext</a> *context);
106
<div class="refsect1" lang="en">
107
<a name="id2777351"></a><h2>Description</h2>
109
These functions provide a low level interface for drag and drop.
110
The X backend of GDK supports both the Xdnd and Motif drag and drop protocols
111
transparently, the Win32 backend supports the WM_DROPFILES protocol.
114
GTK+ provides a higher level abstraction based on top of these functions,
115
and so they are not normally needed in GTK+ applications.
116
See the Drag and Drop section of
117
the GTK+ documentation for more information.
120
<div class="refsect1" lang="en">
121
<a name="id2777385"></a><h2>Details</h2>
122
<div class="refsect2" lang="en">
123
<a name="id2777395"></a><h3>
124
<a name="gdk-drag-get-selection"></a>gdk_drag_get_selection ()</h3>
125
<a class="indexterm" name="id2777408"></a><pre class="programlisting"><a href="gdk-Properties-and-Atoms.html#GdkAtom">GdkAtom</a> gdk_drag_get_selection (<a href="gdk-Drag-and-Drop.html#GdkDragContext">GdkDragContext</a> *context);</pre>
127
Returns the selection atom for the current source window.</p>
130
<div class="variablelist"><table border="0">
131
<col align="left" valign="top">
134
<td><span class="term"><em class="parameter"><code>context</code></em> :</span></td>
135
<td> a <a href="gdk-Drag-and-Drop.html#GdkDragContext"><span class="type">GdkDragContext</span></a>.
139
<td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
140
<td> the selection atom.
147
<div class="refsect2" lang="en">
148
<a name="id2777478"></a><h3>
149
<a name="gdk-drag-abort"></a>gdk_drag_abort ()</h3>
150
<a class="indexterm" name="id2777491"></a><pre class="programlisting">void gdk_drag_abort (<a href="gdk-Drag-and-Drop.html#GdkDragContext">GdkDragContext</a> *context,
151
guint32 time_);</pre>
153
Aborts a drag without dropping.
156
This function is called by the drag source.</p>
159
<div class="variablelist"><table border="0">
160
<col align="left" valign="top">
163
<td><span class="term"><em class="parameter"><code>context</code></em> :</span></td>
164
<td> a <a href="gdk-Drag-and-Drop.html#GdkDragContext"><span class="type">GdkDragContext</span></a>.
168
<td><span class="term"><em class="parameter"><code>time_</code></em> :</span></td>
169
<td> the timestamp for this operation.
176
<div class="refsect2" lang="en">
177
<a name="id2777576"></a><h3>
178
<a name="gdk-drop-reply"></a>gdk_drop_reply ()</h3>
179
<a class="indexterm" name="id2777589"></a><pre class="programlisting">void gdk_drop_reply (<a href="gdk-Drag-and-Drop.html#GdkDragContext">GdkDragContext</a> *context,
181
guint32 time_);</pre>
183
Accepts or rejects a drop.
186
This function is called by the drag destination in response
187
to a drop initiated by the drag source.</p>
190
<div class="variablelist"><table border="0">
191
<col align="left" valign="top">
194
<td><span class="term"><em class="parameter"><code>context</code></em> :</span></td>
195
<td> a <a href="gdk-Drag-and-Drop.html#GdkDragContext"><span class="type">GdkDragContext</span></a>.
199
<td><span class="term"><em class="parameter"><code>ok</code></em> :</span></td>
200
<td> <code class="literal">TRUE</code> if the drop is accepted.
204
<td><span class="term"><em class="parameter"><code>time_</code></em> :</span></td>
205
<td> the timestamp for this operation.
212
<div class="refsect2" lang="en">
213
<a name="id2777706"></a><h3>
214
<a name="gdk-drag-context-new"></a>gdk_drag_context_new ()</h3>
215
<a class="indexterm" name="id2777719"></a><pre class="programlisting"><a href="gdk-Drag-and-Drop.html#GdkDragContext">GdkDragContext</a>* gdk_drag_context_new (void);</pre>
217
Creates a new <a href="gdk-Drag-and-Drop.html#GdkDragContext"><span class="type">GdkDragContext</span></a>.</p>
220
<div class="variablelist"><table border="0">
221
<col align="left" valign="top">
223
<td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
224
<td> the newly created <a href="gdk-Drag-and-Drop.html#GdkDragContext"><span class="type">GdkDragContext</span></a>.
230
<div class="refsect2" lang="en">
231
<a name="id2777776"></a><h3>
232
<a name="gdk-drag-drop"></a>gdk_drag_drop ()</h3>
233
<a class="indexterm" name="id2777789"></a><pre class="programlisting">void gdk_drag_drop (<a href="gdk-Drag-and-Drop.html#GdkDragContext">GdkDragContext</a> *context,
234
guint32 time_);</pre>
236
Drops on the current destination.
239
This function is called by the drag source.</p>
242
<div class="variablelist"><table border="0">
243
<col align="left" valign="top">
246
<td><span class="term"><em class="parameter"><code>context</code></em> :</span></td>
247
<td> a <a href="gdk-Drag-and-Drop.html#GdkDragContext"><span class="type">GdkDragContext</span></a>.
251
<td><span class="term"><em class="parameter"><code>time_</code></em> :</span></td>
252
<td> the timestamp for this operation.
259
<div class="refsect2" lang="en">
260
<a name="id2777874"></a><h3>
261
<a name="gdk-drag-find-window"></a>gdk_drag_find_window ()</h3>
262
<a class="indexterm" name="id2777887"></a><pre class="programlisting">void gdk_drag_find_window (<a href="gdk-Drag-and-Drop.html#GdkDragContext">GdkDragContext</a> *context,
263
<a href="gdk-Windows.html#GdkWindow">GdkWindow</a> *drag_window,
266
<a href="gdk-Windows.html#GdkWindow">GdkWindow</a> **dest_window,
267
<a href="gdk-Drag-and-Drop.html#GdkDragProtocol">GdkDragProtocol</a> *protocol);</pre>
269
Finds the destination window and DND protocol to use at the
270
given pointer position.
273
This function is called by the drag source to obtain the
274
<em class="parameter"><code>dest_window</code></em> and <em class="parameter"><code>protocol</code></em> parameters for <a href="gdk-Drag-and-Drop.html#gdk-drag-motion"><code class="function">gdk_drag_motion()</code></a>.</p>
277
<div class="variablelist"><table border="0">
278
<col align="left" valign="top">
281
<td><span class="term"><em class="parameter"><code>context</code></em> :</span></td>
282
<td> a <a href="gdk-Drag-and-Drop.html#GdkDragContext"><span class="type">GdkDragContext</span></a>.
286
<td><span class="term"><em class="parameter"><code>drag_window</code></em> :</span></td>
287
<td> a window which may be at the pointer position, but
288
should be ignored, since it is put up by the drag source as an icon.
292
<td><span class="term"><em class="parameter"><code>x_root</code></em> :</span></td>
293
<td> the x position of the pointer in root coordinates.
297
<td><span class="term"><em class="parameter"><code>y_root</code></em> :</span></td>
298
<td> the y position of the pointer in root coordinates.
302
<td><span class="term"><em class="parameter"><code>dest_window</code></em> :</span></td>
303
<td> location to store the destination window in.
307
<td><span class="term"><em class="parameter"><code>protocol</code></em> :</span></td>
308
<td> location to store the DND protocol in.
315
<div class="refsect2" lang="en">
316
<a name="id2778087"></a><h3>
317
<a name="gdk-drag-find-window-for-screen"></a>gdk_drag_find_window_for_screen ()</h3>
318
<a class="indexterm" name="id2778103"></a><pre class="programlisting">void gdk_drag_find_window_for_screen (<a href="gdk-Drag-and-Drop.html#GdkDragContext">GdkDragContext</a> *context,
319
<a href="gdk-Windows.html#GdkWindow">GdkWindow</a> *drag_window,
320
<a href="GdkScreen.html" title="GdkScreen">GdkScreen</a> *screen,
323
<a href="gdk-Windows.html#GdkWindow">GdkWindow</a> **dest_window,
324
<a href="gdk-Drag-and-Drop.html#GdkDragProtocol">GdkDragProtocol</a> *protocol);</pre>
326
Finds the destination window and DND protocol to use at the
327
given pointer position.
330
This function is called by the drag source to obtain the
331
<em class="parameter"><code>dest_window</code></em> and <em class="parameter"><code>protocol</code></em> parameters for <a href="gdk-Drag-and-Drop.html#gdk-drag-motion"><code class="function">gdk_drag_motion()</code></a>.</p>
335
<div class="variablelist"><table border="0">
336
<col align="left" valign="top">
339
<td><span class="term"><em class="parameter"><code>context</code></em> :</span></td>
340
<td> a <a href="gdk-Drag-and-Drop.html#GdkDragContext"><span class="type">GdkDragContext</span></a>
344
<td><span class="term"><em class="parameter"><code>drag_window</code></em> :</span></td>
345
<td> a window which may be at the pointer position, but
346
should be ignored, since it is put up by the drag source as an icon.
350
<td><span class="term"><em class="parameter"><code>screen</code></em> :</span></td>
351
<td> the screen where the destination window is sought.
355
<td><span class="term"><em class="parameter"><code>x_root</code></em> :</span></td>
356
<td> the x position of the pointer in root coordinates.
360
<td><span class="term"><em class="parameter"><code>y_root</code></em> :</span></td>
361
<td> the y position of the pointer in root coordinates.
365
<td><span class="term"><em class="parameter"><code>dest_window</code></em> :</span></td>
366
<td> location to store the destination window in.
370
<td><span class="term"><em class="parameter"><code>protocol</code></em> :</span></td>
371
<td> location to store the DND protocol in.
376
<p class="since">Since 2.2
380
<div class="refsect2" lang="en">
381
<a name="id2778332"></a><h3>
382
<a name="gdk-drag-context-ref"></a>gdk_drag_context_ref ()</h3>
383
<a class="indexterm" name="id2778348"></a><pre class="programlisting">void gdk_drag_context_ref (<a href="gdk-Drag-and-Drop.html#GdkDragContext">GdkDragContext</a> *context);</pre>
384
<div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;">
385
<h3 class="title">Warning</h3>
386
<p><code class="literal">gdk_drag_context_ref</code> is deprecated and should not be used in newly-written code.</p>
389
Deprecated function; use <code class="function">g_object_ref()</code> instead.</p>
392
<div class="variablelist"><table border="0">
393
<col align="left" valign="top">
395
<td><span class="term"><em class="parameter"><code>context</code></em> :</span></td>
396
<td> a <a href="gdk-Drag-and-Drop.html#GdkDragContext"><span class="type">GdkDragContext</span></a>.
402
<div class="refsect2" lang="en">
403
<a name="id2778430"></a><h3>
404
<a name="gdk-drag-begin"></a>gdk_drag_begin ()</h3>
405
<a class="indexterm" name="id2778443"></a><pre class="programlisting"><a href="gdk-Drag-and-Drop.html#GdkDragContext">GdkDragContext</a>* gdk_drag_begin (<a href="gdk-Windows.html#GdkWindow">GdkWindow</a> *window,
406
GList *targets);</pre>
408
Starts a drag and creates a new drag context for it.
411
This function is called by the drag source.</p>
414
<div class="variablelist"><table border="0">
415
<col align="left" valign="top">
418
<td><span class="term"><em class="parameter"><code>window</code></em> :</span></td>
419
<td> the source window for this drag.
423
<td><span class="term"><em class="parameter"><code>targets</code></em> :</span></td>
424
<td> the list of offered targets.
428
<td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
429
<td> a newly created <a href="gdk-Drag-and-Drop.html#GdkDragContext"><span class="type">GdkDragContext</span></a>.
436
<div class="refsect2" lang="en">
437
<a name="id2778539"></a><h3>
438
<a name="gdk-drag-motion"></a>gdk_drag_motion ()</h3>
439
<a class="indexterm" name="id2778552"></a><pre class="programlisting">gboolean gdk_drag_motion (<a href="gdk-Drag-and-Drop.html#GdkDragContext">GdkDragContext</a> *context,
440
<a href="gdk-Windows.html#GdkWindow">GdkWindow</a> *dest_window,
441
<a href="gdk-Drag-and-Drop.html#GdkDragProtocol">GdkDragProtocol</a> protocol,
444
<a href="gdk-Drag-and-Drop.html#GdkDragAction">GdkDragAction</a> suggested_action,
445
<a href="gdk-Drag-and-Drop.html#GdkDragAction">GdkDragAction</a> possible_actions,
446
guint32 time_);</pre>
448
Updates the drag context when the pointer moves or the
449
set of actions changes.
452
This function is called by the drag source.</p>
455
<div class="variablelist"><table border="0">
456
<col align="left" valign="top">
459
<td><span class="term"><em class="parameter"><code>context</code></em> :</span></td>
460
<td> a <a href="gdk-Drag-and-Drop.html#GdkDragContext"><span class="type">GdkDragContext</span></a>.
464
<td><span class="term"><em class="parameter"><code>dest_window</code></em> :</span></td>
465
<td> the new destination window, obtained by
466
<a href="gdk-Drag-and-Drop.html#gdk-drag-find-window"><code class="function">gdk_drag_find_window()</code></a>.
470
<td><span class="term"><em class="parameter"><code>protocol</code></em> :</span></td>
471
<td> the DND protocol in use, obtained by <a href="gdk-Drag-and-Drop.html#gdk-drag-find-window"><code class="function">gdk_drag_find_window()</code></a>.
475
<td><span class="term"><em class="parameter"><code>x_root</code></em> :</span></td>
476
<td> the x position of the pointer in root coordinates.
480
<td><span class="term"><em class="parameter"><code>y_root</code></em> :</span></td>
481
<td> the y position of the pointer in root coordinates.
485
<td><span class="term"><em class="parameter"><code>suggested_action</code></em> :</span></td>
486
<td> the suggested action.
490
<td><span class="term"><em class="parameter"><code>possible_actions</code></em> :</span></td>
491
<td> the possible actions.
495
<td><span class="term"><em class="parameter"><code>time_</code></em> :</span></td>
496
<td> the timestamp for this operation.
500
<td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
508
<div class="refsect2" lang="en">
509
<a name="id2778804"></a><h3>
510
<a name="gdk-drop-finish"></a>gdk_drop_finish ()</h3>
511
<a class="indexterm" name="id2778817"></a><pre class="programlisting">void gdk_drop_finish (<a href="gdk-Drag-and-Drop.html#GdkDragContext">GdkDragContext</a> *context,
513
guint32 time_);</pre>
515
Ends the drag operation after a drop.
518
This function is called by the drag destination.</p>
521
<div class="variablelist"><table border="0">
522
<col align="left" valign="top">
525
<td><span class="term"><em class="parameter"><code>context</code></em> :</span></td>
526
<td> a <span class="type">GtkDragContext</span>.
530
<td><span class="term"><em class="parameter"><code>success</code></em> :</span></td>
531
<td> <code class="literal">TRUE</code> if the data was successfully received.
535
<td><span class="term"><em class="parameter"><code>time_</code></em> :</span></td>
536
<td> the timestamp for this operation.
543
<div class="refsect2" lang="en">
544
<a name="id2778936"></a><h3>
545
<a name="gdk-drag-get-protocol"></a>gdk_drag_get_protocol ()</h3>
546
<a class="indexterm" name="id2778949"></a><pre class="programlisting">guint32 gdk_drag_get_protocol (guint32 xid,
547
<a href="gdk-Drag-and-Drop.html#GdkDragProtocol">GdkDragProtocol</a> *protocol);</pre>
549
Finds out the DND protocol supported by a window.</p>
552
<div class="variablelist"><table border="0">
553
<col align="left" valign="top">
556
<td><span class="term"><em class="parameter"><code>xid</code></em> :</span></td>
557
<td> the X id of the destination window.
561
<td><span class="term"><em class="parameter"><code>protocol</code></em> :</span></td>
562
<td> location where the supported DND protocol is returned.
566
<td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
567
<td> the X id of the window where the drop should happen. This
568
may be <em class="parameter"><code>xid</code></em> or the X id of a proxy window, or None if <em class="parameter"><code>xid</code></em> doesn't
569
support Drag and Drop.
576
<div class="refsect2" lang="en">
577
<a name="id2779047"></a><h3>
578
<a name="gdk-drag-get-protocol-for-display"></a>gdk_drag_get_protocol_for_display ()</h3>
579
<a class="indexterm" name="id2779064"></a><pre class="programlisting">guint32 gdk_drag_get_protocol_for_display (<a href="GdkDisplay.html" title="GdkDisplay">GdkDisplay</a> *display,
581
<a href="gdk-Drag-and-Drop.html#GdkDragProtocol">GdkDragProtocol</a> *protocol);</pre>
583
Finds out the DND protocol supported by a window.</p>
587
<div class="variablelist"><table border="0">
588
<col align="left" valign="top">
591
<td><span class="term"><em class="parameter"><code>display</code></em> :</span></td>
592
<td> the <a href="GdkDisplay.html" title="GdkDisplay"><span class="type">GdkDisplay</span></a> where the destination window resides
596
<td><span class="term"><em class="parameter"><code>xid</code></em> :</span></td>
597
<td> the X id of the destination window.
601
<td><span class="term"><em class="parameter"><code>protocol</code></em> :</span></td>
602
<td> location where the supported DND protocol is returned.
606
<td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
607
<td> the X id of the window where the drop should happen. This
608
may be <em class="parameter"><code>xid</code></em> or the X id of a proxy window, or None if <em class="parameter"><code>xid</code></em> doesn't
609
support Drag and Drop.
614
<p class="since">Since 2.2
618
<div class="refsect2" lang="en">
619
<a name="id2779198"></a><h3>
620
<a name="GdkDragProtocol"></a>enum GdkDragProtocol</h3>
621
<a class="indexterm" name="id2779211"></a><pre class="programlisting">typedef enum
623
GDK_DRAG_PROTO_MOTIF,
625
GDK_DRAG_PROTO_ROOTWIN, /* A root window with nobody claiming
627
GDK_DRAG_PROTO_NONE, /* Not a valid drag window */
628
GDK_DRAG_PROTO_WIN32_DROPFILES, /* The simple WM_DROPFILES dnd */
629
GDK_DRAG_PROTO_OLE2, /* The complex OLE2 dnd (not implemented) */
630
GDK_DRAG_PROTO_LOCAL /* Intra-app */
634
Used in <a href="gdk-Drag-and-Drop.html#GdkDragContext"><span class="type">GdkDragContext</span></a> to indicate the protocol according to
637
<div class="variablelist"><table border="0">
638
<col align="left" valign="top">
641
<td><span class="term"><a name="GDK-DRAG-PROTO-MOTIF:CAPS"></a><code class="literal">GDK_DRAG_PROTO_MOTIF</code></span></td>
642
<td>The Motif DND protocol.
646
<td><span class="term"><a name="GDK-DRAG-PROTO-XDND:CAPS"></a><code class="literal">GDK_DRAG_PROTO_XDND</code></span></td>
647
<td>The Xdnd protocol.
651
<td><span class="term"><a name="GDK-DRAG-PROTO-ROOTWIN:CAPS"></a><code class="literal">GDK_DRAG_PROTO_ROOTWIN</code></span></td>
652
<td>An extension to the Xdnd protocol for
653
unclaimed root window drops.
657
<td><span class="term"><a name="GDK-DRAG-PROTO-NONE:CAPS"></a><code class="literal">GDK_DRAG_PROTO_NONE</code></span></td>
662
<td><span class="term"><a name="GDK-DRAG-PROTO-WIN32-DROPFILES:CAPS"></a><code class="literal">GDK_DRAG_PROTO_WIN32_DROPFILES</code></span></td>
663
<td>The simple WM_DROPFILES protocol.
667
<td><span class="term"><a name="GDK-DRAG-PROTO-OLE2:CAPS"></a><code class="literal">GDK_DRAG_PROTO_OLE2</code></span></td>
668
<td>The complex OLE2 DND protocol (not implemented).
672
<td><span class="term"><a name="GDK-DRAG-PROTO-LOCAL:CAPS"></a><code class="literal">GDK_DRAG_PROTO_LOCAL</code></span></td>
673
<td>Intra-application DND.
681
<div class="refsect2" lang="en">
682
<a name="id2779408"></a><h3>
683
<a name="gdk-drag-context-unref"></a>gdk_drag_context_unref ()</h3>
684
<a class="indexterm" name="id2779424"></a><pre class="programlisting">void gdk_drag_context_unref (<a href="gdk-Drag-and-Drop.html#GdkDragContext">GdkDragContext</a> *context);</pre>
685
<div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;">
686
<h3 class="title">Warning</h3>
687
<p><code class="literal">gdk_drag_context_unref</code> is deprecated and should not be used in newly-written code.</p>
690
Deprecated function; use <code class="function">g_object_unref()</code> instead.</p>
693
<div class="variablelist"><table border="0">
694
<col align="left" valign="top">
696
<td><span class="term"><em class="parameter"><code>context</code></em> :</span></td>
697
<td> a <a href="gdk-Drag-and-Drop.html#GdkDragContext"><span class="type">GdkDragContext</span></a>.
703
<div class="refsect2" lang="en">
704
<a name="id2779506"></a><h3>
705
<a name="GdkDragContext"></a>GdkDragContext</h3>
706
<a class="indexterm" name="id2779518"></a><pre class="programlisting">typedef struct {
707
GObject parent_instance;
710
GdkDragProtocol protocol;
714
GdkWindow *source_window;
715
GdkWindow *dest_window;
718
GdkDragAction actions;
719
GdkDragAction suggested_action;
720
GdkDragAction action;
726
A <span class="structname">GdkDragContext</span> holds information about a
727
drag in progress. It is used on both source and destination sides.
729
<div class="variablelist"><table border="0">
730
<col align="left" valign="top">
733
<td><span class="term">GObject <em class="structfield"><code>parent_instance</code></em>;</span></td>
734
<td>the parent instance
738
<td><span class="term"><a href="gdk-Drag-and-Drop.html#GdkDragProtocol">GdkDragProtocol</a> <em class="structfield"><code>protocol</code></em>;</span></td>
739
<td>the DND protocol which governs this drag.
743
<td><span class="term">gboolean <em class="structfield"><code>is_source</code></em>;</span></td>
745
<code class="literal">TRUE</code> if the context is used on the source side.
749
<td><span class="term"><a href="gdk-Windows.html#GdkWindow">GdkWindow</a> *<em class="structfield"><code>source_window</code></em>;</span></td>
750
<td>the source of this drag.
754
<td><span class="term"><a href="gdk-Windows.html#GdkWindow">GdkWindow</a> *<em class="structfield"><code>dest_window</code></em>;</span></td>
755
<td>the destination window of this drag.
759
<td><span class="term">GList *<em class="structfield"><code>targets</code></em>;</span></td>
760
<td>a list of targets offered by the source.
764
<td><span class="term"><a href="gdk-Drag-and-Drop.html#GdkDragAction">GdkDragAction</a> <em class="structfield"><code>actions</code></em>;</span></td>
765
<td>a bitmask of actions proposed by the source when
766
<em class="parameter"><code>suggested_action</code></em> is <a href="gdk-Drag-and-Drop.html#GDK-ACTION-ASK:CAPS"><code class="literal">GDK_ACTION_ASK</code></a>.
770
<td><span class="term"><a href="gdk-Drag-and-Drop.html#GdkDragAction">GdkDragAction</a> <em class="structfield"><code>suggested_action</code></em>;</span></td>
771
<td>the action suggested by the source.
775
<td><span class="term"><a href="gdk-Drag-and-Drop.html#GdkDragAction">GdkDragAction</a> <em class="structfield"><code>action</code></em>;</span></td>
776
<td>the action chosen by the destination.
780
<td><span class="term">guint32 <em class="structfield"><code>start_time</code></em>;</span></td>
781
<td>a timestamp recording the start time of this drag.
789
<div class="refsect2" lang="en">
790
<a name="id2779785"></a><h3>
791
<a name="GdkDragAction"></a>enum GdkDragAction</h3>
792
<a class="indexterm" name="id2779798"></a><pre class="programlisting">typedef enum
794
GDK_ACTION_DEFAULT = 1 << 0,
795
GDK_ACTION_COPY = 1 << 1,
796
GDK_ACTION_MOVE = 1 << 2,
797
GDK_ACTION_LINK = 1 << 3,
798
GDK_ACTION_PRIVATE = 1 << 4,
799
GDK_ACTION_ASK = 1 << 5
803
Used in <a href="gdk-Drag-and-Drop.html#GdkDragContext"><span class="type">GdkDragContext</span></a> to indicate what the destination
804
should do with the dropped data.
806
<div class="variablelist"><table border="0">
807
<col align="left" valign="top">
810
<td><span class="term"><a name="GDK-ACTION-DEFAULT:CAPS"></a><code class="literal">GDK_ACTION_DEFAULT</code></span></td>
811
<td>Means nothing, and should not be used.
815
<td><span class="term"><a name="GDK-ACTION-COPY:CAPS"></a><code class="literal">GDK_ACTION_COPY</code></span></td>
820
<td><span class="term"><a name="GDK-ACTION-MOVE:CAPS"></a><code class="literal">GDK_ACTION_MOVE</code></span></td>
821
<td>Move the data, i.e. first copy it, then delete
822
it from the source using the DELETE target of the X selection protocol.
826
<td><span class="term"><a name="GDK-ACTION-LINK:CAPS"></a><code class="literal">GDK_ACTION_LINK</code></span></td>
827
<td>Add a link to the data. Note that this is only
828
useful if source and destination agree on what it means.
832
<td><span class="term"><a name="GDK-ACTION-PRIVATE:CAPS"></a><code class="literal">GDK_ACTION_PRIVATE</code></span></td>
833
<td>Special action which tells the source that the
834
destination will do something that the source doesn't understand.
838
<td><span class="term"><a name="GDK-ACTION-ASK:CAPS"></a><code class="literal">GDK_ACTION_ASK</code></span></td>
839
<td>Ask the user what to do with the data.
847
<div class="refsect2" lang="en">
848
<a name="id2779972"></a><h3>
849
<a name="gdk-drag-status"></a>gdk_drag_status ()</h3>
850
<a class="indexterm" name="id2779984"></a><pre class="programlisting">void gdk_drag_status (<a href="gdk-Drag-and-Drop.html#GdkDragContext">GdkDragContext</a> *context,
851
<a href="gdk-Drag-and-Drop.html#GdkDragAction">GdkDragAction</a> action,
852
guint32 time_);</pre>
854
Selects one of the actions offered by the drag source.
857
This function is called by the drag destination in response to
858
<a href="gdk-Drag-and-Drop.html#gdk-drag-motion"><code class="function">gdk_drag_motion()</code></a> called by the drag source.</p>
861
<div class="variablelist"><table border="0">
862
<col align="left" valign="top">
865
<td><span class="term"><em class="parameter"><code>context</code></em> :</span></td>
866
<td> a <a href="gdk-Drag-and-Drop.html#GdkDragContext"><span class="type">GdkDragContext</span></a>.
870
<td><span class="term"><em class="parameter"><code>action</code></em> :</span></td>
871
<td> the selected action which will be taken when a drop happens,
872
or 0 to indicate that a drop will not be accepted.
876
<td><span class="term"><em class="parameter"><code>time_</code></em> :</span></td>
877
<td> the timestamp for this operation.
884
<div class="refsect2" lang="en">
885
<a name="id2780105"></a><h3>
886
<a name="gdk-drag-drop-succeeded"></a>gdk_drag_drop_succeeded ()</h3>
887
<a class="indexterm" name="id2780120"></a><pre class="programlisting">gboolean gdk_drag_drop_succeeded (<a href="gdk-Drag-and-Drop.html#GdkDragContext">GdkDragContext</a> *context);</pre>
889
Returns wether the dropped data has been successfully
890
transferred. This function is intended to be used while
891
handling a <a href="gdk-Events.html#GDK-DROP-FINISHED:CAPS"><code class="literal">GDK_DROP_FINISHED</code></a> event, its return value is
892
meaningless at other times.</p>
896
<div class="variablelist"><table border="0">
897
<col align="left" valign="top">
900
<td><span class="term"><em class="parameter"><code>context</code></em> :</span></td>
901
<td> a <a href="gdk-Drag-and-Drop.html#GdkDragContext"><span class="type">GdkDragContext</span></a>
905
<td><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></td>
906
<td> <code class="literal">TRUE</code> if the drop was successful.
912
<p class="since">Since 2.6