1 /* Generated by wayland-scanner 1.22.0 */
2
3 #ifndef XDG_SHELL_UNSTABLE_V6_CLIENT_PROTOCOL_H
4 #define XDG_SHELL_UNSTABLE_V6_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_shell_unstable_v6 The xdg_shell_unstable_v6 protocol
16 * @section page_ifaces_xdg_shell_unstable_v6 Interfaces
17 * - @subpage page_iface_zxdg_shell_v6 - create desktop-style surfaces
18 * - @subpage page_iface_zxdg_positioner_v6 - child surface positioner
19 * - @subpage page_iface_zxdg_surface_v6 - desktop user interface surface base interface
20 * - @subpage page_iface_zxdg_toplevel_v6 - toplevel surface
21 * - @subpage page_iface_zxdg_popup_v6 - short-lived, popup surfaces for menus
22 * @section page_copyright_xdg_shell_unstable_v6 Copyright
23 * <pre>
24 *
25 * Copyright © 2008-2013 Kristian Høgsberg
26 * Copyright © 2013 Rafael Antognolli
27 * Copyright © 2013 Jasper St. Pierre
28 * Copyright © 2010-2013 Intel Corporation
29 *
30 * Permission is hereby granted, free of charge, to any person obtaining a
31 * copy of this software and associated documentation files (the "Software"),
32 * to deal in the Software without restriction, including without limitation
33 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
34 * and/or sell copies of the Software, and to permit persons to whom the
35 * Software is furnished to do so, subject to the following conditions:
36 *
37 * The above copyright notice and this permission notice (including the next
38 * paragraph) shall be included in all copies or substantial portions of the
39 * Software.
40 *
41 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
42 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
43 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
44 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
45 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
46 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
47 * DEALINGS IN THE SOFTWARE.
48 * </pre>
49 */
50 struct wl_output;
51 struct wl_seat;
52 struct wl_surface;
53 struct zxdg_popup_v6;
54 struct zxdg_positioner_v6;
55 struct zxdg_shell_v6;
56 struct zxdg_surface_v6;
57 struct zxdg_toplevel_v6;
58
59 #ifndef ZXDG_SHELL_V6_INTERFACE
60 #define ZXDG_SHELL_V6_INTERFACE
61 /**
62 * @page page_iface_zxdg_shell_v6 zxdg_shell_v6
63 * @section page_iface_zxdg_shell_v6_desc Description
64 *
65 * xdg_shell allows clients to turn a wl_surface into a "real window"
66 * which can be dragged, resized, stacked, and moved around by the
67 * user. Everything about this interface is suited towards traditional
68 * desktop environments.
69 * @section page_iface_zxdg_shell_v6_api API
70 * See @ref iface_zxdg_shell_v6.
71 */
72 /**
73 * @defgroup iface_zxdg_shell_v6 The zxdg_shell_v6 interface
74 *
75 * xdg_shell allows clients to turn a wl_surface into a "real window"
76 * which can be dragged, resized, stacked, and moved around by the
77 * user. Everything about this interface is suited towards traditional
78 * desktop environments.
79 */
80 extern const struct wl_interface zxdg_shell_v6_interface;
81 #endif
82 #ifndef ZXDG_POSITIONER_V6_INTERFACE
83 #define ZXDG_POSITIONER_V6_INTERFACE
84 /**
85 * @page page_iface_zxdg_positioner_v6 zxdg_positioner_v6
86 * @section page_iface_zxdg_positioner_v6_desc Description
87 *
88 * The xdg_positioner provides a collection of rules for the placement of a
89 * child surface relative to a parent surface. Rules can be defined to ensure
90 * the child surface remains within the visible area's borders, and to
91 * specify how the child surface changes its position, such as sliding along
92 * an axis, or flipping around a rectangle. These positioner-created rules are
93 * constrained by the requirement that a child surface must intersect with or
94 * be at least partially adjacent to its parent surface.
95 *
96 * See the various requests for details about possible rules.
97 *
98 * At the time of the request, the compositor makes a copy of the rules
99 * specified by the xdg_positioner. Thus, after the request is complete the
100 * xdg_positioner object can be destroyed or reused; further changes to the
101 * object will have no effect on previous usages.
102 *
103 * For an xdg_positioner object to be considered complete, it must have a
104 * non-zero size set by set_size, and a non-zero anchor rectangle set by
105 * set_anchor_rect. Passing an incomplete xdg_positioner object when
106 * positioning a surface raises an error.
107 * @section page_iface_zxdg_positioner_v6_api API
108 * See @ref iface_zxdg_positioner_v6.
109 */
110 /**
111 * @defgroup iface_zxdg_positioner_v6 The zxdg_positioner_v6 interface
112 *
113 * The xdg_positioner provides a collection of rules for the placement of a
114 * child surface relative to a parent surface. Rules can be defined to ensure
115 * the child surface remains within the visible area's borders, and to
116 * specify how the child surface changes its position, such as sliding along
117 * an axis, or flipping around a rectangle. These positioner-created rules are
118 * constrained by the requirement that a child surface must intersect with or
119 * be at least partially adjacent to its parent surface.
120 *
121 * See the various requests for details about possible rules.
122 *
123 * At the time of the request, the compositor makes a copy of the rules
124 * specified by the xdg_positioner. Thus, after the request is complete the
125 * xdg_positioner object can be destroyed or reused; further changes to the
126 * object will have no effect on previous usages.
127 *
128 * For an xdg_positioner object to be considered complete, it must have a
129 * non-zero size set by set_size, and a non-zero anchor rectangle set by
130 * set_anchor_rect. Passing an incomplete xdg_positioner object when
131 * positioning a surface raises an error.
132 */
133 extern const struct wl_interface zxdg_positioner_v6_interface;
134 #endif
135 #ifndef ZXDG_SURFACE_V6_INTERFACE
136 #define ZXDG_SURFACE_V6_INTERFACE
137 /**
138 * @page page_iface_zxdg_surface_v6 zxdg_surface_v6
139 * @section page_iface_zxdg_surface_v6_desc Description
140 *
141 * An interface that may be implemented by a wl_surface, for
142 * implementations that provide a desktop-style user interface.
143 *
144 * It provides a base set of functionality required to construct user
145 * interface elements requiring management by the compositor, such as
146 * toplevel windows, menus, etc. The types of functionality are split into
147 * xdg_surface roles.
148 *
149 * Creating an xdg_surface does not set the role for a wl_surface. In order
150 * to map an xdg_surface, the client must create a role-specific object
151 * using, e.g., get_toplevel, get_popup. The wl_surface for any given
152 * xdg_surface can have at most one role, and may not be assigned any role
153 * not based on xdg_surface.
154 *
155 * A role must be assigned before any other requests are made to the
156 * xdg_surface object.
157 *
158 * The client must call wl_surface.commit on the corresponding wl_surface
159 * for the xdg_surface state to take effect.
160 *
161 * Creating an xdg_surface from a wl_surface which has a buffer attached or
162 * committed is a client error, and any attempts by a client to attach or
163 * manipulate a buffer prior to the first xdg_surface.configure call must
164 * also be treated as errors.
165 *
166 * For a surface to be mapped by the compositor, the following conditions
167 * must be met: (1) the client has assigned an xdg_surface based role to the
168 * surface, (2) the client has set and committed the xdg_surface state and
169 * the role dependent state to the surface and (3) the client has committed a
170 * buffer to the surface.
171 * @section page_iface_zxdg_surface_v6_api API
172 * See @ref iface_zxdg_surface_v6.
173 */
174 /**
175 * @defgroup iface_zxdg_surface_v6 The zxdg_surface_v6 interface
176 *
177 * An interface that may be implemented by a wl_surface, for
178 * implementations that provide a desktop-style user interface.
179 *
180 * It provides a base set of functionality required to construct user
181 * interface elements requiring management by the compositor, such as
182 * toplevel windows, menus, etc. The types of functionality are split into
183 * xdg_surface roles.
184 *
185 * Creating an xdg_surface does not set the role for a wl_surface. In order
186 * to map an xdg_surface, the client must create a role-specific object
187 * using, e.g., get_toplevel, get_popup. The wl_surface for any given
188 * xdg_surface can have at most one role, and may not be assigned any role
189 * not based on xdg_surface.
190 *
191 * A role must be assigned before any other requests are made to the
192 * xdg_surface object.
193 *
194 * The client must call wl_surface.commit on the corresponding wl_surface
195 * for the xdg_surface state to take effect.
196 *
197 * Creating an xdg_surface from a wl_surface which has a buffer attached or
198 * committed is a client error, and any attempts by a client to attach or
199 * manipulate a buffer prior to the first xdg_surface.configure call must
200 * also be treated as errors.
201 *
202 * For a surface to be mapped by the compositor, the following conditions
203 * must be met: (1) the client has assigned an xdg_surface based role to the
204 * surface, (2) the client has set and committed the xdg_surface state and
205 * the role dependent state to the surface and (3) the client has committed a
206 * buffer to the surface.
207 */
208 extern const struct wl_interface zxdg_surface_v6_interface;
209 #endif
210 #ifndef ZXDG_TOPLEVEL_V6_INTERFACE
211 #define ZXDG_TOPLEVEL_V6_INTERFACE
212 /**
213 * @page page_iface_zxdg_toplevel_v6 zxdg_toplevel_v6
214 * @section page_iface_zxdg_toplevel_v6_desc Description
215 *
216 * This interface defines an xdg_surface role which allows a surface to,
217 * among other things, set window-like properties such as maximize,
218 * fullscreen, and minimize, set application-specific metadata like title and
219 * id, and well as trigger user interactive operations such as interactive
220 * resize and move.
221 * @section page_iface_zxdg_toplevel_v6_api API
222 * See @ref iface_zxdg_toplevel_v6.
223 */
224 /**
225 * @defgroup iface_zxdg_toplevel_v6 The zxdg_toplevel_v6 interface
226 *
227 * This interface defines an xdg_surface role which allows a surface to,
228 * among other things, set window-like properties such as maximize,
229 * fullscreen, and minimize, set application-specific metadata like title and
230 * id, and well as trigger user interactive operations such as interactive
231 * resize and move.
232 */
233 extern const struct wl_interface zxdg_toplevel_v6_interface;
234 #endif
235 #ifndef ZXDG_POPUP_V6_INTERFACE
236 #define ZXDG_POPUP_V6_INTERFACE
237 /**
238 * @page page_iface_zxdg_popup_v6 zxdg_popup_v6
239 * @section page_iface_zxdg_popup_v6_desc Description
240 *
241 * A popup surface is a short-lived, temporary surface. It can be used to
242 * implement for example menus, popovers, tooltips and other similar user
243 * interface concepts.
244 *
245 * A popup can be made to take an explicit grab. See xdg_popup.grab for
246 * details.
247 *
248 * When the popup is dismissed, a popup_done event will be sent out, and at
249 * the same time the surface will be unmapped. See the xdg_popup.popup_done
250 * event for details.
251 *
252 * Explicitly destroying the xdg_popup object will also dismiss the popup and
253 * unmap the surface. Clients that want to dismiss the popup when another
254 * surface of their own is clicked should dismiss the popup using the destroy
255 * request.
256 *
257 * The parent surface must have either the xdg_toplevel or xdg_popup surface
258 * role.
259 *
260 * A newly created xdg_popup will be stacked on top of all previously created
261 * xdg_popup surfaces associated with the same xdg_toplevel.
262 *
263 * The parent of an xdg_popup must be mapped (see the xdg_surface
264 * description) before the xdg_popup itself.
265 *
266 * The x and y arguments passed when creating the popup object specify
267 * where the top left of the popup should be placed, relative to the
268 * local surface coordinates of the parent surface. See
269 * xdg_surface.get_popup. An xdg_popup must intersect with or be at least
270 * partially adjacent to its parent surface.
271 *
272 * The client must call wl_surface.commit on the corresponding wl_surface
273 * for the xdg_popup state to take effect.
274 * @section page_iface_zxdg_popup_v6_api API
275 * See @ref iface_zxdg_popup_v6.
276 */
277 /**
278 * @defgroup iface_zxdg_popup_v6 The zxdg_popup_v6 interface
279 *
280 * A popup surface is a short-lived, temporary surface. It can be used to
281 * implement for example menus, popovers, tooltips and other similar user
282 * interface concepts.
283 *
284 * A popup can be made to take an explicit grab. See xdg_popup.grab for
285 * details.
286 *
287 * When the popup is dismissed, a popup_done event will be sent out, and at
288 * the same time the surface will be unmapped. See the xdg_popup.popup_done
289 * event for details.
290 *
291 * Explicitly destroying the xdg_popup object will also dismiss the popup and
292 * unmap the surface. Clients that want to dismiss the popup when another
293 * surface of their own is clicked should dismiss the popup using the destroy
294 * request.
295 *
296 * The parent surface must have either the xdg_toplevel or xdg_popup surface
297 * role.
298 *
299 * A newly created xdg_popup will be stacked on top of all previously created
300 * xdg_popup surfaces associated with the same xdg_toplevel.
301 *
302 * The parent of an xdg_popup must be mapped (see the xdg_surface
303 * description) before the xdg_popup itself.
304 *
305 * The x and y arguments passed when creating the popup object specify
306 * where the top left of the popup should be placed, relative to the
307 * local surface coordinates of the parent surface. See
308 * xdg_surface.get_popup. An xdg_popup must intersect with or be at least
309 * partially adjacent to its parent surface.
310 *
311 * The client must call wl_surface.commit on the corresponding wl_surface
312 * for the xdg_popup state to take effect.
313 */
314 extern const struct wl_interface zxdg_popup_v6_interface;
315 #endif
316
317 #ifndef ZXDG_SHELL_V6_ERROR_ENUM
318 #define ZXDG_SHELL_V6_ERROR_ENUM
319 enum zxdg_shell_v6_error {
320 /**
321 * given wl_surface has another role
322 */
323 ZXDG_SHELL_V6_ERROR_ROLE = 0,
324 /**
325 * xdg_shell was destroyed before children
326 */
327 ZXDG_SHELL_V6_ERROR_DEFUNCT_SURFACES = 1,
328 /**
329 * the client tried to map or destroy a non-topmost popup
330 */
331 ZXDG_SHELL_V6_ERROR_NOT_THE_TOPMOST_POPUP = 2,
332 /**
333 * the client specified an invalid popup parent surface
334 */
335 ZXDG_SHELL_V6_ERROR_INVALID_POPUP_PARENT = 3,
336 /**
337 * the client provided an invalid surface state
338 */
339 ZXDG_SHELL_V6_ERROR_INVALID_SURFACE_STATE = 4,
340 /**
341 * the client provided an invalid positioner
342 */
343 ZXDG_SHELL_V6_ERROR_INVALID_POSITIONER = 5,
344 };
345 #endif /* ZXDG_SHELL_V6_ERROR_ENUM */
346
347 /**
348 * @ingroup iface_zxdg_shell_v6
349 * @struct zxdg_shell_v6_listener
350 */
351 struct zxdg_shell_v6_listener {
352 /**
353 * check if the client is alive
354 *
355 * The ping event asks the client if it's still alive. Pass the
356 * serial specified in the event back to the compositor by sending
357 * a "pong" request back with the specified serial. See
358 * xdg_shell.ping.
359 *
360 * Compositors can use this to determine if the client is still
361 * alive. It's unspecified what will happen if the client doesn't
362 * respond to the ping request, or in what timeframe. Clients
363 * should try to respond in a reasonable amount of time.
364 *
365 * A compositor is free to ping in any way it wants, but a client
366 * must always respond to any xdg_shell object it created.
367 * @param serial pass this to the pong request
368 */
369 void (*ping)(void *data,
370 struct zxdg_shell_v6 *zxdg_shell_v6,
371 uint32_t serial);
372 };
373
374 /**
375 * @ingroup iface_zxdg_shell_v6
376 */
377 static inline int
zxdg_shell_v6_add_listener(struct zxdg_shell_v6 * zxdg_shell_v6,const struct zxdg_shell_v6_listener * listener,void * data)378 zxdg_shell_v6_add_listener(struct zxdg_shell_v6 *zxdg_shell_v6,
379 const struct zxdg_shell_v6_listener *listener, void *data)
380 {
381 return wl_proxy_add_listener((struct wl_proxy *) zxdg_shell_v6,
382 (void (**)(void)) listener, data);
383 }
384
385 #define ZXDG_SHELL_V6_DESTROY 0
386 #define ZXDG_SHELL_V6_CREATE_POSITIONER 1
387 #define ZXDG_SHELL_V6_GET_XDG_SURFACE 2
388 #define ZXDG_SHELL_V6_PONG 3
389
390 /**
391 * @ingroup iface_zxdg_shell_v6
392 */
393 #define ZXDG_SHELL_V6_PING_SINCE_VERSION 1
394
395 /**
396 * @ingroup iface_zxdg_shell_v6
397 */
398 #define ZXDG_SHELL_V6_DESTROY_SINCE_VERSION 1
399 /**
400 * @ingroup iface_zxdg_shell_v6
401 */
402 #define ZXDG_SHELL_V6_CREATE_POSITIONER_SINCE_VERSION 1
403 /**
404 * @ingroup iface_zxdg_shell_v6
405 */
406 #define ZXDG_SHELL_V6_GET_XDG_SURFACE_SINCE_VERSION 1
407 /**
408 * @ingroup iface_zxdg_shell_v6
409 */
410 #define ZXDG_SHELL_V6_PONG_SINCE_VERSION 1
411
412 /** @ingroup iface_zxdg_shell_v6 */
413 static inline void
zxdg_shell_v6_set_user_data(struct zxdg_shell_v6 * zxdg_shell_v6,void * user_data)414 zxdg_shell_v6_set_user_data(struct zxdg_shell_v6 *zxdg_shell_v6, void *user_data)
415 {
416 wl_proxy_set_user_data((struct wl_proxy *) zxdg_shell_v6, user_data);
417 }
418
419 /** @ingroup iface_zxdg_shell_v6 */
420 static inline void *
zxdg_shell_v6_get_user_data(struct zxdg_shell_v6 * zxdg_shell_v6)421 zxdg_shell_v6_get_user_data(struct zxdg_shell_v6 *zxdg_shell_v6)
422 {
423 return wl_proxy_get_user_data((struct wl_proxy *) zxdg_shell_v6);
424 }
425
426 static inline uint32_t
zxdg_shell_v6_get_version(struct zxdg_shell_v6 * zxdg_shell_v6)427 zxdg_shell_v6_get_version(struct zxdg_shell_v6 *zxdg_shell_v6)
428 {
429 return wl_proxy_get_version((struct wl_proxy *) zxdg_shell_v6);
430 }
431
432 /**
433 * @ingroup iface_zxdg_shell_v6
434 *
435 * Destroy this xdg_shell object.
436 *
437 * Destroying a bound xdg_shell object while there are surfaces
438 * still alive created by this xdg_shell object instance is illegal
439 * and will result in a protocol error.
440 */
441 static inline void
zxdg_shell_v6_destroy(struct zxdg_shell_v6 * zxdg_shell_v6)442 zxdg_shell_v6_destroy(struct zxdg_shell_v6 *zxdg_shell_v6)
443 {
444 wl_proxy_marshal_flags((struct wl_proxy *) zxdg_shell_v6,
445 ZXDG_SHELL_V6_DESTROY, NULL, wl_proxy_get_version((struct wl_proxy *) zxdg_shell_v6), WL_MARSHAL_FLAG_DESTROY);
446 }
447
448 /**
449 * @ingroup iface_zxdg_shell_v6
450 *
451 * Create a positioner object. A positioner object is used to position
452 * surfaces relative to some parent surface. See the interface description
453 * and xdg_surface.get_popup for details.
454 */
455 static inline struct zxdg_positioner_v6 *
zxdg_shell_v6_create_positioner(struct zxdg_shell_v6 * zxdg_shell_v6)456 zxdg_shell_v6_create_positioner(struct zxdg_shell_v6 *zxdg_shell_v6)
457 {
458 struct wl_proxy *id;
459
460 id = wl_proxy_marshal_flags((struct wl_proxy *) zxdg_shell_v6,
461 ZXDG_SHELL_V6_CREATE_POSITIONER, &zxdg_positioner_v6_interface, wl_proxy_get_version((struct wl_proxy *) zxdg_shell_v6), 0, NULL);
462
463 return (struct zxdg_positioner_v6 *) id;
464 }
465
466 /**
467 * @ingroup iface_zxdg_shell_v6
468 *
469 * This creates an xdg_surface for the given surface. While xdg_surface
470 * itself is not a role, the corresponding surface may only be assigned
471 * a role extending xdg_surface, such as xdg_toplevel or xdg_popup.
472 *
473 * This creates an xdg_surface for the given surface. An xdg_surface is
474 * used as basis to define a role to a given surface, such as xdg_toplevel
475 * or xdg_popup. It also manages functionality shared between xdg_surface
476 * based surface roles.
477 *
478 * See the documentation of xdg_surface for more details about what an
479 * xdg_surface is and how it is used.
480 */
481 static inline struct zxdg_surface_v6 *
zxdg_shell_v6_get_xdg_surface(struct zxdg_shell_v6 * zxdg_shell_v6,struct wl_surface * surface)482 zxdg_shell_v6_get_xdg_surface(struct zxdg_shell_v6 *zxdg_shell_v6, struct wl_surface *surface)
483 {
484 struct wl_proxy *id;
485
486 id = wl_proxy_marshal_flags((struct wl_proxy *) zxdg_shell_v6,
487 ZXDG_SHELL_V6_GET_XDG_SURFACE, &zxdg_surface_v6_interface, wl_proxy_get_version((struct wl_proxy *) zxdg_shell_v6), 0, NULL, surface);
488
489 return (struct zxdg_surface_v6 *) id;
490 }
491
492 /**
493 * @ingroup iface_zxdg_shell_v6
494 *
495 * A client must respond to a ping event with a pong request or
496 * the client may be deemed unresponsive. See xdg_shell.ping.
497 */
498 static inline void
zxdg_shell_v6_pong(struct zxdg_shell_v6 * zxdg_shell_v6,uint32_t serial)499 zxdg_shell_v6_pong(struct zxdg_shell_v6 *zxdg_shell_v6, uint32_t serial)
500 {
501 wl_proxy_marshal_flags((struct wl_proxy *) zxdg_shell_v6,
502 ZXDG_SHELL_V6_PONG, NULL, wl_proxy_get_version((struct wl_proxy *) zxdg_shell_v6), 0, serial);
503 }
504
505 #ifndef ZXDG_POSITIONER_V6_ERROR_ENUM
506 #define ZXDG_POSITIONER_V6_ERROR_ENUM
507 enum zxdg_positioner_v6_error {
508 /**
509 * invalid input provided
510 */
511 ZXDG_POSITIONER_V6_ERROR_INVALID_INPUT = 0,
512 };
513 #endif /* ZXDG_POSITIONER_V6_ERROR_ENUM */
514
515 #ifndef ZXDG_POSITIONER_V6_ANCHOR_ENUM
516 #define ZXDG_POSITIONER_V6_ANCHOR_ENUM
517 enum zxdg_positioner_v6_anchor {
518 /**
519 * the center of the anchor rectangle
520 */
521 ZXDG_POSITIONER_V6_ANCHOR_NONE = 0,
522 /**
523 * the top edge of the anchor rectangle
524 */
525 ZXDG_POSITIONER_V6_ANCHOR_TOP = 1,
526 /**
527 * the bottom edge of the anchor rectangle
528 */
529 ZXDG_POSITIONER_V6_ANCHOR_BOTTOM = 2,
530 /**
531 * the left edge of the anchor rectangle
532 */
533 ZXDG_POSITIONER_V6_ANCHOR_LEFT = 4,
534 /**
535 * the right edge of the anchor rectangle
536 */
537 ZXDG_POSITIONER_V6_ANCHOR_RIGHT = 8,
538 };
539 #endif /* ZXDG_POSITIONER_V6_ANCHOR_ENUM */
540
541 #ifndef ZXDG_POSITIONER_V6_GRAVITY_ENUM
542 #define ZXDG_POSITIONER_V6_GRAVITY_ENUM
543 enum zxdg_positioner_v6_gravity {
544 /**
545 * center over the anchor edge
546 */
547 ZXDG_POSITIONER_V6_GRAVITY_NONE = 0,
548 /**
549 * position above the anchor edge
550 */
551 ZXDG_POSITIONER_V6_GRAVITY_TOP = 1,
552 /**
553 * position below the anchor edge
554 */
555 ZXDG_POSITIONER_V6_GRAVITY_BOTTOM = 2,
556 /**
557 * position to the left of the anchor edge
558 */
559 ZXDG_POSITIONER_V6_GRAVITY_LEFT = 4,
560 /**
561 * position to the right of the anchor edge
562 */
563 ZXDG_POSITIONER_V6_GRAVITY_RIGHT = 8,
564 };
565 #endif /* ZXDG_POSITIONER_V6_GRAVITY_ENUM */
566
567 #ifndef ZXDG_POSITIONER_V6_CONSTRAINT_ADJUSTMENT_ENUM
568 #define ZXDG_POSITIONER_V6_CONSTRAINT_ADJUSTMENT_ENUM
569 /**
570 * @ingroup iface_zxdg_positioner_v6
571 * constraint adjustments
572 *
573 * The constraint adjustment value define ways the compositor will adjust
574 * the position of the surface, if the unadjusted position would result
575 * in the surface being partly constrained.
576 *
577 * Whether a surface is considered 'constrained' is left to the compositor
578 * to determine. For example, the surface may be partly outside the
579 * compositor's defined 'work area', thus necessitating the child surface's
580 * position be adjusted until it is entirely inside the work area.
581 *
582 * The adjustments can be combined, according to a defined precedence: 1)
583 * Flip, 2) Slide, 3) Resize.
584 */
585 enum zxdg_positioner_v6_constraint_adjustment {
586 /**
587 * don't move the child surface when constrained
588 *
589 * Don't alter the surface position even if it is constrained on
590 * some axis, for example partially outside the edge of a monitor.
591 */
592 ZXDG_POSITIONER_V6_CONSTRAINT_ADJUSTMENT_NONE = 0,
593 /**
594 * move along the x axis until unconstrained
595 *
596 * Slide the surface along the x axis until it is no longer
597 * constrained.
598 *
599 * First try to slide towards the direction of the gravity on the x
600 * axis until either the edge in the opposite direction of the
601 * gravity is unconstrained or the edge in the direction of the
602 * gravity is constrained.
603 *
604 * Then try to slide towards the opposite direction of the gravity
605 * on the x axis until either the edge in the direction of the
606 * gravity is unconstrained or the edge in the opposite direction
607 * of the gravity is constrained.
608 */
609 ZXDG_POSITIONER_V6_CONSTRAINT_ADJUSTMENT_SLIDE_X = 1,
610 /**
611 * move along the y axis until unconstrained
612 *
613 * Slide the surface along the y axis until it is no longer
614 * constrained.
615 *
616 * First try to slide towards the direction of the gravity on the y
617 * axis until either the edge in the opposite direction of the
618 * gravity is unconstrained or the edge in the direction of the
619 * gravity is constrained.
620 *
621 * Then try to slide towards the opposite direction of the gravity
622 * on the y axis until either the edge in the direction of the
623 * gravity is unconstrained or the edge in the opposite direction
624 * of the gravity is constrained.
625 */
626 ZXDG_POSITIONER_V6_CONSTRAINT_ADJUSTMENT_SLIDE_Y = 2,
627 /**
628 * invert the anchor and gravity on the x axis
629 *
630 * Invert the anchor and gravity on the x axis if the surface is
631 * constrained on the x axis. For example, if the left edge of the
632 * surface is constrained, the gravity is 'left' and the anchor is
633 * 'left', change the gravity to 'right' and the anchor to 'right'.
634 *
635 * If the adjusted position also ends up being constrained, the
636 * resulting position of the flip_x adjustment will be the one
637 * before the adjustment.
638 */
639 ZXDG_POSITIONER_V6_CONSTRAINT_ADJUSTMENT_FLIP_X = 4,
640 /**
641 * invert the anchor and gravity on the y axis
642 *
643 * Invert the anchor and gravity on the y axis if the surface is
644 * constrained on the y axis. For example, if the bottom edge of
645 * the surface is constrained, the gravity is 'bottom' and the
646 * anchor is 'bottom', change the gravity to 'top' and the anchor
647 * to 'top'.
648 *
649 * If the adjusted position also ends up being constrained, the
650 * resulting position of the flip_y adjustment will be the one
651 * before the adjustment.
652 */
653 ZXDG_POSITIONER_V6_CONSTRAINT_ADJUSTMENT_FLIP_Y = 8,
654 /**
655 * horizontally resize the surface
656 *
657 * Resize the surface horizontally so that it is completely
658 * unconstrained.
659 */
660 ZXDG_POSITIONER_V6_CONSTRAINT_ADJUSTMENT_RESIZE_X = 16,
661 /**
662 * vertically resize the surface
663 *
664 * Resize the surface vertically so that it is completely
665 * unconstrained.
666 */
667 ZXDG_POSITIONER_V6_CONSTRAINT_ADJUSTMENT_RESIZE_Y = 32,
668 };
669 #endif /* ZXDG_POSITIONER_V6_CONSTRAINT_ADJUSTMENT_ENUM */
670
671 #define ZXDG_POSITIONER_V6_DESTROY 0
672 #define ZXDG_POSITIONER_V6_SET_SIZE 1
673 #define ZXDG_POSITIONER_V6_SET_ANCHOR_RECT 2
674 #define ZXDG_POSITIONER_V6_SET_ANCHOR 3
675 #define ZXDG_POSITIONER_V6_SET_GRAVITY 4
676 #define ZXDG_POSITIONER_V6_SET_CONSTRAINT_ADJUSTMENT 5
677 #define ZXDG_POSITIONER_V6_SET_OFFSET 6
678
679
680 /**
681 * @ingroup iface_zxdg_positioner_v6
682 */
683 #define ZXDG_POSITIONER_V6_DESTROY_SINCE_VERSION 1
684 /**
685 * @ingroup iface_zxdg_positioner_v6
686 */
687 #define ZXDG_POSITIONER_V6_SET_SIZE_SINCE_VERSION 1
688 /**
689 * @ingroup iface_zxdg_positioner_v6
690 */
691 #define ZXDG_POSITIONER_V6_SET_ANCHOR_RECT_SINCE_VERSION 1
692 /**
693 * @ingroup iface_zxdg_positioner_v6
694 */
695 #define ZXDG_POSITIONER_V6_SET_ANCHOR_SINCE_VERSION 1
696 /**
697 * @ingroup iface_zxdg_positioner_v6
698 */
699 #define ZXDG_POSITIONER_V6_SET_GRAVITY_SINCE_VERSION 1
700 /**
701 * @ingroup iface_zxdg_positioner_v6
702 */
703 #define ZXDG_POSITIONER_V6_SET_CONSTRAINT_ADJUSTMENT_SINCE_VERSION 1
704 /**
705 * @ingroup iface_zxdg_positioner_v6
706 */
707 #define ZXDG_POSITIONER_V6_SET_OFFSET_SINCE_VERSION 1
708
709 /** @ingroup iface_zxdg_positioner_v6 */
710 static inline void
zxdg_positioner_v6_set_user_data(struct zxdg_positioner_v6 * zxdg_positioner_v6,void * user_data)711 zxdg_positioner_v6_set_user_data(struct zxdg_positioner_v6 *zxdg_positioner_v6, void *user_data)
712 {
713 wl_proxy_set_user_data((struct wl_proxy *) zxdg_positioner_v6, user_data);
714 }
715
716 /** @ingroup iface_zxdg_positioner_v6 */
717 static inline void *
zxdg_positioner_v6_get_user_data(struct zxdg_positioner_v6 * zxdg_positioner_v6)718 zxdg_positioner_v6_get_user_data(struct zxdg_positioner_v6 *zxdg_positioner_v6)
719 {
720 return wl_proxy_get_user_data((struct wl_proxy *) zxdg_positioner_v6);
721 }
722
723 static inline uint32_t
zxdg_positioner_v6_get_version(struct zxdg_positioner_v6 * zxdg_positioner_v6)724 zxdg_positioner_v6_get_version(struct zxdg_positioner_v6 *zxdg_positioner_v6)
725 {
726 return wl_proxy_get_version((struct wl_proxy *) zxdg_positioner_v6);
727 }
728
729 /**
730 * @ingroup iface_zxdg_positioner_v6
731 *
732 * Notify the compositor that the xdg_positioner will no longer be used.
733 */
734 static inline void
zxdg_positioner_v6_destroy(struct zxdg_positioner_v6 * zxdg_positioner_v6)735 zxdg_positioner_v6_destroy(struct zxdg_positioner_v6 *zxdg_positioner_v6)
736 {
737 wl_proxy_marshal_flags((struct wl_proxy *) zxdg_positioner_v6,
738 ZXDG_POSITIONER_V6_DESTROY, NULL, wl_proxy_get_version((struct wl_proxy *) zxdg_positioner_v6), WL_MARSHAL_FLAG_DESTROY);
739 }
740
741 /**
742 * @ingroup iface_zxdg_positioner_v6
743 *
744 * Set the size of the surface that is to be positioned with the positioner
745 * object. The size is in surface-local coordinates and corresponds to the
746 * window geometry. See xdg_surface.set_window_geometry.
747 *
748 * If a zero or negative size is set the invalid_input error is raised.
749 */
750 static inline void
zxdg_positioner_v6_set_size(struct zxdg_positioner_v6 * zxdg_positioner_v6,int32_t width,int32_t height)751 zxdg_positioner_v6_set_size(struct zxdg_positioner_v6 *zxdg_positioner_v6, int32_t width, int32_t height)
752 {
753 wl_proxy_marshal_flags((struct wl_proxy *) zxdg_positioner_v6,
754 ZXDG_POSITIONER_V6_SET_SIZE, NULL, wl_proxy_get_version((struct wl_proxy *) zxdg_positioner_v6), 0, width, height);
755 }
756
757 /**
758 * @ingroup iface_zxdg_positioner_v6
759 *
760 * Specify the anchor rectangle within the parent surface that the child
761 * surface will be placed relative to. The rectangle is relative to the
762 * window geometry as defined by xdg_surface.set_window_geometry of the
763 * parent surface. The rectangle must be at least 1x1 large.
764 *
765 * When the xdg_positioner object is used to position a child surface, the
766 * anchor rectangle may not extend outside the window geometry of the
767 * positioned child's parent surface.
768 *
769 * If a zero or negative size is set the invalid_input error is raised.
770 */
771 static inline void
zxdg_positioner_v6_set_anchor_rect(struct zxdg_positioner_v6 * zxdg_positioner_v6,int32_t x,int32_t y,int32_t width,int32_t height)772 zxdg_positioner_v6_set_anchor_rect(struct zxdg_positioner_v6 *zxdg_positioner_v6, int32_t x, int32_t y, int32_t width, int32_t height)
773 {
774 wl_proxy_marshal_flags((struct wl_proxy *) zxdg_positioner_v6,
775 ZXDG_POSITIONER_V6_SET_ANCHOR_RECT, NULL, wl_proxy_get_version((struct wl_proxy *) zxdg_positioner_v6), 0, x, y, width, height);
776 }
777
778 /**
779 * @ingroup iface_zxdg_positioner_v6
780 *
781 * Defines a set of edges for the anchor rectangle. These are used to
782 * derive an anchor point that the child surface will be positioned
783 * relative to. If two orthogonal edges are specified (e.g. 'top' and
784 * 'left'), then the anchor point will be the intersection of the edges
785 * (e.g. the top left position of the rectangle); otherwise, the derived
786 * anchor point will be centered on the specified edge, or in the center of
787 * the anchor rectangle if no edge is specified.
788 *
789 * If two parallel anchor edges are specified (e.g. 'left' and 'right'),
790 * the invalid_input error is raised.
791 */
792 static inline void
zxdg_positioner_v6_set_anchor(struct zxdg_positioner_v6 * zxdg_positioner_v6,uint32_t anchor)793 zxdg_positioner_v6_set_anchor(struct zxdg_positioner_v6 *zxdg_positioner_v6, uint32_t anchor)
794 {
795 wl_proxy_marshal_flags((struct wl_proxy *) zxdg_positioner_v6,
796 ZXDG_POSITIONER_V6_SET_ANCHOR, NULL, wl_proxy_get_version((struct wl_proxy *) zxdg_positioner_v6), 0, anchor);
797 }
798
799 /**
800 * @ingroup iface_zxdg_positioner_v6
801 *
802 * Defines in what direction a surface should be positioned, relative to
803 * the anchor point of the parent surface. If two orthogonal gravities are
804 * specified (e.g. 'bottom' and 'right'), then the child surface will be
805 * placed in the specified direction; otherwise, the child surface will be
806 * centered over the anchor point on any axis that had no gravity
807 * specified.
808 *
809 * If two parallel gravities are specified (e.g. 'left' and 'right'), the
810 * invalid_input error is raised.
811 */
812 static inline void
zxdg_positioner_v6_set_gravity(struct zxdg_positioner_v6 * zxdg_positioner_v6,uint32_t gravity)813 zxdg_positioner_v6_set_gravity(struct zxdg_positioner_v6 *zxdg_positioner_v6, uint32_t gravity)
814 {
815 wl_proxy_marshal_flags((struct wl_proxy *) zxdg_positioner_v6,
816 ZXDG_POSITIONER_V6_SET_GRAVITY, NULL, wl_proxy_get_version((struct wl_proxy *) zxdg_positioner_v6), 0, gravity);
817 }
818
819 /**
820 * @ingroup iface_zxdg_positioner_v6
821 *
822 * Specify how the window should be positioned if the originally intended
823 * position caused the surface to be constrained, meaning at least
824 * partially outside positioning boundaries set by the compositor. The
825 * adjustment is set by constructing a bitmask describing the adjustment to
826 * be made when the surface is constrained on that axis.
827 *
828 * If no bit for one axis is set, the compositor will assume that the child
829 * surface should not change its position on that axis when constrained.
830 *
831 * If more than one bit for one axis is set, the order of how adjustments
832 * are applied is specified in the corresponding adjustment descriptions.
833 *
834 * The default adjustment is none.
835 */
836 static inline void
zxdg_positioner_v6_set_constraint_adjustment(struct zxdg_positioner_v6 * zxdg_positioner_v6,uint32_t constraint_adjustment)837 zxdg_positioner_v6_set_constraint_adjustment(struct zxdg_positioner_v6 *zxdg_positioner_v6, uint32_t constraint_adjustment)
838 {
839 wl_proxy_marshal_flags((struct wl_proxy *) zxdg_positioner_v6,
840 ZXDG_POSITIONER_V6_SET_CONSTRAINT_ADJUSTMENT, NULL, wl_proxy_get_version((struct wl_proxy *) zxdg_positioner_v6), 0, constraint_adjustment);
841 }
842
843 /**
844 * @ingroup iface_zxdg_positioner_v6
845 *
846 * Specify the surface position offset relative to the position of the
847 * anchor on the anchor rectangle and the anchor on the surface. For
848 * example if the anchor of the anchor rectangle is at (x, y), the surface
849 * has the gravity bottom|right, and the offset is (ox, oy), the calculated
850 * surface position will be (x + ox, y + oy). The offset position of the
851 * surface is the one used for constraint testing. See
852 * set_constraint_adjustment.
853 *
854 * An example use case is placing a popup menu on top of a user interface
855 * element, while aligning the user interface element of the parent surface
856 * with some user interface element placed somewhere in the popup surface.
857 */
858 static inline void
zxdg_positioner_v6_set_offset(struct zxdg_positioner_v6 * zxdg_positioner_v6,int32_t x,int32_t y)859 zxdg_positioner_v6_set_offset(struct zxdg_positioner_v6 *zxdg_positioner_v6, int32_t x, int32_t y)
860 {
861 wl_proxy_marshal_flags((struct wl_proxy *) zxdg_positioner_v6,
862 ZXDG_POSITIONER_V6_SET_OFFSET, NULL, wl_proxy_get_version((struct wl_proxy *) zxdg_positioner_v6), 0, x, y);
863 }
864
865 #ifndef ZXDG_SURFACE_V6_ERROR_ENUM
866 #define ZXDG_SURFACE_V6_ERROR_ENUM
867 enum zxdg_surface_v6_error {
868 ZXDG_SURFACE_V6_ERROR_NOT_CONSTRUCTED = 1,
869 ZXDG_SURFACE_V6_ERROR_ALREADY_CONSTRUCTED = 2,
870 ZXDG_SURFACE_V6_ERROR_UNCONFIGURED_BUFFER = 3,
871 };
872 #endif /* ZXDG_SURFACE_V6_ERROR_ENUM */
873
874 /**
875 * @ingroup iface_zxdg_surface_v6
876 * @struct zxdg_surface_v6_listener
877 */
878 struct zxdg_surface_v6_listener {
879 /**
880 * suggest a surface change
881 *
882 * The configure event marks the end of a configure sequence. A
883 * configure sequence is a set of one or more events configuring
884 * the state of the xdg_surface, including the final
885 * xdg_surface.configure event.
886 *
887 * Where applicable, xdg_surface surface roles will during a
888 * configure sequence extend this event as a latched state sent as
889 * events before the xdg_surface.configure event. Such events
890 * should be considered to make up a set of atomically applied
891 * configuration states, where the xdg_surface.configure commits
892 * the accumulated state.
893 *
894 * Clients should arrange their surface for the new states, and
895 * then send an ack_configure request with the serial sent in this
896 * configure event at some point before committing the new surface.
897 *
898 * If the client receives multiple configure events before it can
899 * respond to one, it is free to discard all but the last event it
900 * received.
901 * @param serial serial of the configure event
902 */
903 void (*configure)(void *data,
904 struct zxdg_surface_v6 *zxdg_surface_v6,
905 uint32_t serial);
906 };
907
908 /**
909 * @ingroup iface_zxdg_surface_v6
910 */
911 static inline int
zxdg_surface_v6_add_listener(struct zxdg_surface_v6 * zxdg_surface_v6,const struct zxdg_surface_v6_listener * listener,void * data)912 zxdg_surface_v6_add_listener(struct zxdg_surface_v6 *zxdg_surface_v6,
913 const struct zxdg_surface_v6_listener *listener, void *data)
914 {
915 return wl_proxy_add_listener((struct wl_proxy *) zxdg_surface_v6,
916 (void (**)(void)) listener, data);
917 }
918
919 #define ZXDG_SURFACE_V6_DESTROY 0
920 #define ZXDG_SURFACE_V6_GET_TOPLEVEL 1
921 #define ZXDG_SURFACE_V6_GET_POPUP 2
922 #define ZXDG_SURFACE_V6_SET_WINDOW_GEOMETRY 3
923 #define ZXDG_SURFACE_V6_ACK_CONFIGURE 4
924
925 /**
926 * @ingroup iface_zxdg_surface_v6
927 */
928 #define ZXDG_SURFACE_V6_CONFIGURE_SINCE_VERSION 1
929
930 /**
931 * @ingroup iface_zxdg_surface_v6
932 */
933 #define ZXDG_SURFACE_V6_DESTROY_SINCE_VERSION 1
934 /**
935 * @ingroup iface_zxdg_surface_v6
936 */
937 #define ZXDG_SURFACE_V6_GET_TOPLEVEL_SINCE_VERSION 1
938 /**
939 * @ingroup iface_zxdg_surface_v6
940 */
941 #define ZXDG_SURFACE_V6_GET_POPUP_SINCE_VERSION 1
942 /**
943 * @ingroup iface_zxdg_surface_v6
944 */
945 #define ZXDG_SURFACE_V6_SET_WINDOW_GEOMETRY_SINCE_VERSION 1
946 /**
947 * @ingroup iface_zxdg_surface_v6
948 */
949 #define ZXDG_SURFACE_V6_ACK_CONFIGURE_SINCE_VERSION 1
950
951 /** @ingroup iface_zxdg_surface_v6 */
952 static inline void
zxdg_surface_v6_set_user_data(struct zxdg_surface_v6 * zxdg_surface_v6,void * user_data)953 zxdg_surface_v6_set_user_data(struct zxdg_surface_v6 *zxdg_surface_v6, void *user_data)
954 {
955 wl_proxy_set_user_data((struct wl_proxy *) zxdg_surface_v6, user_data);
956 }
957
958 /** @ingroup iface_zxdg_surface_v6 */
959 static inline void *
zxdg_surface_v6_get_user_data(struct zxdg_surface_v6 * zxdg_surface_v6)960 zxdg_surface_v6_get_user_data(struct zxdg_surface_v6 *zxdg_surface_v6)
961 {
962 return wl_proxy_get_user_data((struct wl_proxy *) zxdg_surface_v6);
963 }
964
965 static inline uint32_t
zxdg_surface_v6_get_version(struct zxdg_surface_v6 * zxdg_surface_v6)966 zxdg_surface_v6_get_version(struct zxdg_surface_v6 *zxdg_surface_v6)
967 {
968 return wl_proxy_get_version((struct wl_proxy *) zxdg_surface_v6);
969 }
970
971 /**
972 * @ingroup iface_zxdg_surface_v6
973 *
974 * Destroy the xdg_surface object. An xdg_surface must only be destroyed
975 * after its role object has been destroyed.
976 */
977 static inline void
zxdg_surface_v6_destroy(struct zxdg_surface_v6 * zxdg_surface_v6)978 zxdg_surface_v6_destroy(struct zxdg_surface_v6 *zxdg_surface_v6)
979 {
980 wl_proxy_marshal_flags((struct wl_proxy *) zxdg_surface_v6,
981 ZXDG_SURFACE_V6_DESTROY, NULL, wl_proxy_get_version((struct wl_proxy *) zxdg_surface_v6), WL_MARSHAL_FLAG_DESTROY);
982 }
983
984 /**
985 * @ingroup iface_zxdg_surface_v6
986 *
987 * This creates an xdg_toplevel object for the given xdg_surface and gives
988 * the associated wl_surface the xdg_toplevel role.
989 *
990 * See the documentation of xdg_toplevel for more details about what an
991 * xdg_toplevel is and how it is used.
992 */
993 static inline struct zxdg_toplevel_v6 *
zxdg_surface_v6_get_toplevel(struct zxdg_surface_v6 * zxdg_surface_v6)994 zxdg_surface_v6_get_toplevel(struct zxdg_surface_v6 *zxdg_surface_v6)
995 {
996 struct wl_proxy *id;
997
998 id = wl_proxy_marshal_flags((struct wl_proxy *) zxdg_surface_v6,
999 ZXDG_SURFACE_V6_GET_TOPLEVEL, &zxdg_toplevel_v6_interface, wl_proxy_get_version((struct wl_proxy *) zxdg_surface_v6), 0, NULL);
1000
1001 return (struct zxdg_toplevel_v6 *) id;
1002 }
1003
1004 /**
1005 * @ingroup iface_zxdg_surface_v6
1006 *
1007 * This creates an xdg_popup object for the given xdg_surface and gives the
1008 * associated wl_surface the xdg_popup role.
1009 *
1010 * See the documentation of xdg_popup for more details about what an
1011 * xdg_popup is and how it is used.
1012 */
1013 static inline struct zxdg_popup_v6 *
zxdg_surface_v6_get_popup(struct zxdg_surface_v6 * zxdg_surface_v6,struct zxdg_surface_v6 * parent,struct zxdg_positioner_v6 * positioner)1014 zxdg_surface_v6_get_popup(struct zxdg_surface_v6 *zxdg_surface_v6, struct zxdg_surface_v6 *parent, struct zxdg_positioner_v6 *positioner)
1015 {
1016 struct wl_proxy *id;
1017
1018 id = wl_proxy_marshal_flags((struct wl_proxy *) zxdg_surface_v6,
1019 ZXDG_SURFACE_V6_GET_POPUP, &zxdg_popup_v6_interface, wl_proxy_get_version((struct wl_proxy *) zxdg_surface_v6), 0, NULL, parent, positioner);
1020
1021 return (struct zxdg_popup_v6 *) id;
1022 }
1023
1024 /**
1025 * @ingroup iface_zxdg_surface_v6
1026 *
1027 * The window geometry of a surface is its "visible bounds" from the
1028 * user's perspective. Client-side decorations often have invisible
1029 * portions like drop-shadows which should be ignored for the
1030 * purposes of aligning, placing and constraining windows.
1031 *
1032 * The window geometry is double buffered, and will be applied at the
1033 * time wl_surface.commit of the corresponding wl_surface is called.
1034 *
1035 * Once the window geometry of the surface is set, it is not possible to
1036 * unset it, and it will remain the same until set_window_geometry is
1037 * called again, even if a new subsurface or buffer is attached.
1038 *
1039 * If never set, the value is the full bounds of the surface,
1040 * including any subsurfaces. This updates dynamically on every
1041 * commit. This unset is meant for extremely simple clients.
1042 *
1043 * The arguments are given in the surface-local coordinate space of
1044 * the wl_surface associated with this xdg_surface.
1045 *
1046 * The width and height must be greater than zero. Setting an invalid size
1047 * will raise an error. When applied, the effective window geometry will be
1048 * the set window geometry clamped to the bounding rectangle of the
1049 * combined geometry of the surface of the xdg_surface and the associated
1050 * subsurfaces.
1051 */
1052 static inline void
zxdg_surface_v6_set_window_geometry(struct zxdg_surface_v6 * zxdg_surface_v6,int32_t x,int32_t y,int32_t width,int32_t height)1053 zxdg_surface_v6_set_window_geometry(struct zxdg_surface_v6 *zxdg_surface_v6, int32_t x, int32_t y, int32_t width, int32_t height)
1054 {
1055 wl_proxy_marshal_flags((struct wl_proxy *) zxdg_surface_v6,
1056 ZXDG_SURFACE_V6_SET_WINDOW_GEOMETRY, NULL, wl_proxy_get_version((struct wl_proxy *) zxdg_surface_v6), 0, x, y, width, height);
1057 }
1058
1059 /**
1060 * @ingroup iface_zxdg_surface_v6
1061 *
1062 * When a configure event is received, if a client commits the
1063 * surface in response to the configure event, then the client
1064 * must make an ack_configure request sometime before the commit
1065 * request, passing along the serial of the configure event.
1066 *
1067 * For instance, for toplevel surfaces the compositor might use this
1068 * information to move a surface to the top left only when the client has
1069 * drawn itself for the maximized or fullscreen state.
1070 *
1071 * If the client receives multiple configure events before it
1072 * can respond to one, it only has to ack the last configure event.
1073 *
1074 * A client is not required to commit immediately after sending
1075 * an ack_configure request - it may even ack_configure several times
1076 * before its next surface commit.
1077 *
1078 * A client may send multiple ack_configure requests before committing, but
1079 * only the last request sent before a commit indicates which configure
1080 * event the client really is responding to.
1081 */
1082 static inline void
zxdg_surface_v6_ack_configure(struct zxdg_surface_v6 * zxdg_surface_v6,uint32_t serial)1083 zxdg_surface_v6_ack_configure(struct zxdg_surface_v6 *zxdg_surface_v6, uint32_t serial)
1084 {
1085 wl_proxy_marshal_flags((struct wl_proxy *) zxdg_surface_v6,
1086 ZXDG_SURFACE_V6_ACK_CONFIGURE, NULL, wl_proxy_get_version((struct wl_proxy *) zxdg_surface_v6), 0, serial);
1087 }
1088
1089 #ifndef ZXDG_TOPLEVEL_V6_RESIZE_EDGE_ENUM
1090 #define ZXDG_TOPLEVEL_V6_RESIZE_EDGE_ENUM
1091 /**
1092 * @ingroup iface_zxdg_toplevel_v6
1093 * edge values for resizing
1094 *
1095 * These values are used to indicate which edge of a surface
1096 * is being dragged in a resize operation.
1097 */
1098 enum zxdg_toplevel_v6_resize_edge {
1099 ZXDG_TOPLEVEL_V6_RESIZE_EDGE_NONE = 0,
1100 ZXDG_TOPLEVEL_V6_RESIZE_EDGE_TOP = 1,
1101 ZXDG_TOPLEVEL_V6_RESIZE_EDGE_BOTTOM = 2,
1102 ZXDG_TOPLEVEL_V6_RESIZE_EDGE_LEFT = 4,
1103 ZXDG_TOPLEVEL_V6_RESIZE_EDGE_TOP_LEFT = 5,
1104 ZXDG_TOPLEVEL_V6_RESIZE_EDGE_BOTTOM_LEFT = 6,
1105 ZXDG_TOPLEVEL_V6_RESIZE_EDGE_RIGHT = 8,
1106 ZXDG_TOPLEVEL_V6_RESIZE_EDGE_TOP_RIGHT = 9,
1107 ZXDG_TOPLEVEL_V6_RESIZE_EDGE_BOTTOM_RIGHT = 10,
1108 };
1109 #endif /* ZXDG_TOPLEVEL_V6_RESIZE_EDGE_ENUM */
1110
1111 #ifndef ZXDG_TOPLEVEL_V6_STATE_ENUM
1112 #define ZXDG_TOPLEVEL_V6_STATE_ENUM
1113 /**
1114 * @ingroup iface_zxdg_toplevel_v6
1115 * types of state on the surface
1116 *
1117 * The different state values used on the surface. This is designed for
1118 * state values like maximized, fullscreen. It is paired with the
1119 * configure event to ensure that both the client and the compositor
1120 * setting the state can be synchronized.
1121 *
1122 * States set in this way are double-buffered. They will get applied on
1123 * the next commit.
1124 */
1125 enum zxdg_toplevel_v6_state {
1126 /**
1127 * the surface is maximized
1128 * the surface is maximized
1129 *
1130 * The surface is maximized. The window geometry specified in the
1131 * configure event must be obeyed by the client.
1132 */
1133 ZXDG_TOPLEVEL_V6_STATE_MAXIMIZED = 1,
1134 /**
1135 * the surface is fullscreen
1136 * the surface is fullscreen
1137 *
1138 * The surface is fullscreen. The window geometry specified in
1139 * the configure event must be obeyed by the client.
1140 */
1141 ZXDG_TOPLEVEL_V6_STATE_FULLSCREEN = 2,
1142 /**
1143 * the surface is being resized
1144 * the surface is being resized
1145 *
1146 * The surface is being resized. The window geometry specified in
1147 * the configure event is a maximum; the client cannot resize
1148 * beyond it. Clients that have aspect ratio or cell sizing
1149 * configuration can use a smaller size, however.
1150 */
1151 ZXDG_TOPLEVEL_V6_STATE_RESIZING = 3,
1152 /**
1153 * the surface is now activated
1154 * the surface is now activated
1155 *
1156 * Client window decorations should be painted as if the window
1157 * is active. Do not assume this means that the window actually has
1158 * keyboard or pointer focus.
1159 */
1160 ZXDG_TOPLEVEL_V6_STATE_ACTIVATED = 4,
1161 };
1162 #endif /* ZXDG_TOPLEVEL_V6_STATE_ENUM */
1163
1164 /**
1165 * @ingroup iface_zxdg_toplevel_v6
1166 * @struct zxdg_toplevel_v6_listener
1167 */
1168 struct zxdg_toplevel_v6_listener {
1169 /**
1170 * suggest a surface change
1171 *
1172 * This configure event asks the client to resize its toplevel
1173 * surface or to change its state. The configured state should not
1174 * be applied immediately. See xdg_surface.configure for details.
1175 *
1176 * The width and height arguments specify a hint to the window
1177 * about how its surface should be resized in window geometry
1178 * coordinates. See set_window_geometry.
1179 *
1180 * If the width or height arguments are zero, it means the client
1181 * should decide its own window dimension. This may happen when the
1182 * compositor needs to configure the state of the surface but
1183 * doesn't have any information about any previous or expected
1184 * dimension.
1185 *
1186 * The states listed in the event specify how the width/height
1187 * arguments should be interpreted, and possibly how it should be
1188 * drawn.
1189 *
1190 * Clients must send an ack_configure in response to this event.
1191 * See xdg_surface.configure and xdg_surface.ack_configure for
1192 * details.
1193 */
1194 void (*configure)(void *data,
1195 struct zxdg_toplevel_v6 *zxdg_toplevel_v6,
1196 int32_t width,
1197 int32_t height,
1198 struct wl_array *states);
1199 /**
1200 * surface wants to be closed
1201 *
1202 * The close event is sent by the compositor when the user wants
1203 * the surface to be closed. This should be equivalent to the user
1204 * clicking the close button in client-side decorations, if your
1205 * application has any.
1206 *
1207 * This is only a request that the user intends to close the
1208 * window. The client may choose to ignore this request, or show a
1209 * dialog to ask the user to save their data, etc.
1210 */
1211 void (*close)(void *data,
1212 struct zxdg_toplevel_v6 *zxdg_toplevel_v6);
1213 };
1214
1215 /**
1216 * @ingroup iface_zxdg_toplevel_v6
1217 */
1218 static inline int
zxdg_toplevel_v6_add_listener(struct zxdg_toplevel_v6 * zxdg_toplevel_v6,const struct zxdg_toplevel_v6_listener * listener,void * data)1219 zxdg_toplevel_v6_add_listener(struct zxdg_toplevel_v6 *zxdg_toplevel_v6,
1220 const struct zxdg_toplevel_v6_listener *listener, void *data)
1221 {
1222 return wl_proxy_add_listener((struct wl_proxy *) zxdg_toplevel_v6,
1223 (void (**)(void)) listener, data);
1224 }
1225
1226 #define ZXDG_TOPLEVEL_V6_DESTROY 0
1227 #define ZXDG_TOPLEVEL_V6_SET_PARENT 1
1228 #define ZXDG_TOPLEVEL_V6_SET_TITLE 2
1229 #define ZXDG_TOPLEVEL_V6_SET_APP_ID 3
1230 #define ZXDG_TOPLEVEL_V6_SHOW_WINDOW_MENU 4
1231 #define ZXDG_TOPLEVEL_V6_MOVE 5
1232 #define ZXDG_TOPLEVEL_V6_RESIZE 6
1233 #define ZXDG_TOPLEVEL_V6_SET_MAX_SIZE 7
1234 #define ZXDG_TOPLEVEL_V6_SET_MIN_SIZE 8
1235 #define ZXDG_TOPLEVEL_V6_SET_MAXIMIZED 9
1236 #define ZXDG_TOPLEVEL_V6_UNSET_MAXIMIZED 10
1237 #define ZXDG_TOPLEVEL_V6_SET_FULLSCREEN 11
1238 #define ZXDG_TOPLEVEL_V6_UNSET_FULLSCREEN 12
1239 #define ZXDG_TOPLEVEL_V6_SET_MINIMIZED 13
1240
1241 /**
1242 * @ingroup iface_zxdg_toplevel_v6
1243 */
1244 #define ZXDG_TOPLEVEL_V6_CONFIGURE_SINCE_VERSION 1
1245 /**
1246 * @ingroup iface_zxdg_toplevel_v6
1247 */
1248 #define ZXDG_TOPLEVEL_V6_CLOSE_SINCE_VERSION 1
1249
1250 /**
1251 * @ingroup iface_zxdg_toplevel_v6
1252 */
1253 #define ZXDG_TOPLEVEL_V6_DESTROY_SINCE_VERSION 1
1254 /**
1255 * @ingroup iface_zxdg_toplevel_v6
1256 */
1257 #define ZXDG_TOPLEVEL_V6_SET_PARENT_SINCE_VERSION 1
1258 /**
1259 * @ingroup iface_zxdg_toplevel_v6
1260 */
1261 #define ZXDG_TOPLEVEL_V6_SET_TITLE_SINCE_VERSION 1
1262 /**
1263 * @ingroup iface_zxdg_toplevel_v6
1264 */
1265 #define ZXDG_TOPLEVEL_V6_SET_APP_ID_SINCE_VERSION 1
1266 /**
1267 * @ingroup iface_zxdg_toplevel_v6
1268 */
1269 #define ZXDG_TOPLEVEL_V6_SHOW_WINDOW_MENU_SINCE_VERSION 1
1270 /**
1271 * @ingroup iface_zxdg_toplevel_v6
1272 */
1273 #define ZXDG_TOPLEVEL_V6_MOVE_SINCE_VERSION 1
1274 /**
1275 * @ingroup iface_zxdg_toplevel_v6
1276 */
1277 #define ZXDG_TOPLEVEL_V6_RESIZE_SINCE_VERSION 1
1278 /**
1279 * @ingroup iface_zxdg_toplevel_v6
1280 */
1281 #define ZXDG_TOPLEVEL_V6_SET_MAX_SIZE_SINCE_VERSION 1
1282 /**
1283 * @ingroup iface_zxdg_toplevel_v6
1284 */
1285 #define ZXDG_TOPLEVEL_V6_SET_MIN_SIZE_SINCE_VERSION 1
1286 /**
1287 * @ingroup iface_zxdg_toplevel_v6
1288 */
1289 #define ZXDG_TOPLEVEL_V6_SET_MAXIMIZED_SINCE_VERSION 1
1290 /**
1291 * @ingroup iface_zxdg_toplevel_v6
1292 */
1293 #define ZXDG_TOPLEVEL_V6_UNSET_MAXIMIZED_SINCE_VERSION 1
1294 /**
1295 * @ingroup iface_zxdg_toplevel_v6
1296 */
1297 #define ZXDG_TOPLEVEL_V6_SET_FULLSCREEN_SINCE_VERSION 1
1298 /**
1299 * @ingroup iface_zxdg_toplevel_v6
1300 */
1301 #define ZXDG_TOPLEVEL_V6_UNSET_FULLSCREEN_SINCE_VERSION 1
1302 /**
1303 * @ingroup iface_zxdg_toplevel_v6
1304 */
1305 #define ZXDG_TOPLEVEL_V6_SET_MINIMIZED_SINCE_VERSION 1
1306
1307 /** @ingroup iface_zxdg_toplevel_v6 */
1308 static inline void
zxdg_toplevel_v6_set_user_data(struct zxdg_toplevel_v6 * zxdg_toplevel_v6,void * user_data)1309 zxdg_toplevel_v6_set_user_data(struct zxdg_toplevel_v6 *zxdg_toplevel_v6, void *user_data)
1310 {
1311 wl_proxy_set_user_data((struct wl_proxy *) zxdg_toplevel_v6, user_data);
1312 }
1313
1314 /** @ingroup iface_zxdg_toplevel_v6 */
1315 static inline void *
zxdg_toplevel_v6_get_user_data(struct zxdg_toplevel_v6 * zxdg_toplevel_v6)1316 zxdg_toplevel_v6_get_user_data(struct zxdg_toplevel_v6 *zxdg_toplevel_v6)
1317 {
1318 return wl_proxy_get_user_data((struct wl_proxy *) zxdg_toplevel_v6);
1319 }
1320
1321 static inline uint32_t
zxdg_toplevel_v6_get_version(struct zxdg_toplevel_v6 * zxdg_toplevel_v6)1322 zxdg_toplevel_v6_get_version(struct zxdg_toplevel_v6 *zxdg_toplevel_v6)
1323 {
1324 return wl_proxy_get_version((struct wl_proxy *) zxdg_toplevel_v6);
1325 }
1326
1327 /**
1328 * @ingroup iface_zxdg_toplevel_v6
1329 *
1330 * Unmap and destroy the window. The window will be effectively
1331 * hidden from the user's point of view, and all state like
1332 * maximization, fullscreen, and so on, will be lost.
1333 */
1334 static inline void
zxdg_toplevel_v6_destroy(struct zxdg_toplevel_v6 * zxdg_toplevel_v6)1335 zxdg_toplevel_v6_destroy(struct zxdg_toplevel_v6 *zxdg_toplevel_v6)
1336 {
1337 wl_proxy_marshal_flags((struct wl_proxy *) zxdg_toplevel_v6,
1338 ZXDG_TOPLEVEL_V6_DESTROY, NULL, wl_proxy_get_version((struct wl_proxy *) zxdg_toplevel_v6), WL_MARSHAL_FLAG_DESTROY);
1339 }
1340
1341 /**
1342 * @ingroup iface_zxdg_toplevel_v6
1343 *
1344 * Set the "parent" of this surface. This window should be stacked
1345 * above a parent. The parent surface must be mapped as long as this
1346 * surface is mapped.
1347 *
1348 * Parent windows should be set on dialogs, toolboxes, or other
1349 * "auxiliary" surfaces, so that the parent is raised when the dialog
1350 * is raised.
1351 */
1352 static inline void
zxdg_toplevel_v6_set_parent(struct zxdg_toplevel_v6 * zxdg_toplevel_v6,struct zxdg_toplevel_v6 * parent)1353 zxdg_toplevel_v6_set_parent(struct zxdg_toplevel_v6 *zxdg_toplevel_v6, struct zxdg_toplevel_v6 *parent)
1354 {
1355 wl_proxy_marshal_flags((struct wl_proxy *) zxdg_toplevel_v6,
1356 ZXDG_TOPLEVEL_V6_SET_PARENT, NULL, wl_proxy_get_version((struct wl_proxy *) zxdg_toplevel_v6), 0, parent);
1357 }
1358
1359 /**
1360 * @ingroup iface_zxdg_toplevel_v6
1361 *
1362 * Set a short title for the surface.
1363 *
1364 * This string may be used to identify the surface in a task bar,
1365 * window list, or other user interface elements provided by the
1366 * compositor.
1367 *
1368 * The string must be encoded in UTF-8.
1369 */
1370 static inline void
zxdg_toplevel_v6_set_title(struct zxdg_toplevel_v6 * zxdg_toplevel_v6,const char * title)1371 zxdg_toplevel_v6_set_title(struct zxdg_toplevel_v6 *zxdg_toplevel_v6, const char *title)
1372 {
1373 wl_proxy_marshal_flags((struct wl_proxy *) zxdg_toplevel_v6,
1374 ZXDG_TOPLEVEL_V6_SET_TITLE, NULL, wl_proxy_get_version((struct wl_proxy *) zxdg_toplevel_v6), 0, title);
1375 }
1376
1377 /**
1378 * @ingroup iface_zxdg_toplevel_v6
1379 *
1380 * Set an application identifier for the surface.
1381 *
1382 * The app ID identifies the general class of applications to which
1383 * the surface belongs. The compositor can use this to group multiple
1384 * surfaces together, or to determine how to launch a new application.
1385 *
1386 * For D-Bus activatable applications, the app ID is used as the D-Bus
1387 * service name.
1388 *
1389 * The compositor shell will try to group application surfaces together
1390 * by their app ID. As a best practice, it is suggested to select app
1391 * ID's that match the basename of the application's .desktop file.
1392 * For example, "org.freedesktop.FooViewer" where the .desktop file is
1393 * "org.freedesktop.FooViewer.desktop".
1394 *
1395 * See the desktop-entry specification [0] for more details on
1396 * application identifiers and how they relate to well-known D-Bus
1397 * names and .desktop files.
1398 *
1399 * [0] http://standards.freedesktop.org/desktop-entry-spec/
1400 */
1401 static inline void
zxdg_toplevel_v6_set_app_id(struct zxdg_toplevel_v6 * zxdg_toplevel_v6,const char * app_id)1402 zxdg_toplevel_v6_set_app_id(struct zxdg_toplevel_v6 *zxdg_toplevel_v6, const char *app_id)
1403 {
1404 wl_proxy_marshal_flags((struct wl_proxy *) zxdg_toplevel_v6,
1405 ZXDG_TOPLEVEL_V6_SET_APP_ID, NULL, wl_proxy_get_version((struct wl_proxy *) zxdg_toplevel_v6), 0, app_id);
1406 }
1407
1408 /**
1409 * @ingroup iface_zxdg_toplevel_v6
1410 *
1411 * Clients implementing client-side decorations might want to show
1412 * a context menu when right-clicking on the decorations, giving the
1413 * user a menu that they can use to maximize or minimize the window.
1414 *
1415 * This request asks the compositor to pop up such a window menu at
1416 * the given position, relative to the local surface coordinates of
1417 * the parent surface. There are no guarantees as to what menu items
1418 * the window menu contains.
1419 *
1420 * This request must be used in response to some sort of user action
1421 * like a button press, key press, or touch down event.
1422 */
1423 static inline void
zxdg_toplevel_v6_show_window_menu(struct zxdg_toplevel_v6 * zxdg_toplevel_v6,struct wl_seat * seat,uint32_t serial,int32_t x,int32_t y)1424 zxdg_toplevel_v6_show_window_menu(struct zxdg_toplevel_v6 *zxdg_toplevel_v6, struct wl_seat *seat, uint32_t serial, int32_t x, int32_t y)
1425 {
1426 wl_proxy_marshal_flags((struct wl_proxy *) zxdg_toplevel_v6,
1427 ZXDG_TOPLEVEL_V6_SHOW_WINDOW_MENU, NULL, wl_proxy_get_version((struct wl_proxy *) zxdg_toplevel_v6), 0, seat, serial, x, y);
1428 }
1429
1430 /**
1431 * @ingroup iface_zxdg_toplevel_v6
1432 *
1433 * Start an interactive, user-driven move of the surface.
1434 *
1435 * This request must be used in response to some sort of user action
1436 * like a button press, key press, or touch down event. The passed
1437 * serial is used to determine the type of interactive move (touch,
1438 * pointer, etc).
1439 *
1440 * The server may ignore move requests depending on the state of
1441 * the surface (e.g. fullscreen or maximized), or if the passed serial
1442 * is no longer valid.
1443 *
1444 * If triggered, the surface will lose the focus of the device
1445 * (wl_pointer, wl_touch, etc) used for the move. It is up to the
1446 * compositor to visually indicate that the move is taking place, such as
1447 * updating a pointer cursor, during the move. There is no guarantee
1448 * that the device focus will return when the move is completed.
1449 */
1450 static inline void
zxdg_toplevel_v6_move(struct zxdg_toplevel_v6 * zxdg_toplevel_v6,struct wl_seat * seat,uint32_t serial)1451 zxdg_toplevel_v6_move(struct zxdg_toplevel_v6 *zxdg_toplevel_v6, struct wl_seat *seat, uint32_t serial)
1452 {
1453 wl_proxy_marshal_flags((struct wl_proxy *) zxdg_toplevel_v6,
1454 ZXDG_TOPLEVEL_V6_MOVE, NULL, wl_proxy_get_version((struct wl_proxy *) zxdg_toplevel_v6), 0, seat, serial);
1455 }
1456
1457 /**
1458 * @ingroup iface_zxdg_toplevel_v6
1459 *
1460 * Start a user-driven, interactive resize of the surface.
1461 *
1462 * This request must be used in response to some sort of user action
1463 * like a button press, key press, or touch down event. The passed
1464 * serial is used to determine the type of interactive resize (touch,
1465 * pointer, etc).
1466 *
1467 * The server may ignore resize requests depending on the state of
1468 * the surface (e.g. fullscreen or maximized).
1469 *
1470 * If triggered, the client will receive configure events with the
1471 * "resize" state enum value and the expected sizes. See the "resize"
1472 * enum value for more details about what is required. The client
1473 * must also acknowledge configure events using "ack_configure". After
1474 * the resize is completed, the client will receive another "configure"
1475 * event without the resize state.
1476 *
1477 * If triggered, the surface also will lose the focus of the device
1478 * (wl_pointer, wl_touch, etc) used for the resize. It is up to the
1479 * compositor to visually indicate that the resize is taking place,
1480 * such as updating a pointer cursor, during the resize. There is no
1481 * guarantee that the device focus will return when the resize is
1482 * completed.
1483 *
1484 * The edges parameter specifies how the surface should be resized,
1485 * and is one of the values of the resize_edge enum. The compositor
1486 * may use this information to update the surface position for
1487 * example when dragging the top left corner. The compositor may also
1488 * use this information to adapt its behavior, e.g. choose an
1489 * appropriate cursor image.
1490 */
1491 static inline void
zxdg_toplevel_v6_resize(struct zxdg_toplevel_v6 * zxdg_toplevel_v6,struct wl_seat * seat,uint32_t serial,uint32_t edges)1492 zxdg_toplevel_v6_resize(struct zxdg_toplevel_v6 *zxdg_toplevel_v6, struct wl_seat *seat, uint32_t serial, uint32_t edges)
1493 {
1494 wl_proxy_marshal_flags((struct wl_proxy *) zxdg_toplevel_v6,
1495 ZXDG_TOPLEVEL_V6_RESIZE, NULL, wl_proxy_get_version((struct wl_proxy *) zxdg_toplevel_v6), 0, seat, serial, edges);
1496 }
1497
1498 /**
1499 * @ingroup iface_zxdg_toplevel_v6
1500 *
1501 * Set a maximum size for the window.
1502 *
1503 * The client can specify a maximum size so that the compositor does
1504 * not try to configure the window beyond this size.
1505 *
1506 * The width and height arguments are in window geometry coordinates.
1507 * See xdg_surface.set_window_geometry.
1508 *
1509 * Values set in this way are double-buffered. They will get applied
1510 * on the next commit.
1511 *
1512 * The compositor can use this information to allow or disallow
1513 * different states like maximize or fullscreen and draw accurate
1514 * animations.
1515 *
1516 * Similarly, a tiling window manager may use this information to
1517 * place and resize client windows in a more effective way.
1518 *
1519 * The client should not rely on the compositor to obey the maximum
1520 * size. The compositor may decide to ignore the values set by the
1521 * client and request a larger size.
1522 *
1523 * If never set, or a value of zero in the request, means that the
1524 * client has no expected maximum size in the given dimension.
1525 * As a result, a client wishing to reset the maximum size
1526 * to an unspecified state can use zero for width and height in the
1527 * request.
1528 *
1529 * Requesting a maximum size to be smaller than the minimum size of
1530 * a surface is illegal and will result in a protocol error.
1531 *
1532 * The width and height must be greater than or equal to zero. Using
1533 * strictly negative values for width and height will result in a
1534 * protocol error.
1535 */
1536 static inline void
zxdg_toplevel_v6_set_max_size(struct zxdg_toplevel_v6 * zxdg_toplevel_v6,int32_t width,int32_t height)1537 zxdg_toplevel_v6_set_max_size(struct zxdg_toplevel_v6 *zxdg_toplevel_v6, int32_t width, int32_t height)
1538 {
1539 wl_proxy_marshal_flags((struct wl_proxy *) zxdg_toplevel_v6,
1540 ZXDG_TOPLEVEL_V6_SET_MAX_SIZE, NULL, wl_proxy_get_version((struct wl_proxy *) zxdg_toplevel_v6), 0, width, height);
1541 }
1542
1543 /**
1544 * @ingroup iface_zxdg_toplevel_v6
1545 *
1546 * Set a minimum size for the window.
1547 *
1548 * The client can specify a minimum size so that the compositor does
1549 * not try to configure the window below this size.
1550 *
1551 * The width and height arguments are in window geometry coordinates.
1552 * See xdg_surface.set_window_geometry.
1553 *
1554 * Values set in this way are double-buffered. They will get applied
1555 * on the next commit.
1556 *
1557 * The compositor can use this information to allow or disallow
1558 * different states like maximize or fullscreen and draw accurate
1559 * animations.
1560 *
1561 * Similarly, a tiling window manager may use this information to
1562 * place and resize client windows in a more effective way.
1563 *
1564 * The client should not rely on the compositor to obey the minimum
1565 * size. The compositor may decide to ignore the values set by the
1566 * client and request a smaller size.
1567 *
1568 * If never set, or a value of zero in the request, means that the
1569 * client has no expected minimum size in the given dimension.
1570 * As a result, a client wishing to reset the minimum size
1571 * to an unspecified state can use zero for width and height in the
1572 * request.
1573 *
1574 * Requesting a minimum size to be larger than the maximum size of
1575 * a surface is illegal and will result in a protocol error.
1576 *
1577 * The width and height must be greater than or equal to zero. Using
1578 * strictly negative values for width and height will result in a
1579 * protocol error.
1580 */
1581 static inline void
zxdg_toplevel_v6_set_min_size(struct zxdg_toplevel_v6 * zxdg_toplevel_v6,int32_t width,int32_t height)1582 zxdg_toplevel_v6_set_min_size(struct zxdg_toplevel_v6 *zxdg_toplevel_v6, int32_t width, int32_t height)
1583 {
1584 wl_proxy_marshal_flags((struct wl_proxy *) zxdg_toplevel_v6,
1585 ZXDG_TOPLEVEL_V6_SET_MIN_SIZE, NULL, wl_proxy_get_version((struct wl_proxy *) zxdg_toplevel_v6), 0, width, height);
1586 }
1587
1588 /**
1589 * @ingroup iface_zxdg_toplevel_v6
1590 *
1591 * Maximize the surface.
1592 *
1593 * After requesting that the surface should be maximized, the compositor
1594 * will respond by emitting a configure event with the "maximized" state
1595 * and the required window geometry. The client should then update its
1596 * content, drawing it in a maximized state, i.e. without shadow or other
1597 * decoration outside of the window geometry. The client must also
1598 * acknowledge the configure when committing the new content (see
1599 * ack_configure).
1600 *
1601 * It is up to the compositor to decide how and where to maximize the
1602 * surface, for example which output and what region of the screen should
1603 * be used.
1604 *
1605 * If the surface was already maximized, the compositor will still emit
1606 * a configure event with the "maximized" state.
1607 */
1608 static inline void
zxdg_toplevel_v6_set_maximized(struct zxdg_toplevel_v6 * zxdg_toplevel_v6)1609 zxdg_toplevel_v6_set_maximized(struct zxdg_toplevel_v6 *zxdg_toplevel_v6)
1610 {
1611 wl_proxy_marshal_flags((struct wl_proxy *) zxdg_toplevel_v6,
1612 ZXDG_TOPLEVEL_V6_SET_MAXIMIZED, NULL, wl_proxy_get_version((struct wl_proxy *) zxdg_toplevel_v6), 0);
1613 }
1614
1615 /**
1616 * @ingroup iface_zxdg_toplevel_v6
1617 *
1618 * Unmaximize the surface.
1619 *
1620 * After requesting that the surface should be unmaximized, the compositor
1621 * will respond by emitting a configure event without the "maximized"
1622 * state. If available, the compositor will include the window geometry
1623 * dimensions the window had prior to being maximized in the configure
1624 * request. The client must then update its content, drawing it in a
1625 * regular state, i.e. potentially with shadow, etc. The client must also
1626 * acknowledge the configure when committing the new content (see
1627 * ack_configure).
1628 *
1629 * It is up to the compositor to position the surface after it was
1630 * unmaximized; usually the position the surface had before maximizing, if
1631 * applicable.
1632 *
1633 * If the surface was already not maximized, the compositor will still
1634 * emit a configure event without the "maximized" state.
1635 */
1636 static inline void
zxdg_toplevel_v6_unset_maximized(struct zxdg_toplevel_v6 * zxdg_toplevel_v6)1637 zxdg_toplevel_v6_unset_maximized(struct zxdg_toplevel_v6 *zxdg_toplevel_v6)
1638 {
1639 wl_proxy_marshal_flags((struct wl_proxy *) zxdg_toplevel_v6,
1640 ZXDG_TOPLEVEL_V6_UNSET_MAXIMIZED, NULL, wl_proxy_get_version((struct wl_proxy *) zxdg_toplevel_v6), 0);
1641 }
1642
1643 /**
1644 * @ingroup iface_zxdg_toplevel_v6
1645 *
1646 * Make the surface fullscreen.
1647 *
1648 * You can specify an output that you would prefer to be fullscreen.
1649 * If this value is NULL, it's up to the compositor to choose which
1650 * display will be used to map this surface.
1651 *
1652 * If the surface doesn't cover the whole output, the compositor will
1653 * position the surface in the center of the output and compensate with
1654 * black borders filling the rest of the output.
1655 */
1656 static inline void
zxdg_toplevel_v6_set_fullscreen(struct zxdg_toplevel_v6 * zxdg_toplevel_v6,struct wl_output * output)1657 zxdg_toplevel_v6_set_fullscreen(struct zxdg_toplevel_v6 *zxdg_toplevel_v6, struct wl_output *output)
1658 {
1659 wl_proxy_marshal_flags((struct wl_proxy *) zxdg_toplevel_v6,
1660 ZXDG_TOPLEVEL_V6_SET_FULLSCREEN, NULL, wl_proxy_get_version((struct wl_proxy *) zxdg_toplevel_v6), 0, output);
1661 }
1662
1663 /**
1664 * @ingroup iface_zxdg_toplevel_v6
1665 */
1666 static inline void
zxdg_toplevel_v6_unset_fullscreen(struct zxdg_toplevel_v6 * zxdg_toplevel_v6)1667 zxdg_toplevel_v6_unset_fullscreen(struct zxdg_toplevel_v6 *zxdg_toplevel_v6)
1668 {
1669 wl_proxy_marshal_flags((struct wl_proxy *) zxdg_toplevel_v6,
1670 ZXDG_TOPLEVEL_V6_UNSET_FULLSCREEN, NULL, wl_proxy_get_version((struct wl_proxy *) zxdg_toplevel_v6), 0);
1671 }
1672
1673 /**
1674 * @ingroup iface_zxdg_toplevel_v6
1675 *
1676 * Request that the compositor minimize your surface. There is no
1677 * way to know if the surface is currently minimized, nor is there
1678 * any way to unset minimization on this surface.
1679 *
1680 * If you are looking to throttle redrawing when minimized, please
1681 * instead use the wl_surface.frame event for this, as this will
1682 * also work with live previews on windows in Alt-Tab, Expose or
1683 * similar compositor features.
1684 */
1685 static inline void
zxdg_toplevel_v6_set_minimized(struct zxdg_toplevel_v6 * zxdg_toplevel_v6)1686 zxdg_toplevel_v6_set_minimized(struct zxdg_toplevel_v6 *zxdg_toplevel_v6)
1687 {
1688 wl_proxy_marshal_flags((struct wl_proxy *) zxdg_toplevel_v6,
1689 ZXDG_TOPLEVEL_V6_SET_MINIMIZED, NULL, wl_proxy_get_version((struct wl_proxy *) zxdg_toplevel_v6), 0);
1690 }
1691
1692 #ifndef ZXDG_POPUP_V6_ERROR_ENUM
1693 #define ZXDG_POPUP_V6_ERROR_ENUM
1694 enum zxdg_popup_v6_error {
1695 /**
1696 * tried to grab after being mapped
1697 */
1698 ZXDG_POPUP_V6_ERROR_INVALID_GRAB = 0,
1699 };
1700 #endif /* ZXDG_POPUP_V6_ERROR_ENUM */
1701
1702 /**
1703 * @ingroup iface_zxdg_popup_v6
1704 * @struct zxdg_popup_v6_listener
1705 */
1706 struct zxdg_popup_v6_listener {
1707 /**
1708 * configure the popup surface
1709 *
1710 * This event asks the popup surface to configure itself given
1711 * the configuration. The configured state should not be applied
1712 * immediately. See xdg_surface.configure for details.
1713 *
1714 * The x and y arguments represent the position the popup was
1715 * placed at given the xdg_positioner rule, relative to the upper
1716 * left corner of the window geometry of the parent surface.
1717 * @param x x position relative to parent surface window geometry
1718 * @param y y position relative to parent surface window geometry
1719 * @param width window geometry width
1720 * @param height window geometry height
1721 */
1722 void (*configure)(void *data,
1723 struct zxdg_popup_v6 *zxdg_popup_v6,
1724 int32_t x,
1725 int32_t y,
1726 int32_t width,
1727 int32_t height);
1728 /**
1729 * popup interaction is done
1730 *
1731 * The popup_done event is sent out when a popup is dismissed by
1732 * the compositor. The client should destroy the xdg_popup object
1733 * at this point.
1734 */
1735 void (*popup_done)(void *data,
1736 struct zxdg_popup_v6 *zxdg_popup_v6);
1737 };
1738
1739 /**
1740 * @ingroup iface_zxdg_popup_v6
1741 */
1742 static inline int
zxdg_popup_v6_add_listener(struct zxdg_popup_v6 * zxdg_popup_v6,const struct zxdg_popup_v6_listener * listener,void * data)1743 zxdg_popup_v6_add_listener(struct zxdg_popup_v6 *zxdg_popup_v6,
1744 const struct zxdg_popup_v6_listener *listener, void *data)
1745 {
1746 return wl_proxy_add_listener((struct wl_proxy *) zxdg_popup_v6,
1747 (void (**)(void)) listener, data);
1748 }
1749
1750 #define ZXDG_POPUP_V6_DESTROY 0
1751 #define ZXDG_POPUP_V6_GRAB 1
1752
1753 /**
1754 * @ingroup iface_zxdg_popup_v6
1755 */
1756 #define ZXDG_POPUP_V6_CONFIGURE_SINCE_VERSION 1
1757 /**
1758 * @ingroup iface_zxdg_popup_v6
1759 */
1760 #define ZXDG_POPUP_V6_POPUP_DONE_SINCE_VERSION 1
1761
1762 /**
1763 * @ingroup iface_zxdg_popup_v6
1764 */
1765 #define ZXDG_POPUP_V6_DESTROY_SINCE_VERSION 1
1766 /**
1767 * @ingroup iface_zxdg_popup_v6
1768 */
1769 #define ZXDG_POPUP_V6_GRAB_SINCE_VERSION 1
1770
1771 /** @ingroup iface_zxdg_popup_v6 */
1772 static inline void
zxdg_popup_v6_set_user_data(struct zxdg_popup_v6 * zxdg_popup_v6,void * user_data)1773 zxdg_popup_v6_set_user_data(struct zxdg_popup_v6 *zxdg_popup_v6, void *user_data)
1774 {
1775 wl_proxy_set_user_data((struct wl_proxy *) zxdg_popup_v6, user_data);
1776 }
1777
1778 /** @ingroup iface_zxdg_popup_v6 */
1779 static inline void *
zxdg_popup_v6_get_user_data(struct zxdg_popup_v6 * zxdg_popup_v6)1780 zxdg_popup_v6_get_user_data(struct zxdg_popup_v6 *zxdg_popup_v6)
1781 {
1782 return wl_proxy_get_user_data((struct wl_proxy *) zxdg_popup_v6);
1783 }
1784
1785 static inline uint32_t
zxdg_popup_v6_get_version(struct zxdg_popup_v6 * zxdg_popup_v6)1786 zxdg_popup_v6_get_version(struct zxdg_popup_v6 *zxdg_popup_v6)
1787 {
1788 return wl_proxy_get_version((struct wl_proxy *) zxdg_popup_v6);
1789 }
1790
1791 /**
1792 * @ingroup iface_zxdg_popup_v6
1793 *
1794 * This destroys the popup. Explicitly destroying the xdg_popup
1795 * object will also dismiss the popup, and unmap the surface.
1796 *
1797 * If this xdg_popup is not the "topmost" popup, a protocol error
1798 * will be sent.
1799 */
1800 static inline void
zxdg_popup_v6_destroy(struct zxdg_popup_v6 * zxdg_popup_v6)1801 zxdg_popup_v6_destroy(struct zxdg_popup_v6 *zxdg_popup_v6)
1802 {
1803 wl_proxy_marshal_flags((struct wl_proxy *) zxdg_popup_v6,
1804 ZXDG_POPUP_V6_DESTROY, NULL, wl_proxy_get_version((struct wl_proxy *) zxdg_popup_v6), WL_MARSHAL_FLAG_DESTROY);
1805 }
1806
1807 /**
1808 * @ingroup iface_zxdg_popup_v6
1809 *
1810 * This request makes the created popup take an explicit grab. An explicit
1811 * grab will be dismissed when the user dismisses the popup, or when the
1812 * client destroys the xdg_popup. This can be done by the user clicking
1813 * outside the surface, using the keyboard, or even locking the screen
1814 * through closing the lid or a timeout.
1815 *
1816 * If the compositor denies the grab, the popup will be immediately
1817 * dismissed.
1818 *
1819 * This request must be used in response to some sort of user action like a
1820 * button press, key press, or touch down event. The serial number of the
1821 * event should be passed as 'serial'.
1822 *
1823 * The parent of a grabbing popup must either be an xdg_toplevel surface or
1824 * another xdg_popup with an explicit grab. If the parent is another
1825 * xdg_popup it means that the popups are nested, with this popup now being
1826 * the topmost popup.
1827 *
1828 * Nested popups must be destroyed in the reverse order they were created
1829 * in, e.g. the only popup you are allowed to destroy at all times is the
1830 * topmost one.
1831 *
1832 * When compositors choose to dismiss a popup, they may dismiss every
1833 * nested grabbing popup as well. When a compositor dismisses popups, it
1834 * will follow the same dismissing order as required from the client.
1835 *
1836 * The parent of a grabbing popup must either be another xdg_popup with an
1837 * active explicit grab, or an xdg_popup or xdg_toplevel, if there are no
1838 * explicit grabs already taken.
1839 *
1840 * If the topmost grabbing popup is destroyed, the grab will be returned to
1841 * the parent of the popup, if that parent previously had an explicit grab.
1842 *
1843 * If the parent is a grabbing popup which has already been dismissed, this
1844 * popup will be immediately dismissed. If the parent is a popup that did
1845 * not take an explicit grab, an error will be raised.
1846 *
1847 * During a popup grab, the client owning the grab will receive pointer
1848 * and touch events for all their surfaces as normal (similar to an
1849 * "owner-events" grab in X11 parlance), while the top most grabbing popup
1850 * will always have keyboard focus.
1851 */
1852 static inline void
zxdg_popup_v6_grab(struct zxdg_popup_v6 * zxdg_popup_v6,struct wl_seat * seat,uint32_t serial)1853 zxdg_popup_v6_grab(struct zxdg_popup_v6 *zxdg_popup_v6, struct wl_seat *seat, uint32_t serial)
1854 {
1855 wl_proxy_marshal_flags((struct wl_proxy *) zxdg_popup_v6,
1856 ZXDG_POPUP_V6_GRAB, NULL, wl_proxy_get_version((struct wl_proxy *) zxdg_popup_v6), 0, seat, serial);
1857 }
1858
1859 #ifdef __cplusplus
1860 }
1861 #endif
1862
1863 #endif
1864