1/* Generated by wayland-scanner 1.16.0 */
2
3#ifndef XDG_DECORATION_UNSTABLE_V1_CLIENT_PROTOCOL_H
4#define XDG_DECORATION_UNSTABLE_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
13
14/**
15 * @page page_xdg_decoration_unstable_v1 The xdg_decoration_unstable_v1 protocol
16 * @section page_ifaces_xdg_decoration_unstable_v1 Interfaces
17 * - @subpage page_iface_zxdg_decoration_manager_v1 - window decoration manager
18 * - @subpage page_iface_zxdg_toplevel_decoration_v1 - decoration object for a toplevel surface
19 * @section page_copyright_xdg_decoration_unstable_v1 Copyright
20 * <pre>
21 *
22 * Copyright © 2018 Simon Ser
23 *
24 * Permission is hereby granted, free of charge, to any person obtaining a
25 * copy of this software and associated documentation files (the "Software"),
26 * to deal in the Software without restriction, including without limitation
27 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
28 * and/or sell copies of the Software, and to permit persons to whom the
29 * Software is furnished to do so, subject to the following conditions:
30 *
31 * The above copyright notice and this permission notice (including the next
32 * paragraph) shall be included in all copies or substantial portions of the
33 * Software.
34 *
35 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
36 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
37 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
38 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
39 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
40 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
41 * DEALINGS IN THE SOFTWARE.
42 * </pre>
43 */
44struct xdg_toplevel;
45struct zxdg_decoration_manager_v1;
46struct zxdg_toplevel_decoration_v1;
47
48/**
49 * @page page_iface_zxdg_decoration_manager_v1 zxdg_decoration_manager_v1
50 * @section page_iface_zxdg_decoration_manager_v1_desc Description
51 *
52 * This interface allows a compositor to announce support for server-side
53 * decorations.
54 *
55 * A window decoration is a set of window controls as deemed appropriate by
56 * the party managing them, such as user interface components used to move,
57 * resize and change a window's state.
58 *
59 * A client can use this protocol to request being decorated by a supporting
60 * compositor.
61 *
62 * If compositor and client do not negotiate the use of a server-side
63 * decoration using this protocol, clients continue to self-decorate as they
64 * see fit.
65 *
66 * Warning! The protocol described in this file is experimental and
67 * backward incompatible changes may be made. Backward compatible changes
68 * may be added together with the corresponding interface version bump.
69 * Backward incompatible changes are done by bumping the version number in
70 * the protocol and interface names and resetting the interface version.
71 * Once the protocol is to be declared stable, the 'z' prefix and the
72 * version number in the protocol and interface names are removed and the
73 * interface version number is reset.
74 * @section page_iface_zxdg_decoration_manager_v1_api API
75 * See @ref iface_zxdg_decoration_manager_v1.
76 */
77/**
78 * @defgroup iface_zxdg_decoration_manager_v1 The zxdg_decoration_manager_v1 interface
79 *
80 * This interface allows a compositor to announce support for server-side
81 * decorations.
82 *
83 * A window decoration is a set of window controls as deemed appropriate by
84 * the party managing them, such as user interface components used to move,
85 * resize and change a window's state.
86 *
87 * A client can use this protocol to request being decorated by a supporting
88 * compositor.
89 *
90 * If compositor and client do not negotiate the use of a server-side
91 * decoration using this protocol, clients continue to self-decorate as they
92 * see fit.
93 *
94 * Warning! The protocol described in this file is experimental and
95 * backward incompatible changes may be made. Backward compatible changes
96 * may be added together with the corresponding interface version bump.
97 * Backward incompatible changes are done by bumping the version number in
98 * the protocol and interface names and resetting the interface version.
99 * Once the protocol is to be declared stable, the 'z' prefix and the
100 * version number in the protocol and interface names are removed and the
101 * interface version number is reset.
102 */
103extern const struct wl_interface zxdg_decoration_manager_v1_interface;
104/**
105 * @page page_iface_zxdg_toplevel_decoration_v1 zxdg_toplevel_decoration_v1
106 * @section page_iface_zxdg_toplevel_decoration_v1_desc Description
107 *
108 * The decoration object allows the compositor to toggle server-side window
109 * decorations for a toplevel surface. The client can request to switch to
110 * another mode.
111 *
112 * The xdg_toplevel_decoration object must be destroyed before its
113 * xdg_toplevel.
114 * @section page_iface_zxdg_toplevel_decoration_v1_api API
115 * See @ref iface_zxdg_toplevel_decoration_v1.
116 */
117/**
118 * @defgroup iface_zxdg_toplevel_decoration_v1 The zxdg_toplevel_decoration_v1 interface
119 *
120 * The decoration object allows the compositor to toggle server-side window
121 * decorations for a toplevel surface. The client can request to switch to
122 * another mode.
123 *
124 * The xdg_toplevel_decoration object must be destroyed before its
125 * xdg_toplevel.
126 */
127extern const struct wl_interface zxdg_toplevel_decoration_v1_interface;
128
129#define ZXDG_DECORATION_MANAGER_V1_DESTROY 0
130#define ZXDG_DECORATION_MANAGER_V1_GET_TOPLEVEL_DECORATION 1
131
132
133/**
134 * @ingroup iface_zxdg_decoration_manager_v1
135 */
136#define ZXDG_DECORATION_MANAGER_V1_DESTROY_SINCE_VERSION 1
137/**
138 * @ingroup iface_zxdg_decoration_manager_v1
139 */
140#define ZXDG_DECORATION_MANAGER_V1_GET_TOPLEVEL_DECORATION_SINCE_VERSION 1
141
142/** @ingroup iface_zxdg_decoration_manager_v1 */
143static inline void
144zxdg_decoration_manager_v1_set_user_data(struct zxdg_decoration_manager_v1 *zxdg_decoration_manager_v1, void *user_data)
145{
146 wl_proxy_set_user_data((struct wl_proxy *) zxdg_decoration_manager_v1, user_data);
147}
148
149/** @ingroup iface_zxdg_decoration_manager_v1 */
150static inline void *
151zxdg_decoration_manager_v1_get_user_data(struct zxdg_decoration_manager_v1 *zxdg_decoration_manager_v1)
152{
153 return wl_proxy_get_user_data((struct wl_proxy *) zxdg_decoration_manager_v1);
154}
155
156static inline uint32_t
157zxdg_decoration_manager_v1_get_version(struct zxdg_decoration_manager_v1 *zxdg_decoration_manager_v1)
158{
159 return wl_proxy_get_version((struct wl_proxy *) zxdg_decoration_manager_v1);
160}
161
162/**
163 * @ingroup iface_zxdg_decoration_manager_v1
164 *
165 * Destroy the decoration manager. This doesn't destroy objects created
166 * with the manager.
167 */
168static inline void
169zxdg_decoration_manager_v1_destroy(struct zxdg_decoration_manager_v1 *zxdg_decoration_manager_v1)
170{
171 wl_proxy_marshal((struct wl_proxy *) zxdg_decoration_manager_v1,
172 ZXDG_DECORATION_MANAGER_V1_DESTROY);
173
174 wl_proxy_destroy((struct wl_proxy *) zxdg_decoration_manager_v1);
175}
176
177/**
178 * @ingroup iface_zxdg_decoration_manager_v1
179 *
180 * Create a new decoration object associated with the given toplevel.
181 *
182 * Creating an xdg_toplevel_decoration from an xdg_toplevel which has a
183 * buffer attached or committed is a client error, and any attempts by a
184 * client to attach or manipulate a buffer prior to the first
185 * xdg_toplevel_decoration.configure event must also be treated as
186 * errors.
187 */
188static inline struct zxdg_toplevel_decoration_v1 *
189zxdg_decoration_manager_v1_get_toplevel_decoration(struct zxdg_decoration_manager_v1 *zxdg_decoration_manager_v1, struct xdg_toplevel *toplevel)
190{
191 struct wl_proxy *id;
192
193 id = wl_proxy_marshal_constructor((struct wl_proxy *) zxdg_decoration_manager_v1,
194 ZXDG_DECORATION_MANAGER_V1_GET_TOPLEVEL_DECORATION, &zxdg_toplevel_decoration_v1_interface, NULL, toplevel);
195
196 return (struct zxdg_toplevel_decoration_v1 *) id;
197}
198
199#ifndef ZXDG_TOPLEVEL_DECORATION_V1_ERROR_ENUM
200#define ZXDG_TOPLEVEL_DECORATION_V1_ERROR_ENUM
201enum zxdg_toplevel_decoration_v1_error {
202 /**
203 * xdg_toplevel has a buffer attached before configure
204 */
205 ZXDG_TOPLEVEL_DECORATION_V1_ERROR_UNCONFIGURED_BUFFER = 0,
206 /**
207 * xdg_toplevel already has a decoration object
208 */
209 ZXDG_TOPLEVEL_DECORATION_V1_ERROR_ALREADY_CONSTRUCTED = 1,
210 /**
211 * xdg_toplevel destroyed before the decoration object
212 */
213 ZXDG_TOPLEVEL_DECORATION_V1_ERROR_ORPHANED = 2,
214};
215#endif /* ZXDG_TOPLEVEL_DECORATION_V1_ERROR_ENUM */
216
217#ifndef ZXDG_TOPLEVEL_DECORATION_V1_MODE_ENUM
218#define ZXDG_TOPLEVEL_DECORATION_V1_MODE_ENUM
219/**
220 * @ingroup iface_zxdg_toplevel_decoration_v1
221 * window decoration modes
222 *
223 * These values describe window decoration modes.
224 */
225enum zxdg_toplevel_decoration_v1_mode {
226 /**
227 * no server-side window decoration
228 */
229 ZXDG_TOPLEVEL_DECORATION_V1_MODE_CLIENT_SIDE = 1,
230 /**
231 * server-side window decoration
232 */
233 ZXDG_TOPLEVEL_DECORATION_V1_MODE_SERVER_SIDE = 2,
234};
235#endif /* ZXDG_TOPLEVEL_DECORATION_V1_MODE_ENUM */
236
237/**
238 * @ingroup iface_zxdg_toplevel_decoration_v1
239 * @struct zxdg_toplevel_decoration_v1_listener
240 */
241struct zxdg_toplevel_decoration_v1_listener {
242 /**
243 * suggest a surface change
244 *
245 * The configure event asks the client to change its decoration
246 * mode. The configured state should not be applied immediately.
247 * Clients must send an ack_configure in response to this event.
248 * See xdg_surface.configure and xdg_surface.ack_configure for
249 * details.
250 *
251 * A configure event can be sent at any time. The specified mode
252 * must be obeyed by the client.
253 * @param mode the decoration mode
254 */
255 void (*configure)(void *data,
256 struct zxdg_toplevel_decoration_v1 *zxdg_toplevel_decoration_v1,
257 uint32_t mode);
258};
259
260/**
261 * @ingroup iface_zxdg_toplevel_decoration_v1
262 */
263static inline int
264zxdg_toplevel_decoration_v1_add_listener(struct zxdg_toplevel_decoration_v1 *zxdg_toplevel_decoration_v1,
265 const struct zxdg_toplevel_decoration_v1_listener *listener, void *data)
266{
267 return wl_proxy_add_listener((struct wl_proxy *) zxdg_toplevel_decoration_v1,
268 (void (**)(void)) listener, data);
269}
270
271#define ZXDG_TOPLEVEL_DECORATION_V1_DESTROY 0
272#define ZXDG_TOPLEVEL_DECORATION_V1_SET_MODE 1
273#define ZXDG_TOPLEVEL_DECORATION_V1_UNSET_MODE 2
274
275/**
276 * @ingroup iface_zxdg_toplevel_decoration_v1
277 */
278#define ZXDG_TOPLEVEL_DECORATION_V1_CONFIGURE_SINCE_VERSION 1
279
280/**
281 * @ingroup iface_zxdg_toplevel_decoration_v1
282 */
283#define ZXDG_TOPLEVEL_DECORATION_V1_DESTROY_SINCE_VERSION 1
284/**
285 * @ingroup iface_zxdg_toplevel_decoration_v1
286 */
287#define ZXDG_TOPLEVEL_DECORATION_V1_SET_MODE_SINCE_VERSION 1
288/**
289 * @ingroup iface_zxdg_toplevel_decoration_v1
290 */
291#define ZXDG_TOPLEVEL_DECORATION_V1_UNSET_MODE_SINCE_VERSION 1
292
293/** @ingroup iface_zxdg_toplevel_decoration_v1 */
294static inline void
295zxdg_toplevel_decoration_v1_set_user_data(struct zxdg_toplevel_decoration_v1 *zxdg_toplevel_decoration_v1, void *user_data)
296{
297 wl_proxy_set_user_data((struct wl_proxy *) zxdg_toplevel_decoration_v1, user_data);
298}
299
300/** @ingroup iface_zxdg_toplevel_decoration_v1 */
301static inline void *
302zxdg_toplevel_decoration_v1_get_user_data(struct zxdg_toplevel_decoration_v1 *zxdg_toplevel_decoration_v1)
303{
304 return wl_proxy_get_user_data((struct wl_proxy *) zxdg_toplevel_decoration_v1);
305}
306
307static inline uint32_t
308zxdg_toplevel_decoration_v1_get_version(struct zxdg_toplevel_decoration_v1 *zxdg_toplevel_decoration_v1)
309{
310 return wl_proxy_get_version((struct wl_proxy *) zxdg_toplevel_decoration_v1);
311}
312
313/**
314 * @ingroup iface_zxdg_toplevel_decoration_v1
315 *
316 * Switch back to a mode without any server-side decorations at the next
317 * commit.
318 */
319static inline void
320zxdg_toplevel_decoration_v1_destroy(struct zxdg_toplevel_decoration_v1 *zxdg_toplevel_decoration_v1)
321{
322 wl_proxy_marshal((struct wl_proxy *) zxdg_toplevel_decoration_v1,
323 ZXDG_TOPLEVEL_DECORATION_V1_DESTROY);
324
325 wl_proxy_destroy((struct wl_proxy *) zxdg_toplevel_decoration_v1);
326}
327
328/**
329 * @ingroup iface_zxdg_toplevel_decoration_v1
330 *
331 * Set the toplevel surface decoration mode. This informs the compositor
332 * that the client prefers the provided decoration mode.
333 *
334 * After requesting a decoration mode, the compositor will respond by
335 * emitting a xdg_surface.configure event. The client should then update
336 * its content, drawing it without decorations if the received mode is
337 * server-side decorations. The client must also acknowledge the configure
338 * when committing the new content (see xdg_surface.ack_configure).
339 *
340 * The compositor can decide not to use the client's mode and enforce a
341 * different mode instead.
342 *
343 * Clients whose decoration mode depend on the xdg_toplevel state may send
344 * a set_mode request in response to a xdg_surface.configure event and wait
345 * for the next xdg_surface.configure event to prevent unwanted state.
346 * Such clients are responsible for preventing configure loops and must
347 * make sure not to send multiple successive set_mode requests with the
348 * same decoration mode.
349 */
350static inline void
351zxdg_toplevel_decoration_v1_set_mode(struct zxdg_toplevel_decoration_v1 *zxdg_toplevel_decoration_v1, uint32_t mode)
352{
353 wl_proxy_marshal((struct wl_proxy *) zxdg_toplevel_decoration_v1,
354 ZXDG_TOPLEVEL_DECORATION_V1_SET_MODE, mode);
355}
356
357/**
358 * @ingroup iface_zxdg_toplevel_decoration_v1
359 *
360 * Unset the toplevel surface decoration mode. This informs the compositor
361 * that the client doesn't prefer a particular decoration mode.
362 *
363 * This request has the same semantics as set_mode.
364 */
365static inline void
366zxdg_toplevel_decoration_v1_unset_mode(struct zxdg_toplevel_decoration_v1 *zxdg_toplevel_decoration_v1)
367{
368 wl_proxy_marshal((struct wl_proxy *) zxdg_toplevel_decoration_v1,
369 ZXDG_TOPLEVEL_DECORATION_V1_UNSET_MODE);
370}
371
372#ifdef __cplusplus
373}
374#endif
375
376#endif
377