summaryrefslogtreecommitdiff
path: root/docs/reference/gdk/tmpl/selections.sgml
blob: 30c07f1c2476bd6434e9f7fe8560dcbbd592895e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
<!-- ##### SECTION Title ##### -->
Selections

<!-- ##### SECTION Short_Description ##### -->
Functions for transfering data via the X selection mechanism

<!-- ##### SECTION Long_Description ##### -->
<para>
The X selection mechanism provides a way to transfer
arbitrary chunks of data between programs. 
A <firstterm>selection</firstterm> is a essentially 
a named clipboard, identified by a string interned
as a #GdkAtom. By claiming ownership of a selection,
an application indicates that it will be responsible
for supplying its contents. The most common 
selections are <literal>PRIMARY</literal> and 
<literal>CLIPBOARD</literal>.
</para>
<para>
The contents of a selection can be represented in
a number of formats, called <firstterm>targets</firstterm>.
Each target is identified by an atom. A list of
all possible targets supported by the selection owner
can be retrieved by requesting the special target
<literal>TARGETS</literal>. When a selection is 
retrieved, the data is accompanied by a type
(an atom), and a format (an integer, representing
the number of bits per item).
See <link linkend="gdk-Properties-and-Atoms">Properties and Atoms</link>
for more information.
</para>
<para>
The functions in this section only contain the lowlevel
parts of the selection protocol. A considerably more
complicated implementation is needed on top of this.
GTK+ contains such an implementation in the functions
in <literal>gtkselection.h</literal> and programmers
should use those functions instead of the ones presented 
here. If you plan to implement selection handling
directly on top of the functions here, you should refer
to the X Inter-client Communication Conventions Manual
(ICCCM).
</para>

<!-- ##### SECTION See_Also ##### -->
<para>

</para>

<!-- ##### SECTION Stability_Level ##### -->


<!-- ##### SECTION Image ##### -->


<!-- ##### TYPEDEF GdkSelection ##### -->
<para>
The #GdkSelection enumeration contains predefined 
atom values for several common selections.
</para>


<!-- ##### TYPEDEF GdkSelectionType ##### -->
<para>
The #GdkSelectionType enumeration contains predefined
atom values used to represent the types of data transferred
in response to a request for a target. See the
ICCCM for details about what data should be transferred
for each of these types. Other atoms can be used,
and the recommended practice for GTK+ is to to use mime 
types for this purpose. However, supporting these types
may be useful for compatibility with older programs.
</para>


<!-- ##### TYPEDEF GdkTarget ##### -->
<para>
The #GdkTarget enumeration contains predefined atom values which are
used to describe possible targets for a selection. Other atoms can be
used, and the recommended practice for GTK+ is to to use mime types
for this purpose. However, supporting these types may be useful for
compatibility with older programs.
</para>


<!-- ##### MACRO GDK_SELECTION_PRIMARY ##### -->
<para>
A #GdkAtom representing the <literal>PRIMARY</literal> selection.
</para>



<!-- ##### MACRO GDK_SELECTION_SECONDARY ##### -->
<para>
A #GdkAtom representing the <literal>SECONDARY</literal> selection.
</para>



<!-- ##### MACRO GDK_SELECTION_CLIPBOARD ##### -->
<para>
A #GdkAtom representing the <literal>CLIPBOARD</literal> selection.
</para>



<!-- ##### MACRO GDK_TARGET_BITMAP ##### -->
<para>
A #GdkAtom representing the <literal>BITMAP</literal> selection target.
</para>



<!-- ##### MACRO GDK_TARGET_COLORMAP ##### -->
<para>
A #GdkAtom representing the <literal>COLORMAP</literal> selection target.
</para>



<!-- ##### MACRO GDK_TARGET_DRAWABLE ##### -->
<para>
A #GdkAtom representing the <literal>DRAWABLE</literal> selection target.
</para>



<!-- ##### MACRO GDK_TARGET_PIXMAP ##### -->
<para>
A #GdkAtom representing the <literal>PIXMAP</literal> selection target.
</para>



<!-- ##### MACRO GDK_TARGET_STRING ##### -->
<para>
A #GdkAtom representing the <literal>STRING</literal> selection target.
</para>



<!-- ##### MACRO GDK_SELECTION_TYPE_ATOM ##### -->
<para>
A #GdkAtom representing the <literal>ATOM</literal> selection type.
</para>



<!-- ##### MACRO GDK_SELECTION_TYPE_BITMAP ##### -->
<para>
A #GdkAtom representing the <literal>BITMAP</literal> selection type.
</para>



<!-- ##### MACRO GDK_SELECTION_TYPE_COLORMAP ##### -->
<para>
A #GdkAtom representing the <literal>COLORMAP</literal> selection type.
</para>



<!-- ##### MACRO GDK_SELECTION_TYPE_DRAWABLE ##### -->
<para>
A #GdkAtom representing the <literal>DRAWABLE</literal> selection type.
</para>



<!-- ##### MACRO GDK_SELECTION_TYPE_INTEGER ##### -->
<para>
A #GdkAtom representing the <literal>INTEGER</literal> selection type.
</para>



<!-- ##### MACRO GDK_SELECTION_TYPE_PIXMAP ##### -->
<para>
A #GdkAtom representing the <literal>PIXMAP</literal> selection type.
</para>



<!-- ##### MACRO GDK_SELECTION_TYPE_WINDOW ##### -->
<para>
A #GdkAtom representing the <literal>WINDOW</literal> selection type.
</para>



<!-- ##### MACRO GDK_SELECTION_TYPE_STRING ##### -->
<para>
A #GdkAtom representing the <literal>STRING</literal> selection type.
</para>



<!-- ##### FUNCTION gdk_selection_owner_set ##### -->
<para>
Sets the owner of the given selection.
</para>

@owner: a #GdkWindow or %NULL to indicate that the
        the owner for the given should be unset.
@selection: an atom identifying a selection.
@time_: timestamp to use when setting the selection.
       If this is older than the timestamp given last
       time the owner was set for the given selection, the 
       request will be ignored.
@send_event: if %TRUE, and the new owner is different
             from the current owner, the current owner
             will be sent a SelectionClear event.
@Returns: %TRUE if the selection owner was successfully
          changed to @owner, otherwise %FALSE.


<!-- ##### FUNCTION gdk_selection_owner_set_for_display ##### -->
<para>

</para>

@display: 
@owner: 
@selection: 
@time_: 
@send_event: 
@Returns: 


<!-- ##### FUNCTION gdk_selection_owner_get ##### -->
<para>
Determines the owner of the given selection.
</para>

@selection: an atom indentifying a selection.
@Returns: if there is a selection owner for this window,
          and it is a window known to the current process,
          the #GdkWindow that owns the selection, otherwise
          %NULL. Note that the return value may be owned
          by a different process if a foreign window
          was previously created for that window, but
          a new foreign window will never be created by
          this call.


<!-- ##### FUNCTION gdk_selection_owner_get_for_display ##### -->
<para>

</para>

@display: 
@selection: 
@Returns: 


<!-- ##### FUNCTION gdk_selection_convert ##### -->
<para>
Retrieves the contents of a selection in a given
form.
</para>

@requestor: a #GdkWindow.
@selection: an atom identifying the selection to get the
            contents of.
@target: the form in which to retrieve the selection.
@time_: the timestamp to use when retrieving the
       selection. The selection owner may refuse the
       request if it did not own the selection at 
       the time indicated by the timestamp.


<!-- ##### FUNCTION gdk_selection_property_get ##### -->
<para>
</para>

@requestor: 
@data: 
@prop_type: 
@prop_format: 
@Returns: 


<!-- ##### FUNCTION gdk_selection_send_notify ##### -->
<para>
Sends a response to SelectionRequest event.
</para>

@requestor: window to which to deliver response.
@selection: selection that was requested.
@target: target that was selected.
@property: property in which the selection owner stored the
           data, or %GDK_NONE to indicate that the request
           was rejected.
@time_: timestamp.


<!-- ##### FUNCTION gdk_selection_send_notify_for_display ##### -->
<para>

</para>

@display: 
@requestor: 
@selection: 
@target: 
@property: 
@time_: