1 /* Generated by wayland-scanner 1.22.0 */
2 
3 #ifndef GTK_PRIMARY_SELECTION_CLIENT_PROTOCOL_H
4 #define GTK_PRIMARY_SELECTION_CLIENT_PROTOCOL_H
5 
6 #include <stdint.h>
7 #include <stddef.h>
8 #include "wayland-client.h"
9 
10 #ifdef  __cplusplus
11 extern "C" {
12 #endif
13 
14 /**
15  * @page page_gtk_primary_selection The gtk_primary_selection protocol
16  * Primary selection protocol
17  *
18  * @section page_desc_gtk_primary_selection Description
19  *
20  * This protocol provides the ability to have a primary selection device to
21  * match that of the X server. This primary selection is a shortcut to the
22  * common clipboard selection, where text just needs to be selected in order
23  * to allow copying it elsewhere. The de facto way to perform this action
24  * is the middle mouse button, although it is not limited to this one.
25  *
26  * Clients wishing to honor primary selection should create a primary
27  * selection source and set it as the selection through
28  * wp_primary_selection_device.set_selection whenever the text selection
29  * changes. In order to minimize calls in pointer-driven text selection,
30  * it should happen only once after the operation finished. Similarly,
31  * a NULL source should be set when text is unselected.
32  *
33  * wp_primary_selection_offer objects are first announced through the
34  * wp_primary_selection_device.data_offer event. Immediately after this event,
35  * the primary data offer will emit wp_primary_selection_offer.offer events
36  * to let know of the mime types being offered.
37  *
38  * When the primary selection changes, the client with the keyboard focus
39  * will receive wp_primary_selection_device.selection events. Only the client
40  * with the keyboard focus will receive such events with a non-NULL
41  * wp_primary_selection_offer. Across keyboard focus changes, previously
42  * focused clients will receive wp_primary_selection_device.events with a
43  * NULL wp_primary_selection_offer.
44  *
45  * In order to request the primary selection data, the client must pass
46  * a recent serial pertaining to the press event that is triggering the
47  * operation, if the compositor deems the serial valid and recent, the
48  * wp_primary_selection_source.send event will happen in the other end
49  * to let the transfer begin. The client owning the primary selection
50  * should write the requested data, and close the file descriptor
51  * immediately.
52  *
53  * If the primary selection owner client disappeared during the transfer,
54  * the client reading the data will receive a
55  * wp_primary_selection_device.selection event with a NULL
56  * wp_primary_selection_offer, the client should take this as a hint
57  * to finish the reads related to the no longer existing offer.
58  *
59  * The primary selection owner should be checking for errors during
60  * writes, merely cancelling the ongoing transfer if any happened.
61  *
62  * @section page_ifaces_gtk_primary_selection Interfaces
63  * - @subpage page_iface_gtk_primary_selection_device_manager - X primary selection emulation
64  * - @subpage page_iface_gtk_primary_selection_device -
65  * - @subpage page_iface_gtk_primary_selection_offer - offer to transfer primary selection contents
66  * - @subpage page_iface_gtk_primary_selection_source - offer to replace the contents of the primary selection
67  * @section page_copyright_gtk_primary_selection Copyright
68  * <pre>
69  *
70  * Copyright © 2015, 2016 Red Hat
71  *
72  * Permission is hereby granted, free of charge, to any person obtaining a
73  * copy of this software and associated documentation files (the "Software"),
74  * to deal in the Software without restriction, including without limitation
75  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
76  * and/or sell copies of the Software, and to permit persons to whom the
77  * Software is furnished to do so, subject to the following conditions:
78  *
79  * The above copyright notice and this permission notice (including the next
80  * paragraph) shall be included in all copies or substantial portions of the
81  * Software.
82  *
83  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
84  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
85  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
86  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
87  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
88  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
89  * DEALINGS IN THE SOFTWARE.
90  * </pre>
91  */
92 struct gtk_primary_selection_device;
93 struct gtk_primary_selection_device_manager;
94 struct gtk_primary_selection_offer;
95 struct gtk_primary_selection_source;
96 struct wl_seat;
97 
98 #ifndef GTK_PRIMARY_SELECTION_DEVICE_MANAGER_INTERFACE
99 #define GTK_PRIMARY_SELECTION_DEVICE_MANAGER_INTERFACE
100 /**
101  * @page page_iface_gtk_primary_selection_device_manager gtk_primary_selection_device_manager
102  * @section page_iface_gtk_primary_selection_device_manager_desc Description
103  *
104  * The primary selection device manager is a singleton global object that
105  * provides access to the primary selection. It allows to create
106  * wp_primary_selection_source objects, as well as retrieving the per-seat
107  * wp_primary_selection_device objects.
108  * @section page_iface_gtk_primary_selection_device_manager_api API
109  * See @ref iface_gtk_primary_selection_device_manager.
110  */
111 /**
112  * @defgroup iface_gtk_primary_selection_device_manager The gtk_primary_selection_device_manager interface
113  *
114  * The primary selection device manager is a singleton global object that
115  * provides access to the primary selection. It allows to create
116  * wp_primary_selection_source objects, as well as retrieving the per-seat
117  * wp_primary_selection_device objects.
118  */
119 extern const struct wl_interface gtk_primary_selection_device_manager_interface;
120 #endif
121 #ifndef GTK_PRIMARY_SELECTION_DEVICE_INTERFACE
122 #define GTK_PRIMARY_SELECTION_DEVICE_INTERFACE
123 /**
124  * @page page_iface_gtk_primary_selection_device gtk_primary_selection_device
125  * @section page_iface_gtk_primary_selection_device_api API
126  * See @ref iface_gtk_primary_selection_device.
127  */
128 /**
129  * @defgroup iface_gtk_primary_selection_device The gtk_primary_selection_device interface
130  */
131 extern const struct wl_interface gtk_primary_selection_device_interface;
132 #endif
133 #ifndef GTK_PRIMARY_SELECTION_OFFER_INTERFACE
134 #define GTK_PRIMARY_SELECTION_OFFER_INTERFACE
135 /**
136  * @page page_iface_gtk_primary_selection_offer gtk_primary_selection_offer
137  * @section page_iface_gtk_primary_selection_offer_desc Description
138  *
139  * A wp_primary_selection_offer represents an offer to transfer the contents
140  * of the primary selection clipboard to the client. Similar to
141  * wl_data_offer, the offer also describes the mime types that the source
142  * will transferthat the
143  * data can be converted to and provides the mechanisms for transferring the
144  * data directly to the client.
145  * @section page_iface_gtk_primary_selection_offer_api API
146  * See @ref iface_gtk_primary_selection_offer.
147  */
148 /**
149  * @defgroup iface_gtk_primary_selection_offer The gtk_primary_selection_offer interface
150  *
151  * A wp_primary_selection_offer represents an offer to transfer the contents
152  * of the primary selection clipboard to the client. Similar to
153  * wl_data_offer, the offer also describes the mime types that the source
154  * will transferthat the
155  * data can be converted to and provides the mechanisms for transferring the
156  * data directly to the client.
157  */
158 extern const struct wl_interface gtk_primary_selection_offer_interface;
159 #endif
160 #ifndef GTK_PRIMARY_SELECTION_SOURCE_INTERFACE
161 #define GTK_PRIMARY_SELECTION_SOURCE_INTERFACE
162 /**
163  * @page page_iface_gtk_primary_selection_source gtk_primary_selection_source
164  * @section page_iface_gtk_primary_selection_source_desc Description
165  *
166  * The source side of a wp_primary_selection_offer, it provides a way to
167  * describe the offered data and respond to requests to transfer the
168  * requested contents of the primary selection clipboard.
169  * @section page_iface_gtk_primary_selection_source_api API
170  * See @ref iface_gtk_primary_selection_source.
171  */
172 /**
173  * @defgroup iface_gtk_primary_selection_source The gtk_primary_selection_source interface
174  *
175  * The source side of a wp_primary_selection_offer, it provides a way to
176  * describe the offered data and respond to requests to transfer the
177  * requested contents of the primary selection clipboard.
178  */
179 extern const struct wl_interface gtk_primary_selection_source_interface;
180 #endif
181 
182 #define GTK_PRIMARY_SELECTION_DEVICE_MANAGER_CREATE_SOURCE 0
183 #define GTK_PRIMARY_SELECTION_DEVICE_MANAGER_GET_DEVICE 1
184 #define GTK_PRIMARY_SELECTION_DEVICE_MANAGER_DESTROY 2
185 
186 
187 /**
188  * @ingroup iface_gtk_primary_selection_device_manager
189  */
190 #define GTK_PRIMARY_SELECTION_DEVICE_MANAGER_CREATE_SOURCE_SINCE_VERSION 1
191 /**
192  * @ingroup iface_gtk_primary_selection_device_manager
193  */
194 #define GTK_PRIMARY_SELECTION_DEVICE_MANAGER_GET_DEVICE_SINCE_VERSION 1
195 /**
196  * @ingroup iface_gtk_primary_selection_device_manager
197  */
198 #define GTK_PRIMARY_SELECTION_DEVICE_MANAGER_DESTROY_SINCE_VERSION 1
199 
200 /** @ingroup iface_gtk_primary_selection_device_manager */
201 static inline void
gtk_primary_selection_device_manager_set_user_data(struct gtk_primary_selection_device_manager * gtk_primary_selection_device_manager,void * user_data)202 gtk_primary_selection_device_manager_set_user_data(struct gtk_primary_selection_device_manager *gtk_primary_selection_device_manager, void *user_data)
203 {
204 	wl_proxy_set_user_data((struct wl_proxy *) gtk_primary_selection_device_manager, user_data);
205 }
206 
207 /** @ingroup iface_gtk_primary_selection_device_manager */
208 static inline void *
gtk_primary_selection_device_manager_get_user_data(struct gtk_primary_selection_device_manager * gtk_primary_selection_device_manager)209 gtk_primary_selection_device_manager_get_user_data(struct gtk_primary_selection_device_manager *gtk_primary_selection_device_manager)
210 {
211 	return wl_proxy_get_user_data((struct wl_proxy *) gtk_primary_selection_device_manager);
212 }
213 
214 static inline uint32_t
gtk_primary_selection_device_manager_get_version(struct gtk_primary_selection_device_manager * gtk_primary_selection_device_manager)215 gtk_primary_selection_device_manager_get_version(struct gtk_primary_selection_device_manager *gtk_primary_selection_device_manager)
216 {
217 	return wl_proxy_get_version((struct wl_proxy *) gtk_primary_selection_device_manager);
218 }
219 
220 /**
221  * @ingroup iface_gtk_primary_selection_device_manager
222  *
223  * Create a new primary selection source.
224  */
225 static inline struct gtk_primary_selection_source *
gtk_primary_selection_device_manager_create_source(struct gtk_primary_selection_device_manager * gtk_primary_selection_device_manager)226 gtk_primary_selection_device_manager_create_source(struct gtk_primary_selection_device_manager *gtk_primary_selection_device_manager)
227 {
228 	struct wl_proxy *id;
229 
230 	id = wl_proxy_marshal_flags((struct wl_proxy *) gtk_primary_selection_device_manager,
231 			 GTK_PRIMARY_SELECTION_DEVICE_MANAGER_CREATE_SOURCE, &gtk_primary_selection_source_interface, wl_proxy_get_version((struct wl_proxy *) gtk_primary_selection_device_manager), 0, NULL);
232 
233 	return (struct gtk_primary_selection_source *) id;
234 }
235 
236 /**
237  * @ingroup iface_gtk_primary_selection_device_manager
238  *
239  * Create a new data device for a given seat.
240  */
241 static inline struct gtk_primary_selection_device *
gtk_primary_selection_device_manager_get_device(struct gtk_primary_selection_device_manager * gtk_primary_selection_device_manager,struct wl_seat * seat)242 gtk_primary_selection_device_manager_get_device(struct gtk_primary_selection_device_manager *gtk_primary_selection_device_manager, struct wl_seat *seat)
243 {
244 	struct wl_proxy *id;
245 
246 	id = wl_proxy_marshal_flags((struct wl_proxy *) gtk_primary_selection_device_manager,
247 			 GTK_PRIMARY_SELECTION_DEVICE_MANAGER_GET_DEVICE, &gtk_primary_selection_device_interface, wl_proxy_get_version((struct wl_proxy *) gtk_primary_selection_device_manager), 0, NULL, seat);
248 
249 	return (struct gtk_primary_selection_device *) id;
250 }
251 
252 /**
253  * @ingroup iface_gtk_primary_selection_device_manager
254  *
255  * Destroy the primary selection device manager.
256  */
257 static inline void
gtk_primary_selection_device_manager_destroy(struct gtk_primary_selection_device_manager * gtk_primary_selection_device_manager)258 gtk_primary_selection_device_manager_destroy(struct gtk_primary_selection_device_manager *gtk_primary_selection_device_manager)
259 {
260 	wl_proxy_marshal_flags((struct wl_proxy *) gtk_primary_selection_device_manager,
261 			 GTK_PRIMARY_SELECTION_DEVICE_MANAGER_DESTROY, NULL, wl_proxy_get_version((struct wl_proxy *) gtk_primary_selection_device_manager), WL_MARSHAL_FLAG_DESTROY);
262 }
263 
264 /**
265  * @ingroup iface_gtk_primary_selection_device
266  * @struct gtk_primary_selection_device_listener
267  */
268 struct gtk_primary_selection_device_listener {
269 	/**
270 	 * introduce a new wp_primary_selection_offer
271 	 *
272 	 * Introduces a new wp_primary_selection_offer object that may be
273 	 * used to receive the current primary selection. Immediately
274 	 * following this event, the new wp_primary_selection_offer object
275 	 * will send wp_primary_selection_offer.offer events to describe
276 	 * the offered mime types.
277 	 */
278 	void (*data_offer)(void *data,
279 			   struct gtk_primary_selection_device *gtk_primary_selection_device,
280 			   struct gtk_primary_selection_offer *offer);
281 	/**
282 	 * advertise a new primary selection
283 	 *
284 	 * The wp_primary_selection_device.selection event is sent to
285 	 * notify the client of a new primary selection. This event is sent
286 	 * after the wp_primary_selection.data_offer event introducing this
287 	 * object, and after the offer has announced its mimetypes through
288 	 * wp_primary_selection_offer.offer.
289 	 *
290 	 * The data_offer is valid until a new offer or NULL is received or
291 	 * until the client loses keyboard focus. The client must destroy
292 	 * the previous selection data_offer, if any, upon receiving this
293 	 * event.
294 	 */
295 	void (*selection)(void *data,
296 			  struct gtk_primary_selection_device *gtk_primary_selection_device,
297 			  struct gtk_primary_selection_offer *id);
298 };
299 
300 /**
301  * @ingroup iface_gtk_primary_selection_device
302  */
303 static inline int
gtk_primary_selection_device_add_listener(struct gtk_primary_selection_device * gtk_primary_selection_device,const struct gtk_primary_selection_device_listener * listener,void * data)304 gtk_primary_selection_device_add_listener(struct gtk_primary_selection_device *gtk_primary_selection_device,
305 					  const struct gtk_primary_selection_device_listener *listener, void *data)
306 {
307 	return wl_proxy_add_listener((struct wl_proxy *) gtk_primary_selection_device,
308 				     (void (**)(void)) listener, data);
309 }
310 
311 #define GTK_PRIMARY_SELECTION_DEVICE_SET_SELECTION 0
312 #define GTK_PRIMARY_SELECTION_DEVICE_DESTROY 1
313 
314 /**
315  * @ingroup iface_gtk_primary_selection_device
316  */
317 #define GTK_PRIMARY_SELECTION_DEVICE_DATA_OFFER_SINCE_VERSION 1
318 /**
319  * @ingroup iface_gtk_primary_selection_device
320  */
321 #define GTK_PRIMARY_SELECTION_DEVICE_SELECTION_SINCE_VERSION 1
322 
323 /**
324  * @ingroup iface_gtk_primary_selection_device
325  */
326 #define GTK_PRIMARY_SELECTION_DEVICE_SET_SELECTION_SINCE_VERSION 1
327 /**
328  * @ingroup iface_gtk_primary_selection_device
329  */
330 #define GTK_PRIMARY_SELECTION_DEVICE_DESTROY_SINCE_VERSION 1
331 
332 /** @ingroup iface_gtk_primary_selection_device */
333 static inline void
gtk_primary_selection_device_set_user_data(struct gtk_primary_selection_device * gtk_primary_selection_device,void * user_data)334 gtk_primary_selection_device_set_user_data(struct gtk_primary_selection_device *gtk_primary_selection_device, void *user_data)
335 {
336 	wl_proxy_set_user_data((struct wl_proxy *) gtk_primary_selection_device, user_data);
337 }
338 
339 /** @ingroup iface_gtk_primary_selection_device */
340 static inline void *
gtk_primary_selection_device_get_user_data(struct gtk_primary_selection_device * gtk_primary_selection_device)341 gtk_primary_selection_device_get_user_data(struct gtk_primary_selection_device *gtk_primary_selection_device)
342 {
343 	return wl_proxy_get_user_data((struct wl_proxy *) gtk_primary_selection_device);
344 }
345 
346 static inline uint32_t
gtk_primary_selection_device_get_version(struct gtk_primary_selection_device * gtk_primary_selection_device)347 gtk_primary_selection_device_get_version(struct gtk_primary_selection_device *gtk_primary_selection_device)
348 {
349 	return wl_proxy_get_version((struct wl_proxy *) gtk_primary_selection_device);
350 }
351 
352 /**
353  * @ingroup iface_gtk_primary_selection_device
354  *
355  * Replaces the current selection. The previous owner of the primary selection
356  * will receive a wp_primary_selection_source.cancelled event.
357  *
358  * To unset the selection, set the source to NULL.
359  */
360 static inline void
gtk_primary_selection_device_set_selection(struct gtk_primary_selection_device * gtk_primary_selection_device,struct gtk_primary_selection_source * source,uint32_t serial)361 gtk_primary_selection_device_set_selection(struct gtk_primary_selection_device *gtk_primary_selection_device, struct gtk_primary_selection_source *source, uint32_t serial)
362 {
363 	wl_proxy_marshal_flags((struct wl_proxy *) gtk_primary_selection_device,
364 			 GTK_PRIMARY_SELECTION_DEVICE_SET_SELECTION, NULL, wl_proxy_get_version((struct wl_proxy *) gtk_primary_selection_device), 0, source, serial);
365 }
366 
367 /**
368  * @ingroup iface_gtk_primary_selection_device
369  *
370  * Destroy the primary selection device.
371  */
372 static inline void
gtk_primary_selection_device_destroy(struct gtk_primary_selection_device * gtk_primary_selection_device)373 gtk_primary_selection_device_destroy(struct gtk_primary_selection_device *gtk_primary_selection_device)
374 {
375 	wl_proxy_marshal_flags((struct wl_proxy *) gtk_primary_selection_device,
376 			 GTK_PRIMARY_SELECTION_DEVICE_DESTROY, NULL, wl_proxy_get_version((struct wl_proxy *) gtk_primary_selection_device), WL_MARSHAL_FLAG_DESTROY);
377 }
378 
379 /**
380  * @ingroup iface_gtk_primary_selection_offer
381  * @struct gtk_primary_selection_offer_listener
382  */
383 struct gtk_primary_selection_offer_listener {
384 	/**
385 	 * advertise offered mime type
386 	 *
387 	 * Sent immediately after creating announcing the
388 	 * wp_primary_selection_offer through
389 	 * wp_primary_selection_device.data_offer. One event is sent per
390 	 * offered mime type.
391 	 */
392 	void (*offer)(void *data,
393 		      struct gtk_primary_selection_offer *gtk_primary_selection_offer,
394 		      const char *mime_type);
395 };
396 
397 /**
398  * @ingroup iface_gtk_primary_selection_offer
399  */
400 static inline int
gtk_primary_selection_offer_add_listener(struct gtk_primary_selection_offer * gtk_primary_selection_offer,const struct gtk_primary_selection_offer_listener * listener,void * data)401 gtk_primary_selection_offer_add_listener(struct gtk_primary_selection_offer *gtk_primary_selection_offer,
402 					 const struct gtk_primary_selection_offer_listener *listener, void *data)
403 {
404 	return wl_proxy_add_listener((struct wl_proxy *) gtk_primary_selection_offer,
405 				     (void (**)(void)) listener, data);
406 }
407 
408 #define GTK_PRIMARY_SELECTION_OFFER_RECEIVE 0
409 #define GTK_PRIMARY_SELECTION_OFFER_DESTROY 1
410 
411 /**
412  * @ingroup iface_gtk_primary_selection_offer
413  */
414 #define GTK_PRIMARY_SELECTION_OFFER_OFFER_SINCE_VERSION 1
415 
416 /**
417  * @ingroup iface_gtk_primary_selection_offer
418  */
419 #define GTK_PRIMARY_SELECTION_OFFER_RECEIVE_SINCE_VERSION 1
420 /**
421  * @ingroup iface_gtk_primary_selection_offer
422  */
423 #define GTK_PRIMARY_SELECTION_OFFER_DESTROY_SINCE_VERSION 1
424 
425 /** @ingroup iface_gtk_primary_selection_offer */
426 static inline void
gtk_primary_selection_offer_set_user_data(struct gtk_primary_selection_offer * gtk_primary_selection_offer,void * user_data)427 gtk_primary_selection_offer_set_user_data(struct gtk_primary_selection_offer *gtk_primary_selection_offer, void *user_data)
428 {
429 	wl_proxy_set_user_data((struct wl_proxy *) gtk_primary_selection_offer, user_data);
430 }
431 
432 /** @ingroup iface_gtk_primary_selection_offer */
433 static inline void *
gtk_primary_selection_offer_get_user_data(struct gtk_primary_selection_offer * gtk_primary_selection_offer)434 gtk_primary_selection_offer_get_user_data(struct gtk_primary_selection_offer *gtk_primary_selection_offer)
435 {
436 	return wl_proxy_get_user_data((struct wl_proxy *) gtk_primary_selection_offer);
437 }
438 
439 static inline uint32_t
gtk_primary_selection_offer_get_version(struct gtk_primary_selection_offer * gtk_primary_selection_offer)440 gtk_primary_selection_offer_get_version(struct gtk_primary_selection_offer *gtk_primary_selection_offer)
441 {
442 	return wl_proxy_get_version((struct wl_proxy *) gtk_primary_selection_offer);
443 }
444 
445 /**
446  * @ingroup iface_gtk_primary_selection_offer
447  *
448  * To transfer the contents of the primary selection clipboard, the client
449  * issues this request and indicates the mime type that it wants to
450  * receive. The transfer happens through the passed file descriptor
451  * (typically created with the pipe system call). The source client writes
452  * the data in the mime type representation requested and then closes the
453  * file descriptor.
454  *
455  * The receiving client reads from the read end of the pipe until EOF and
456  * closes its end, at which point the transfer is complete.
457  */
458 static inline void
gtk_primary_selection_offer_receive(struct gtk_primary_selection_offer * gtk_primary_selection_offer,const char * mime_type,int32_t fd)459 gtk_primary_selection_offer_receive(struct gtk_primary_selection_offer *gtk_primary_selection_offer, const char *mime_type, int32_t fd)
460 {
461 	wl_proxy_marshal_flags((struct wl_proxy *) gtk_primary_selection_offer,
462 			 GTK_PRIMARY_SELECTION_OFFER_RECEIVE, NULL, wl_proxy_get_version((struct wl_proxy *) gtk_primary_selection_offer), 0, mime_type, fd);
463 }
464 
465 /**
466  * @ingroup iface_gtk_primary_selection_offer
467  *
468  * Destroy the primary selection offer.
469  */
470 static inline void
gtk_primary_selection_offer_destroy(struct gtk_primary_selection_offer * gtk_primary_selection_offer)471 gtk_primary_selection_offer_destroy(struct gtk_primary_selection_offer *gtk_primary_selection_offer)
472 {
473 	wl_proxy_marshal_flags((struct wl_proxy *) gtk_primary_selection_offer,
474 			 GTK_PRIMARY_SELECTION_OFFER_DESTROY, NULL, wl_proxy_get_version((struct wl_proxy *) gtk_primary_selection_offer), WL_MARSHAL_FLAG_DESTROY);
475 }
476 
477 /**
478  * @ingroup iface_gtk_primary_selection_source
479  * @struct gtk_primary_selection_source_listener
480  */
481 struct gtk_primary_selection_source_listener {
482 	/**
483 	 * send the primary selection contents
484 	 *
485 	 * Request for the current primary selection contents from the
486 	 * client. Send the specified mime type over the passed file
487 	 * descriptor, then close it.
488 	 */
489 	void (*send)(void *data,
490 		     struct gtk_primary_selection_source *gtk_primary_selection_source,
491 		     const char *mime_type,
492 		     int32_t fd);
493 	/**
494 	 * request for primary selection contents was canceled
495 	 *
496 	 * This primary selection source is no longer valid. The client
497 	 * should clean up and destroy this primary selection source.
498 	 */
499 	void (*cancelled)(void *data,
500 			  struct gtk_primary_selection_source *gtk_primary_selection_source);
501 };
502 
503 /**
504  * @ingroup iface_gtk_primary_selection_source
505  */
506 static inline int
gtk_primary_selection_source_add_listener(struct gtk_primary_selection_source * gtk_primary_selection_source,const struct gtk_primary_selection_source_listener * listener,void * data)507 gtk_primary_selection_source_add_listener(struct gtk_primary_selection_source *gtk_primary_selection_source,
508 					  const struct gtk_primary_selection_source_listener *listener, void *data)
509 {
510 	return wl_proxy_add_listener((struct wl_proxy *) gtk_primary_selection_source,
511 				     (void (**)(void)) listener, data);
512 }
513 
514 #define GTK_PRIMARY_SELECTION_SOURCE_OFFER 0
515 #define GTK_PRIMARY_SELECTION_SOURCE_DESTROY 1
516 
517 /**
518  * @ingroup iface_gtk_primary_selection_source
519  */
520 #define GTK_PRIMARY_SELECTION_SOURCE_SEND_SINCE_VERSION 1
521 /**
522  * @ingroup iface_gtk_primary_selection_source
523  */
524 #define GTK_PRIMARY_SELECTION_SOURCE_CANCELLED_SINCE_VERSION 1
525 
526 /**
527  * @ingroup iface_gtk_primary_selection_source
528  */
529 #define GTK_PRIMARY_SELECTION_SOURCE_OFFER_SINCE_VERSION 1
530 /**
531  * @ingroup iface_gtk_primary_selection_source
532  */
533 #define GTK_PRIMARY_SELECTION_SOURCE_DESTROY_SINCE_VERSION 1
534 
535 /** @ingroup iface_gtk_primary_selection_source */
536 static inline void
gtk_primary_selection_source_set_user_data(struct gtk_primary_selection_source * gtk_primary_selection_source,void * user_data)537 gtk_primary_selection_source_set_user_data(struct gtk_primary_selection_source *gtk_primary_selection_source, void *user_data)
538 {
539 	wl_proxy_set_user_data((struct wl_proxy *) gtk_primary_selection_source, user_data);
540 }
541 
542 /** @ingroup iface_gtk_primary_selection_source */
543 static inline void *
gtk_primary_selection_source_get_user_data(struct gtk_primary_selection_source * gtk_primary_selection_source)544 gtk_primary_selection_source_get_user_data(struct gtk_primary_selection_source *gtk_primary_selection_source)
545 {
546 	return wl_proxy_get_user_data((struct wl_proxy *) gtk_primary_selection_source);
547 }
548 
549 static inline uint32_t
gtk_primary_selection_source_get_version(struct gtk_primary_selection_source * gtk_primary_selection_source)550 gtk_primary_selection_source_get_version(struct gtk_primary_selection_source *gtk_primary_selection_source)
551 {
552 	return wl_proxy_get_version((struct wl_proxy *) gtk_primary_selection_source);
553 }
554 
555 /**
556  * @ingroup iface_gtk_primary_selection_source
557  *
558  * This request adds a mime type to the set of mime types advertised to
559  * targets. Can be called several times to offer multiple types.
560  */
561 static inline void
gtk_primary_selection_source_offer(struct gtk_primary_selection_source * gtk_primary_selection_source,const char * mime_type)562 gtk_primary_selection_source_offer(struct gtk_primary_selection_source *gtk_primary_selection_source, const char *mime_type)
563 {
564 	wl_proxy_marshal_flags((struct wl_proxy *) gtk_primary_selection_source,
565 			 GTK_PRIMARY_SELECTION_SOURCE_OFFER, NULL, wl_proxy_get_version((struct wl_proxy *) gtk_primary_selection_source), 0, mime_type);
566 }
567 
568 /**
569  * @ingroup iface_gtk_primary_selection_source
570  *
571  * Destroy the primary selection source.
572  */
573 static inline void
gtk_primary_selection_source_destroy(struct gtk_primary_selection_source * gtk_primary_selection_source)574 gtk_primary_selection_source_destroy(struct gtk_primary_selection_source *gtk_primary_selection_source)
575 {
576 	wl_proxy_marshal_flags((struct wl_proxy *) gtk_primary_selection_source,
577 			 GTK_PRIMARY_SELECTION_SOURCE_DESTROY, NULL, wl_proxy_get_version((struct wl_proxy *) gtk_primary_selection_source), WL_MARSHAL_FLAG_DESTROY);
578 }
579 
580 #ifdef  __cplusplus
581 }
582 #endif
583 
584 #endif
585