AtlatestRepositorysigil-ui

sigil-ui / tree / native / waylandxdg-activation-v1-client-protocol.h

1/* Generated by wayland-scanner 1.24.0 */
2
3#ifndef XDG_ACTIVATION_V1_CLIENT_PROTOCOL_H
4#define XDG_ACTIVATION_V1_CLIENT_PROTOCOL_H
5
6#include <stdint.h>
7#include <stddef.h>
8#include "wayland-client.h"
9
10#ifdef __cplusplus
11extern "C" {
12#endif
14/**
15 * @page page_xdg_activation_v1 The xdg_activation_v1 protocol
16 * Protocol for requesting activation of surfaces
17 *
18 * @section page_desc_xdg_activation_v1 Description
19 *
20 * The way for a client to pass focus to another toplevel is as follows.
21 *
22 * The client that intends to activate another toplevel uses the
23 * xdg_activation_v1.get_activation_token request to get an activation token.
24 * This token is then forwarded to the client, which is supposed to activate
25 * one of its surfaces, through a separate band of communication.
26 *
27 * One established way of doing this is through the XDG_ACTIVATION_TOKEN
28 * environment variable of a newly launched child process. The child process
29 * should unset the environment variable again right after reading it out in
30 * order to avoid propagating it to other child processes.
31 *
32 * Another established way exists for Applications implementing the D-Bus
33 * interface org.freedesktop.Application, which should get their token under
34 * activation-token on their platform_data.
35 *
36 * In general activation tokens may be transferred across clients through
37 * means not described in this protocol.
38 *
39 * The client to be activated will then pass the token
40 * it received to the xdg_activation_v1.activate request. The compositor can
41 * then use this token to decide how to react to the activation request.
42 *
43 * The token the activating client gets may be ineffective either already at
44 * the time it receives it, for example if it was not focused, for focus
45 * stealing prevention. The activating client will have no way to discover
46 * the validity of the token, and may still forward it to the to be activated
47 * client.
48 *
49 * The created activation token may optionally get information attached to it
50 * that can be used by the compositor to identify the application that we
51 * intend to activate. This can for example be used to display a visual hint
52 * about what application is being started.
53 *
54 * Warning! The protocol described in this file is currently in the testing
55 * phase. Backward compatible changes may be added together with the
56 * corresponding interface version bump. Backward incompatible changes can
57 * only be done by creating a new major version of the extension.
58 *
59 * @section page_ifaces_xdg_activation_v1 Interfaces
60 * - @subpage page_iface_xdg_activation_v1 - interface for activating surfaces
61 * - @subpage page_iface_xdg_activation_token_v1 - an exported activation handle
62 * @section page_copyright_xdg_activation_v1 Copyright
63 * <pre>
64 *
65 * Copyright © 2020 Aleix Pol Gonzalez <aleixpol@kde.org>
66 * Copyright © 2020 Carlos Garnacho <carlosg@gnome.org>
67 *
68 * Permission is hereby granted, free of charge, to any person obtaining a
69 * copy of this software and associated documentation files (the "Software"),
70 * to deal in the Software without restriction, including without limitation
71 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
72 * and/or sell copies of the Software, and to permit persons to whom the
73 * Software is furnished to do so, subject to the following conditions:
74 *
75 * The above copyright notice and this permission notice (including the next
76 * paragraph) shall be included in all copies or substantial portions of the
77 * Software.
78 *
79 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
80 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
81 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
82 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
83 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
84 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
85 * DEALINGS IN THE SOFTWARE.
86 * </pre>
87 */
88struct wl_seat;
89struct wl_surface;
90struct xdg_activation_token_v1;
91struct xdg_activation_v1;
93#ifndef XDG_ACTIVATION_V1_INTERFACE
94#define XDG_ACTIVATION_V1_INTERFACE
95/**
96 * @page page_iface_xdg_activation_v1 xdg_activation_v1
97 * @section page_iface_xdg_activation_v1_desc Description
98 *
99 * A global interface used for informing the compositor about applications
100 * being activated or started, or for applications to request to be
101 * activated.
102 * @section page_iface_xdg_activation_v1_api API
103 * See @ref iface_xdg_activation_v1.
104 */
105/**
106 * @defgroup iface_xdg_activation_v1 The xdg_activation_v1 interface
107 *
108 * A global interface used for informing the compositor about applications
109 * being activated or started, or for applications to request to be
110 * activated.
111 */
112extern const struct wl_interface xdg_activation_v1_interface;
113#endif
114#ifndef XDG_ACTIVATION_TOKEN_V1_INTERFACE
115#define XDG_ACTIVATION_TOKEN_V1_INTERFACE
116/**
117 * @page page_iface_xdg_activation_token_v1 xdg_activation_token_v1
118 * @section page_iface_xdg_activation_token_v1_desc Description
119 *
120 * An object for setting up a token and receiving a token handle that can
121 * be passed as an activation token to another client.
122 *
123 * The object is created using the xdg_activation_v1.get_activation_token
124 * request. This object should then be populated with the app_id, surface
125 * and serial information and committed. The compositor shall then issue a
126 * done event with the token. In case the request's parameters are invalid,
127 * the compositor will provide an invalid token.
128 * @section page_iface_xdg_activation_token_v1_api API
129 * See @ref iface_xdg_activation_token_v1.
130 */
131/**
132 * @defgroup iface_xdg_activation_token_v1 The xdg_activation_token_v1 interface
133 *
134 * An object for setting up a token and receiving a token handle that can
135 * be passed as an activation token to another client.
136 *
137 * The object is created using the xdg_activation_v1.get_activation_token
138 * request. This object should then be populated with the app_id, surface
139 * and serial information and committed. The compositor shall then issue a
140 * done event with the token. In case the request's parameters are invalid,
141 * the compositor will provide an invalid token.
142 */
143extern const struct wl_interface xdg_activation_token_v1_interface;
144#endif
146#define XDG_ACTIVATION_V1_DESTROY 0
147#define XDG_ACTIVATION_V1_GET_ACTIVATION_TOKEN 1
148#define XDG_ACTIVATION_V1_ACTIVATE 2
151/**
152 * @ingroup iface_xdg_activation_v1
153 */
154#define XDG_ACTIVATION_V1_DESTROY_SINCE_VERSION 1
155/**
156 * @ingroup iface_xdg_activation_v1
157 */
158#define XDG_ACTIVATION_V1_GET_ACTIVATION_TOKEN_SINCE_VERSION 1
159/**
160 * @ingroup iface_xdg_activation_v1
161 */
162#define XDG_ACTIVATION_V1_ACTIVATE_SINCE_VERSION 1
164/** @ingroup iface_xdg_activation_v1 */
165static inline void
166xdg_activation_v1_set_user_data(struct xdg_activation_v1 *xdg_activation_v1, void *user_data)
168 wl_proxy_set_user_data((struct wl_proxy *) xdg_activation_v1, user_data);
171/** @ingroup iface_xdg_activation_v1 */
172static inline void *
173xdg_activation_v1_get_user_data(struct xdg_activation_v1 *xdg_activation_v1)
175 return wl_proxy_get_user_data((struct wl_proxy *) xdg_activation_v1);
178static inline uint32_t
179xdg_activation_v1_get_version(struct xdg_activation_v1 *xdg_activation_v1)
181 return wl_proxy_get_version((struct wl_proxy *) xdg_activation_v1);
184/**
185 * @ingroup iface_xdg_activation_v1
186 *
187 * Notify the compositor that the xdg_activation object will no longer be
188 * used.
189 *
190 * The child objects created via this interface are unaffected and should
191 * be destroyed separately.
192 */
193static inline void
194xdg_activation_v1_destroy(struct xdg_activation_v1 *xdg_activation_v1)
196 wl_proxy_marshal_flags((struct wl_proxy *) xdg_activation_v1,
197 XDG_ACTIVATION_V1_DESTROY, NULL, wl_proxy_get_version((struct wl_proxy *) xdg_activation_v1), WL_MARSHAL_FLAG_DESTROY);
200/**
201 * @ingroup iface_xdg_activation_v1
202 *
203 * Creates an xdg_activation_token_v1 object that will provide
204 * the initiating client with a unique token for this activation. This
205 * token should be offered to the clients to be activated.
206 */
207static inline struct xdg_activation_token_v1 *
208xdg_activation_v1_get_activation_token(struct xdg_activation_v1 *xdg_activation_v1)
210 struct wl_proxy *id;
212 id = wl_proxy_marshal_flags((struct wl_proxy *) xdg_activation_v1,
213 XDG_ACTIVATION_V1_GET_ACTIVATION_TOKEN, &xdg_activation_token_v1_interface, wl_proxy_get_version((struct wl_proxy *) xdg_activation_v1), 0, NULL);
215 return (struct xdg_activation_token_v1 *) id;
218/**
219 * @ingroup iface_xdg_activation_v1
220 *
221 * Requests surface activation. It's up to the compositor to display
222 * this information as desired, for example by placing the surface above
223 * the rest.
224 *
225 * The compositor may know who requested this by checking the activation
226 * token and might decide not to follow through with the activation if it's
227 * considered unwanted.
228 *
229 * Compositors can ignore unknown activation tokens when an invalid
230 * token is passed.
231 */
232static inline void
233xdg_activation_v1_activate(struct xdg_activation_v1 *xdg_activation_v1, const char *token, struct wl_surface *surface)
235 wl_proxy_marshal_flags((struct wl_proxy *) xdg_activation_v1,
236 XDG_ACTIVATION_V1_ACTIVATE, NULL, wl_proxy_get_version((struct wl_proxy *) xdg_activation_v1), 0, token, surface);
239#ifndef XDG_ACTIVATION_TOKEN_V1_ERROR_ENUM
240#define XDG_ACTIVATION_TOKEN_V1_ERROR_ENUM
241enum xdg_activation_token_v1_error {
242 /**
243 * The token has already been used previously
244 */
245 XDG_ACTIVATION_TOKEN_V1_ERROR_ALREADY_USED = 0,
246};
247#endif /* XDG_ACTIVATION_TOKEN_V1_ERROR_ENUM */
249/**
250 * @ingroup iface_xdg_activation_token_v1
251 * @struct xdg_activation_token_v1_listener
252 */
253struct xdg_activation_token_v1_listener {
254 /**
255 * the exported activation token
256 *
257 * The 'done' event contains the unique token of this activation
258 * request and notifies that the provider is done.
259 * @param token the exported activation token
260 */
261 void (*done)(void *data,
262 struct xdg_activation_token_v1 *xdg_activation_token_v1,
263 const char *token);
264};
266/**
267 * @ingroup iface_xdg_activation_token_v1
268 */
269static inline int
270xdg_activation_token_v1_add_listener(struct xdg_activation_token_v1 *xdg_activation_token_v1,
271 const struct xdg_activation_token_v1_listener *listener, void *data)
273 return wl_proxy_add_listener((struct wl_proxy *) xdg_activation_token_v1,
274 (void (**)(void)) listener, data);
277#define XDG_ACTIVATION_TOKEN_V1_SET_SERIAL 0
278#define XDG_ACTIVATION_TOKEN_V1_SET_APP_ID 1
279#define XDG_ACTIVATION_TOKEN_V1_SET_SURFACE 2
280#define XDG_ACTIVATION_TOKEN_V1_COMMIT 3
281#define XDG_ACTIVATION_TOKEN_V1_DESTROY 4
283/**
284 * @ingroup iface_xdg_activation_token_v1
285 */
286#define XDG_ACTIVATION_TOKEN_V1_DONE_SINCE_VERSION 1
288/**
289 * @ingroup iface_xdg_activation_token_v1
290 */
291#define XDG_ACTIVATION_TOKEN_V1_SET_SERIAL_SINCE_VERSION 1
292/**
293 * @ingroup iface_xdg_activation_token_v1
294 */
295#define XDG_ACTIVATION_TOKEN_V1_SET_APP_ID_SINCE_VERSION 1
296/**
297 * @ingroup iface_xdg_activation_token_v1
298 */
299#define XDG_ACTIVATION_TOKEN_V1_SET_SURFACE_SINCE_VERSION 1
300/**
301 * @ingroup iface_xdg_activation_token_v1
302 */
303#define XDG_ACTIVATION_TOKEN_V1_COMMIT_SINCE_VERSION 1
304/**
305 * @ingroup iface_xdg_activation_token_v1
306 */
307#define XDG_ACTIVATION_TOKEN_V1_DESTROY_SINCE_VERSION 1
309/** @ingroup iface_xdg_activation_token_v1 */
310static inline void
311xdg_activation_token_v1_set_user_data(struct xdg_activation_token_v1 *xdg_activation_token_v1, void *user_data)
313 wl_proxy_set_user_data((struct wl_proxy *) xdg_activation_token_v1, user_data);
316/** @ingroup iface_xdg_activation_token_v1 */
317static inline void *
318xdg_activation_token_v1_get_user_data(struct xdg_activation_token_v1 *xdg_activation_token_v1)
320 return wl_proxy_get_user_data((struct wl_proxy *) xdg_activation_token_v1);
323static inline uint32_t
324xdg_activation_token_v1_get_version(struct xdg_activation_token_v1 *xdg_activation_token_v1)
326 return wl_proxy_get_version((struct wl_proxy *) xdg_activation_token_v1);
329/**
330 * @ingroup iface_xdg_activation_token_v1
331 *
332 * Provides information about the seat and serial event that requested the
333 * token.
334 *
335 * The serial can come from an input or focus event. For instance, if a
336 * click triggers the launch of a third-party client, the launcher client
337 * should send a set_serial request with the serial and seat from the
338 * wl_pointer.button event.
339 *
340 * Some compositors might refuse to activate toplevels when the token
341 * doesn't have a valid and recent enough event serial.
342 *
343 * Must be sent before commit. This information is optional.
344 */
345static inline void
346xdg_activation_token_v1_set_serial(struct xdg_activation_token_v1 *xdg_activation_token_v1, uint32_t serial, struct wl_seat *seat)
348 wl_proxy_marshal_flags((struct wl_proxy *) xdg_activation_token_v1,
349 XDG_ACTIVATION_TOKEN_V1_SET_SERIAL, NULL, wl_proxy_get_version((struct wl_proxy *) xdg_activation_token_v1), 0, serial, seat);
352/**
353 * @ingroup iface_xdg_activation_token_v1
354 *
355 * The requesting client can specify an app_id to associate the token
356 * being created with it.
357 *
358 * Must be sent before commit. This information is optional.
359 */
360static inline void
361xdg_activation_token_v1_set_app_id(struct xdg_activation_token_v1 *xdg_activation_token_v1, const char *app_id)
363 wl_proxy_marshal_flags((struct wl_proxy *) xdg_activation_token_v1,
364 XDG_ACTIVATION_TOKEN_V1_SET_APP_ID, NULL, wl_proxy_get_version((struct wl_proxy *) xdg_activation_token_v1), 0, app_id);
367/**
368 * @ingroup iface_xdg_activation_token_v1
369 *
370 * This request sets the surface requesting the activation. Note, this is
371 * different from the surface that will be activated.
372 *
373 * Some compositors might refuse to activate toplevels when the token
374 * doesn't have a requesting surface.
375 *
376 * Must be sent before commit. This information is optional.
377 */
378static inline void
379xdg_activation_token_v1_set_surface(struct xdg_activation_token_v1 *xdg_activation_token_v1, struct wl_surface *surface)
381 wl_proxy_marshal_flags((struct wl_proxy *) xdg_activation_token_v1,
382 XDG_ACTIVATION_TOKEN_V1_SET_SURFACE, NULL, wl_proxy_get_version((struct wl_proxy *) xdg_activation_token_v1), 0, surface);
385/**
386 * @ingroup iface_xdg_activation_token_v1
387 *
388 * Requests an activation token based on the different parameters that
389 * have been offered through set_serial, set_surface and set_app_id.
390 */
391static inline void
392xdg_activation_token_v1_commit(struct xdg_activation_token_v1 *xdg_activation_token_v1)
394 wl_proxy_marshal_flags((struct wl_proxy *) xdg_activation_token_v1,
395 XDG_ACTIVATION_TOKEN_V1_COMMIT, NULL, wl_proxy_get_version((struct wl_proxy *) xdg_activation_token_v1), 0);
398/**
399 * @ingroup iface_xdg_activation_token_v1
400 *
401 * Notify the compositor that the xdg_activation_token_v1 object will no
402 * longer be used. The received token stays valid.
403 */
404static inline void
405xdg_activation_token_v1_destroy(struct xdg_activation_token_v1 *xdg_activation_token_v1)
407 wl_proxy_marshal_flags((struct wl_proxy *) xdg_activation_token_v1,
408 XDG_ACTIVATION_TOKEN_V1_DESTROY, NULL, wl_proxy_get_version((struct wl_proxy *) xdg_activation_token_v1), WL_MARSHAL_FLAG_DESTROY);
411#ifdef __cplusplus
413#endif
415#endif