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