1 /* Generated by wayland-scanner 1.22.0 */
2
3 #ifndef XDG_FOREIGN_UNSTABLE_V1_CLIENT_PROTOCOL_H
4 #define XDG_FOREIGN_UNSTABLE_V1_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_xdg_foreign_unstable_v1 The xdg_foreign_unstable_v1 protocol
16 * Protocol for exporting xdg surface handles
17 *
18 * @section page_desc_xdg_foreign_unstable_v1 Description
19 *
20 * This protocol specifies a way for making it possible to reference a surface
21 * of a different client. With such a reference, a client can, by using the
22 * interfaces provided by this protocol, manipulate the relationship between
23 * its own surfaces and the surface of some other client. For example, stack
24 * some of its own surface above the other clients surface.
25 *
26 * In order for a client A to get a reference of a surface of client B, client
27 * B must first export its surface using xdg_exporter.export. Upon doing this,
28 * client B will receive a handle (a unique string) that it may share with
29 * client A in some way (for example D-Bus). After client A has received the
30 * handle from client B, it may use xdg_importer.import to create a reference
31 * to the surface client B just exported. See the corresponding requests for
32 * details.
33 *
34 * A possible use case for this is out-of-process dialogs. For example when a
35 * sandboxed client without file system access needs the user to select a file
36 * on the file system, given sandbox environment support, it can export its
37 * surface, passing the exported surface handle to an unsandboxed process that
38 * can show a file browser dialog and stack it above the sandboxed client's
39 * surface.
40 *
41 * Warning! The protocol described in this file is experimental and backward
42 * incompatible changes may be made. Backward compatible changes may be added
43 * together with the corresponding interface version bump. Backward
44 * incompatible changes are done by bumping the version number in the protocol
45 * and interface names and resetting the interface version. Once the protocol
46 * is to be declared stable, the 'z' prefix and the version number in the
47 * protocol and interface names are removed and the interface version number is
48 * reset.
49 *
50 * @section page_ifaces_xdg_foreign_unstable_v1 Interfaces
51 * - @subpage page_iface_zxdg_exporter_v1 - interface for exporting surfaces
52 * - @subpage page_iface_zxdg_importer_v1 - interface for importing surfaces
53 * - @subpage page_iface_zxdg_exported_v1 - an exported surface handle
54 * - @subpage page_iface_zxdg_imported_v1 - an imported surface handle
55 * @section page_copyright_xdg_foreign_unstable_v1 Copyright
56 * <pre>
57 *
58 * Copyright © 2015-2016 Red Hat Inc.
59 *
60 * Permission is hereby granted, free of charge, to any person obtaining a
61 * copy of this software and associated documentation files (the "Software"),
62 * to deal in the Software without restriction, including without limitation
63 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
64 * and/or sell copies of the Software, and to permit persons to whom the
65 * Software is furnished to do so, subject to the following conditions:
66 *
67 * The above copyright notice and this permission notice (including the next
68 * paragraph) shall be included in all copies or substantial portions of the
69 * Software.
70 *
71 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
72 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
73 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
74 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
75 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
76 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
77 * DEALINGS IN THE SOFTWARE.
78 * </pre>
79 */
80 struct wl_surface;
81 struct zxdg_exported_v1;
82 struct zxdg_exporter_v1;
83 struct zxdg_imported_v1;
84 struct zxdg_importer_v1;
85
86 #ifndef ZXDG_EXPORTER_V1_INTERFACE
87 #define ZXDG_EXPORTER_V1_INTERFACE
88 /**
89 * @page page_iface_zxdg_exporter_v1 zxdg_exporter_v1
90 * @section page_iface_zxdg_exporter_v1_desc Description
91 *
92 * A global interface used for exporting surfaces that can later be imported
93 * using xdg_importer.
94 * @section page_iface_zxdg_exporter_v1_api API
95 * See @ref iface_zxdg_exporter_v1.
96 */
97 /**
98 * @defgroup iface_zxdg_exporter_v1 The zxdg_exporter_v1 interface
99 *
100 * A global interface used for exporting surfaces that can later be imported
101 * using xdg_importer.
102 */
103 extern const struct wl_interface zxdg_exporter_v1_interface;
104 #endif
105 #ifndef ZXDG_IMPORTER_V1_INTERFACE
106 #define ZXDG_IMPORTER_V1_INTERFACE
107 /**
108 * @page page_iface_zxdg_importer_v1 zxdg_importer_v1
109 * @section page_iface_zxdg_importer_v1_desc Description
110 *
111 * A global interface used for importing surfaces exported by xdg_exporter.
112 * With this interface, a client can create a reference to a surface of
113 * another client.
114 * @section page_iface_zxdg_importer_v1_api API
115 * See @ref iface_zxdg_importer_v1.
116 */
117 /**
118 * @defgroup iface_zxdg_importer_v1 The zxdg_importer_v1 interface
119 *
120 * A global interface used for importing surfaces exported by xdg_exporter.
121 * With this interface, a client can create a reference to a surface of
122 * another client.
123 */
124 extern const struct wl_interface zxdg_importer_v1_interface;
125 #endif
126 #ifndef ZXDG_EXPORTED_V1_INTERFACE
127 #define ZXDG_EXPORTED_V1_INTERFACE
128 /**
129 * @page page_iface_zxdg_exported_v1 zxdg_exported_v1
130 * @section page_iface_zxdg_exported_v1_desc Description
131 *
132 * An xdg_exported object represents an exported reference to a surface. The
133 * exported surface may be referenced as long as the xdg_exported object not
134 * destroyed. Destroying the xdg_exported invalidates any relationship the
135 * importer may have established using xdg_imported.
136 * @section page_iface_zxdg_exported_v1_api API
137 * See @ref iface_zxdg_exported_v1.
138 */
139 /**
140 * @defgroup iface_zxdg_exported_v1 The zxdg_exported_v1 interface
141 *
142 * An xdg_exported object represents an exported reference to a surface. The
143 * exported surface may be referenced as long as the xdg_exported object not
144 * destroyed. Destroying the xdg_exported invalidates any relationship the
145 * importer may have established using xdg_imported.
146 */
147 extern const struct wl_interface zxdg_exported_v1_interface;
148 #endif
149 #ifndef ZXDG_IMPORTED_V1_INTERFACE
150 #define ZXDG_IMPORTED_V1_INTERFACE
151 /**
152 * @page page_iface_zxdg_imported_v1 zxdg_imported_v1
153 * @section page_iface_zxdg_imported_v1_desc Description
154 *
155 * An xdg_imported object represents an imported reference to surface exported
156 * by some client. A client can use this interface to manipulate
157 * relationships between its own surfaces and the imported surface.
158 * @section page_iface_zxdg_imported_v1_api API
159 * See @ref iface_zxdg_imported_v1.
160 */
161 /**
162 * @defgroup iface_zxdg_imported_v1 The zxdg_imported_v1 interface
163 *
164 * An xdg_imported object represents an imported reference to surface exported
165 * by some client. A client can use this interface to manipulate
166 * relationships between its own surfaces and the imported surface.
167 */
168 extern const struct wl_interface zxdg_imported_v1_interface;
169 #endif
170
171 #define ZXDG_EXPORTER_V1_DESTROY 0
172 #define ZXDG_EXPORTER_V1_EXPORT 1
173
174
175 /**
176 * @ingroup iface_zxdg_exporter_v1
177 */
178 #define ZXDG_EXPORTER_V1_DESTROY_SINCE_VERSION 1
179 /**
180 * @ingroup iface_zxdg_exporter_v1
181 */
182 #define ZXDG_EXPORTER_V1_EXPORT_SINCE_VERSION 1
183
184 /** @ingroup iface_zxdg_exporter_v1 */
185 static inline void
zxdg_exporter_v1_set_user_data(struct zxdg_exporter_v1 * zxdg_exporter_v1,void * user_data)186 zxdg_exporter_v1_set_user_data(struct zxdg_exporter_v1 *zxdg_exporter_v1, void *user_data)
187 {
188 wl_proxy_set_user_data((struct wl_proxy *) zxdg_exporter_v1, user_data);
189 }
190
191 /** @ingroup iface_zxdg_exporter_v1 */
192 static inline void *
zxdg_exporter_v1_get_user_data(struct zxdg_exporter_v1 * zxdg_exporter_v1)193 zxdg_exporter_v1_get_user_data(struct zxdg_exporter_v1 *zxdg_exporter_v1)
194 {
195 return wl_proxy_get_user_data((struct wl_proxy *) zxdg_exporter_v1);
196 }
197
198 static inline uint32_t
zxdg_exporter_v1_get_version(struct zxdg_exporter_v1 * zxdg_exporter_v1)199 zxdg_exporter_v1_get_version(struct zxdg_exporter_v1 *zxdg_exporter_v1)
200 {
201 return wl_proxy_get_version((struct wl_proxy *) zxdg_exporter_v1);
202 }
203
204 /**
205 * @ingroup iface_zxdg_exporter_v1
206 *
207 * Notify the compositor that the xdg_exporter object will no longer be
208 * used.
209 */
210 static inline void
zxdg_exporter_v1_destroy(struct zxdg_exporter_v1 * zxdg_exporter_v1)211 zxdg_exporter_v1_destroy(struct zxdg_exporter_v1 *zxdg_exporter_v1)
212 {
213 wl_proxy_marshal_flags((struct wl_proxy *) zxdg_exporter_v1,
214 ZXDG_EXPORTER_V1_DESTROY, NULL, wl_proxy_get_version((struct wl_proxy *) zxdg_exporter_v1), WL_MARSHAL_FLAG_DESTROY);
215 }
216
217 /**
218 * @ingroup iface_zxdg_exporter_v1
219 *
220 * The export request exports the passed surface so that it can later be
221 * imported via xdg_importer. When called, a new xdg_exported object will
222 * be created and xdg_exported.handle will be sent immediately. See the
223 * corresponding interface and event for details.
224 *
225 * A surface may be exported multiple times, and each exported handle may
226 * be used to create an xdg_imported multiple times. Only xdg_surface
227 * surfaces may be exported.
228 */
229 static inline struct zxdg_exported_v1 *
zxdg_exporter_v1_export(struct zxdg_exporter_v1 * zxdg_exporter_v1,struct wl_surface * surface)230 zxdg_exporter_v1_export(struct zxdg_exporter_v1 *zxdg_exporter_v1, struct wl_surface *surface)
231 {
232 struct wl_proxy *id;
233
234 id = wl_proxy_marshal_flags((struct wl_proxy *) zxdg_exporter_v1,
235 ZXDG_EXPORTER_V1_EXPORT, &zxdg_exported_v1_interface, wl_proxy_get_version((struct wl_proxy *) zxdg_exporter_v1), 0, NULL, surface);
236
237 return (struct zxdg_exported_v1 *) id;
238 }
239
240 #define ZXDG_IMPORTER_V1_DESTROY 0
241 #define ZXDG_IMPORTER_V1_IMPORT 1
242
243
244 /**
245 * @ingroup iface_zxdg_importer_v1
246 */
247 #define ZXDG_IMPORTER_V1_DESTROY_SINCE_VERSION 1
248 /**
249 * @ingroup iface_zxdg_importer_v1
250 */
251 #define ZXDG_IMPORTER_V1_IMPORT_SINCE_VERSION 1
252
253 /** @ingroup iface_zxdg_importer_v1 */
254 static inline void
zxdg_importer_v1_set_user_data(struct zxdg_importer_v1 * zxdg_importer_v1,void * user_data)255 zxdg_importer_v1_set_user_data(struct zxdg_importer_v1 *zxdg_importer_v1, void *user_data)
256 {
257 wl_proxy_set_user_data((struct wl_proxy *) zxdg_importer_v1, user_data);
258 }
259
260 /** @ingroup iface_zxdg_importer_v1 */
261 static inline void *
zxdg_importer_v1_get_user_data(struct zxdg_importer_v1 * zxdg_importer_v1)262 zxdg_importer_v1_get_user_data(struct zxdg_importer_v1 *zxdg_importer_v1)
263 {
264 return wl_proxy_get_user_data((struct wl_proxy *) zxdg_importer_v1);
265 }
266
267 static inline uint32_t
zxdg_importer_v1_get_version(struct zxdg_importer_v1 * zxdg_importer_v1)268 zxdg_importer_v1_get_version(struct zxdg_importer_v1 *zxdg_importer_v1)
269 {
270 return wl_proxy_get_version((struct wl_proxy *) zxdg_importer_v1);
271 }
272
273 /**
274 * @ingroup iface_zxdg_importer_v1
275 *
276 * Notify the compositor that the xdg_importer object will no longer be
277 * used.
278 */
279 static inline void
zxdg_importer_v1_destroy(struct zxdg_importer_v1 * zxdg_importer_v1)280 zxdg_importer_v1_destroy(struct zxdg_importer_v1 *zxdg_importer_v1)
281 {
282 wl_proxy_marshal_flags((struct wl_proxy *) zxdg_importer_v1,
283 ZXDG_IMPORTER_V1_DESTROY, NULL, wl_proxy_get_version((struct wl_proxy *) zxdg_importer_v1), WL_MARSHAL_FLAG_DESTROY);
284 }
285
286 /**
287 * @ingroup iface_zxdg_importer_v1
288 *
289 * The import request imports a surface from any client given a handle
290 * retrieved by exporting said surface using xdg_exporter.export. When
291 * called, a new xdg_imported object will be created. This new object
292 * represents the imported surface, and the importing client can
293 * manipulate its relationship using it. See xdg_imported for details.
294 */
295 static inline struct zxdg_imported_v1 *
zxdg_importer_v1_import(struct zxdg_importer_v1 * zxdg_importer_v1,const char * handle)296 zxdg_importer_v1_import(struct zxdg_importer_v1 *zxdg_importer_v1, const char *handle)
297 {
298 struct wl_proxy *id;
299
300 id = wl_proxy_marshal_flags((struct wl_proxy *) zxdg_importer_v1,
301 ZXDG_IMPORTER_V1_IMPORT, &zxdg_imported_v1_interface, wl_proxy_get_version((struct wl_proxy *) zxdg_importer_v1), 0, NULL, handle);
302
303 return (struct zxdg_imported_v1 *) id;
304 }
305
306 /**
307 * @ingroup iface_zxdg_exported_v1
308 * @struct zxdg_exported_v1_listener
309 */
310 struct zxdg_exported_v1_listener {
311 /**
312 * the exported surface handle
313 *
314 * The handle event contains the unique handle of this exported
315 * surface reference. It may be shared with any client, which then
316 * can use it to import the surface by calling xdg_importer.import.
317 * A handle may be used to import the surface multiple times.
318 * @param handle the exported surface handle
319 */
320 void (*handle)(void *data,
321 struct zxdg_exported_v1 *zxdg_exported_v1,
322 const char *handle);
323 };
324
325 /**
326 * @ingroup iface_zxdg_exported_v1
327 */
328 static inline int
zxdg_exported_v1_add_listener(struct zxdg_exported_v1 * zxdg_exported_v1,const struct zxdg_exported_v1_listener * listener,void * data)329 zxdg_exported_v1_add_listener(struct zxdg_exported_v1 *zxdg_exported_v1,
330 const struct zxdg_exported_v1_listener *listener, void *data)
331 {
332 return wl_proxy_add_listener((struct wl_proxy *) zxdg_exported_v1,
333 (void (**)(void)) listener, data);
334 }
335
336 #define ZXDG_EXPORTED_V1_DESTROY 0
337
338 /**
339 * @ingroup iface_zxdg_exported_v1
340 */
341 #define ZXDG_EXPORTED_V1_HANDLE_SINCE_VERSION 1
342
343 /**
344 * @ingroup iface_zxdg_exported_v1
345 */
346 #define ZXDG_EXPORTED_V1_DESTROY_SINCE_VERSION 1
347
348 /** @ingroup iface_zxdg_exported_v1 */
349 static inline void
zxdg_exported_v1_set_user_data(struct zxdg_exported_v1 * zxdg_exported_v1,void * user_data)350 zxdg_exported_v1_set_user_data(struct zxdg_exported_v1 *zxdg_exported_v1, void *user_data)
351 {
352 wl_proxy_set_user_data((struct wl_proxy *) zxdg_exported_v1, user_data);
353 }
354
355 /** @ingroup iface_zxdg_exported_v1 */
356 static inline void *
zxdg_exported_v1_get_user_data(struct zxdg_exported_v1 * zxdg_exported_v1)357 zxdg_exported_v1_get_user_data(struct zxdg_exported_v1 *zxdg_exported_v1)
358 {
359 return wl_proxy_get_user_data((struct wl_proxy *) zxdg_exported_v1);
360 }
361
362 static inline uint32_t
zxdg_exported_v1_get_version(struct zxdg_exported_v1 * zxdg_exported_v1)363 zxdg_exported_v1_get_version(struct zxdg_exported_v1 *zxdg_exported_v1)
364 {
365 return wl_proxy_get_version((struct wl_proxy *) zxdg_exported_v1);
366 }
367
368 /**
369 * @ingroup iface_zxdg_exported_v1
370 *
371 * Revoke the previously exported surface. This invalidates any
372 * relationship the importer may have set up using the xdg_imported created
373 * given the handle sent via xdg_exported.handle.
374 */
375 static inline void
zxdg_exported_v1_destroy(struct zxdg_exported_v1 * zxdg_exported_v1)376 zxdg_exported_v1_destroy(struct zxdg_exported_v1 *zxdg_exported_v1)
377 {
378 wl_proxy_marshal_flags((struct wl_proxy *) zxdg_exported_v1,
379 ZXDG_EXPORTED_V1_DESTROY, NULL, wl_proxy_get_version((struct wl_proxy *) zxdg_exported_v1), WL_MARSHAL_FLAG_DESTROY);
380 }
381
382 /**
383 * @ingroup iface_zxdg_imported_v1
384 * @struct zxdg_imported_v1_listener
385 */
386 struct zxdg_imported_v1_listener {
387 /**
388 * the imported surface handle has been destroyed
389 *
390 * The imported surface handle has been destroyed and any
391 * relationship set up has been invalidated. This may happen for
392 * various reasons, for example if the exported surface or the
393 * exported surface handle has been destroyed, if the handle used
394 * for importing was invalid.
395 */
396 void (*destroyed)(void *data,
397 struct zxdg_imported_v1 *zxdg_imported_v1);
398 };
399
400 /**
401 * @ingroup iface_zxdg_imported_v1
402 */
403 static inline int
zxdg_imported_v1_add_listener(struct zxdg_imported_v1 * zxdg_imported_v1,const struct zxdg_imported_v1_listener * listener,void * data)404 zxdg_imported_v1_add_listener(struct zxdg_imported_v1 *zxdg_imported_v1,
405 const struct zxdg_imported_v1_listener *listener, void *data)
406 {
407 return wl_proxy_add_listener((struct wl_proxy *) zxdg_imported_v1,
408 (void (**)(void)) listener, data);
409 }
410
411 #define ZXDG_IMPORTED_V1_DESTROY 0
412 #define ZXDG_IMPORTED_V1_SET_PARENT_OF 1
413
414 /**
415 * @ingroup iface_zxdg_imported_v1
416 */
417 #define ZXDG_IMPORTED_V1_DESTROYED_SINCE_VERSION 1
418
419 /**
420 * @ingroup iface_zxdg_imported_v1
421 */
422 #define ZXDG_IMPORTED_V1_DESTROY_SINCE_VERSION 1
423 /**
424 * @ingroup iface_zxdg_imported_v1
425 */
426 #define ZXDG_IMPORTED_V1_SET_PARENT_OF_SINCE_VERSION 1
427
428 /** @ingroup iface_zxdg_imported_v1 */
429 static inline void
zxdg_imported_v1_set_user_data(struct zxdg_imported_v1 * zxdg_imported_v1,void * user_data)430 zxdg_imported_v1_set_user_data(struct zxdg_imported_v1 *zxdg_imported_v1, void *user_data)
431 {
432 wl_proxy_set_user_data((struct wl_proxy *) zxdg_imported_v1, user_data);
433 }
434
435 /** @ingroup iface_zxdg_imported_v1 */
436 static inline void *
zxdg_imported_v1_get_user_data(struct zxdg_imported_v1 * zxdg_imported_v1)437 zxdg_imported_v1_get_user_data(struct zxdg_imported_v1 *zxdg_imported_v1)
438 {
439 return wl_proxy_get_user_data((struct wl_proxy *) zxdg_imported_v1);
440 }
441
442 static inline uint32_t
zxdg_imported_v1_get_version(struct zxdg_imported_v1 * zxdg_imported_v1)443 zxdg_imported_v1_get_version(struct zxdg_imported_v1 *zxdg_imported_v1)
444 {
445 return wl_proxy_get_version((struct wl_proxy *) zxdg_imported_v1);
446 }
447
448 /**
449 * @ingroup iface_zxdg_imported_v1
450 *
451 * Notify the compositor that it will no longer use the xdg_imported
452 * object. Any relationship that may have been set up will at this point
453 * be invalidated.
454 */
455 static inline void
zxdg_imported_v1_destroy(struct zxdg_imported_v1 * zxdg_imported_v1)456 zxdg_imported_v1_destroy(struct zxdg_imported_v1 *zxdg_imported_v1)
457 {
458 wl_proxy_marshal_flags((struct wl_proxy *) zxdg_imported_v1,
459 ZXDG_IMPORTED_V1_DESTROY, NULL, wl_proxy_get_version((struct wl_proxy *) zxdg_imported_v1), WL_MARSHAL_FLAG_DESTROY);
460 }
461
462 /**
463 * @ingroup iface_zxdg_imported_v1
464 *
465 * Set the imported surface as the parent of some surface of the client.
466 * The passed surface must be a toplevel xdg_surface. Calling this function
467 * sets up a surface to surface relation with the same stacking and positioning
468 * semantics as xdg_surface.set_parent.
469 */
470 static inline void
zxdg_imported_v1_set_parent_of(struct zxdg_imported_v1 * zxdg_imported_v1,struct wl_surface * surface)471 zxdg_imported_v1_set_parent_of(struct zxdg_imported_v1 *zxdg_imported_v1, struct wl_surface *surface)
472 {
473 wl_proxy_marshal_flags((struct wl_proxy *) zxdg_imported_v1,
474 ZXDG_IMPORTED_V1_SET_PARENT_OF, NULL, wl_proxy_get_version((struct wl_proxy *) zxdg_imported_v1), 0, surface);
475 }
476
477 #ifdef __cplusplus
478 }
479 #endif
480
481 #endif
482