zorldo

Goofing around with Ebiten
git clone git://bsandro.tech/zorldo
Log | Files | Refs | README

wayland-xdg-shell-client-protocol.h (68719B)


      1 /* Generated by wayland-scanner */
      2 
      3 #ifndef XDG_SHELL_CLIENT_PROTOCOL_H
      4 #define XDG_SHELL_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 The xdg_shell protocol
     16  * @section page_ifaces_xdg_shell Interfaces
     17  * - @subpage page_iface_xdg_wm_base - create desktop-style surfaces
     18  * - @subpage page_iface_xdg_positioner - child surface positioner
     19  * - @subpage page_iface_xdg_surface - desktop user interface surface base interface
     20  * - @subpage page_iface_xdg_toplevel - toplevel surface
     21  * - @subpage page_iface_xdg_popup - short-lived, popup surfaces for menus
     22  * @section page_copyright_xdg_shell 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  * Copyright © 2015-2017 Samsung Electronics Co., Ltd
     30  * Copyright © 2015-2017 Red Hat Inc.
     31  *
     32  * Permission is hereby granted, free of charge, to any person obtaining a
     33  * copy of this software and associated documentation files (the "Software"),
     34  * to deal in the Software without restriction, including without limitation
     35  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
     36  * and/or sell copies of the Software, and to permit persons to whom the
     37  * Software is furnished to do so, subject to the following conditions:
     38  *
     39  * The above copyright notice and this permission notice (including the next
     40  * paragraph) shall be included in all copies or substantial portions of the
     41  * Software.
     42  *
     43  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
     44  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
     45  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
     46  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
     47  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
     48  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
     49  * DEALINGS IN THE SOFTWARE.
     50  * </pre>
     51  */
     52 struct wl_output;
     53 struct wl_seat;
     54 struct wl_surface;
     55 struct xdg_popup;
     56 struct xdg_positioner;
     57 struct xdg_surface;
     58 struct xdg_toplevel;
     59 struct xdg_wm_base;
     60 
     61 /**
     62  * @page page_iface_xdg_wm_base xdg_wm_base
     63  * @section page_iface_xdg_wm_base_desc Description
     64  *
     65  * The xdg_wm_base interface is exposed as a global object enabling clients
     66  * to turn their wl_surfaces into windows in a desktop environment. It
     67  * defines the basic functionality needed for clients and the compositor to
     68  * create windows that can be dragged, resized, maximized, etc, as well as
     69  * creating transient windows such as popup menus.
     70  * @section page_iface_xdg_wm_base_api API
     71  * See @ref iface_xdg_wm_base.
     72  */
     73 /**
     74  * @defgroup iface_xdg_wm_base The xdg_wm_base interface
     75  *
     76  * The xdg_wm_base interface is exposed as a global object enabling clients
     77  * to turn their wl_surfaces into windows in a desktop environment. It
     78  * defines the basic functionality needed for clients and the compositor to
     79  * create windows that can be dragged, resized, maximized, etc, as well as
     80  * creating transient windows such as popup menus.
     81  */
     82 extern const struct wl_interface xdg_wm_base_interface;
     83 /**
     84  * @page page_iface_xdg_positioner xdg_positioner
     85  * @section page_iface_xdg_positioner_desc Description
     86  *
     87  * The xdg_positioner provides a collection of rules for the placement of a
     88  * child surface relative to a parent surface. Rules can be defined to ensure
     89  * the child surface remains within the visible area's borders, and to
     90  * specify how the child surface changes its position, such as sliding along
     91  * an axis, or flipping around a rectangle. These positioner-created rules are
     92  * constrained by the requirement that a child surface must intersect with or
     93  * be at least partially adjacent to its parent surface.
     94  *
     95  * See the various requests for details about possible rules.
     96  *
     97  * At the time of the request, the compositor makes a copy of the rules
     98  * specified by the xdg_positioner. Thus, after the request is complete the
     99  * xdg_positioner object can be destroyed or reused; further changes to the
    100  * object will have no effect on previous usages.
    101  *
    102  * For an xdg_positioner object to be considered complete, it must have a
    103  * non-zero size set by set_size, and a non-zero anchor rectangle set by
    104  * set_anchor_rect. Passing an incomplete xdg_positioner object when
    105  * positioning a surface raises an error.
    106  * @section page_iface_xdg_positioner_api API
    107  * See @ref iface_xdg_positioner.
    108  */
    109 /**
    110  * @defgroup iface_xdg_positioner The xdg_positioner interface
    111  *
    112  * The xdg_positioner provides a collection of rules for the placement of a
    113  * child surface relative to a parent surface. Rules can be defined to ensure
    114  * the child surface remains within the visible area's borders, and to
    115  * specify how the child surface changes its position, such as sliding along
    116  * an axis, or flipping around a rectangle. These positioner-created rules are
    117  * constrained by the requirement that a child surface must intersect with or
    118  * be at least partially adjacent to its parent surface.
    119  *
    120  * See the various requests for details about possible rules.
    121  *
    122  * At the time of the request, the compositor makes a copy of the rules
    123  * specified by the xdg_positioner. Thus, after the request is complete the
    124  * xdg_positioner object can be destroyed or reused; further changes to the
    125  * object will have no effect on previous usages.
    126  *
    127  * For an xdg_positioner object to be considered complete, it must have a
    128  * non-zero size set by set_size, and a non-zero anchor rectangle set by
    129  * set_anchor_rect. Passing an incomplete xdg_positioner object when
    130  * positioning a surface raises an error.
    131  */
    132 extern const struct wl_interface xdg_positioner_interface;
    133 /**
    134  * @page page_iface_xdg_surface xdg_surface
    135  * @section page_iface_xdg_surface_desc Description
    136  *
    137  * An interface that may be implemented by a wl_surface, for
    138  * implementations that provide a desktop-style user interface.
    139  *
    140  * It provides a base set of functionality required to construct user
    141  * interface elements requiring management by the compositor, such as
    142  * toplevel windows, menus, etc. The types of functionality are split into
    143  * xdg_surface roles.
    144  *
    145  * Creating an xdg_surface does not set the role for a wl_surface. In order
    146  * to map an xdg_surface, the client must create a role-specific object
    147  * using, e.g., get_toplevel, get_popup. The wl_surface for any given
    148  * xdg_surface can have at most one role, and may not be assigned any role
    149  * not based on xdg_surface.
    150  *
    151  * A role must be assigned before any other requests are made to the
    152  * xdg_surface object.
    153  *
    154  * The client must call wl_surface.commit on the corresponding wl_surface
    155  * for the xdg_surface state to take effect.
    156  *
    157  * Creating an xdg_surface from a wl_surface which has a buffer attached or
    158  * committed is a client error, and any attempts by a client to attach or
    159  * manipulate a buffer prior to the first xdg_surface.configure call must
    160  * also be treated as errors.
    161  *
    162  * After creating a role-specific object and setting it up, the client must
    163  * perform an initial commit without any buffer attached. The compositor
    164  * will reply with an xdg_surface.configure event. The client must
    165  * acknowledge it and is then allowed to attach a buffer to map the surface.
    166  *
    167  * Mapping an xdg_surface-based role surface is defined as making it
    168  * possible for the surface to be shown by the compositor. Note that
    169  * a mapped surface is not guaranteed to be visible once it is mapped.
    170  *
    171  * For an xdg_surface to be mapped by the compositor, the following
    172  * conditions must be met:
    173  * (1) the client has assigned an xdg_surface-based role to the surface
    174  * (2) the client has set and committed the xdg_surface state and the
    175  * role-dependent state to the surface
    176  * (3) the client has committed a buffer to the surface
    177  *
    178  * A newly-unmapped surface is considered to have met condition (1) out
    179  * of the 3 required conditions for mapping a surface if its role surface
    180  * has not been destroyed.
    181  * @section page_iface_xdg_surface_api API
    182  * See @ref iface_xdg_surface.
    183  */
    184 /**
    185  * @defgroup iface_xdg_surface The xdg_surface interface
    186  *
    187  * An interface that may be implemented by a wl_surface, for
    188  * implementations that provide a desktop-style user interface.
    189  *
    190  * It provides a base set of functionality required to construct user
    191  * interface elements requiring management by the compositor, such as
    192  * toplevel windows, menus, etc. The types of functionality are split into
    193  * xdg_surface roles.
    194  *
    195  * Creating an xdg_surface does not set the role for a wl_surface. In order
    196  * to map an xdg_surface, the client must create a role-specific object
    197  * using, e.g., get_toplevel, get_popup. The wl_surface for any given
    198  * xdg_surface can have at most one role, and may not be assigned any role
    199  * not based on xdg_surface.
    200  *
    201  * A role must be assigned before any other requests are made to the
    202  * xdg_surface object.
    203  *
    204  * The client must call wl_surface.commit on the corresponding wl_surface
    205  * for the xdg_surface state to take effect.
    206  *
    207  * Creating an xdg_surface from a wl_surface which has a buffer attached or
    208  * committed is a client error, and any attempts by a client to attach or
    209  * manipulate a buffer prior to the first xdg_surface.configure call must
    210  * also be treated as errors.
    211  *
    212  * After creating a role-specific object and setting it up, the client must
    213  * perform an initial commit without any buffer attached. The compositor
    214  * will reply with an xdg_surface.configure event. The client must
    215  * acknowledge it and is then allowed to attach a buffer to map the surface.
    216  *
    217  * Mapping an xdg_surface-based role surface is defined as making it
    218  * possible for the surface to be shown by the compositor. Note that
    219  * a mapped surface is not guaranteed to be visible once it is mapped.
    220  *
    221  * For an xdg_surface to be mapped by the compositor, the following
    222  * conditions must be met:
    223  * (1) the client has assigned an xdg_surface-based role to the surface
    224  * (2) the client has set and committed the xdg_surface state and the
    225  * role-dependent state to the surface
    226  * (3) the client has committed a buffer to the surface
    227  *
    228  * A newly-unmapped surface is considered to have met condition (1) out
    229  * of the 3 required conditions for mapping a surface if its role surface
    230  * has not been destroyed.
    231  */
    232 extern const struct wl_interface xdg_surface_interface;
    233 /**
    234  * @page page_iface_xdg_toplevel xdg_toplevel
    235  * @section page_iface_xdg_toplevel_desc Description
    236  *
    237  * This interface defines an xdg_surface role which allows a surface to,
    238  * among other things, set window-like properties such as maximize,
    239  * fullscreen, and minimize, set application-specific metadata like title and
    240  * id, and well as trigger user interactive operations such as interactive
    241  * resize and move.
    242  *
    243  * Unmapping an xdg_toplevel means that the surface cannot be shown
    244  * by the compositor until it is explicitly mapped again.
    245  * All active operations (e.g., move, resize) are canceled and all
    246  * attributes (e.g. title, state, stacking, ...) are discarded for
    247  * an xdg_toplevel surface when it is unmapped. The xdg_toplevel returns to
    248  * the state it had right after xdg_surface.get_toplevel. The client
    249  * can re-map the toplevel by perfoming a commit without any buffer
    250  * attached, waiting for a configure event and handling it as usual (see
    251  * xdg_surface description).
    252  *
    253  * Attaching a null buffer to a toplevel unmaps the surface.
    254  * @section page_iface_xdg_toplevel_api API
    255  * See @ref iface_xdg_toplevel.
    256  */
    257 /**
    258  * @defgroup iface_xdg_toplevel The xdg_toplevel interface
    259  *
    260  * This interface defines an xdg_surface role which allows a surface to,
    261  * among other things, set window-like properties such as maximize,
    262  * fullscreen, and minimize, set application-specific metadata like title and
    263  * id, and well as trigger user interactive operations such as interactive
    264  * resize and move.
    265  *
    266  * Unmapping an xdg_toplevel means that the surface cannot be shown
    267  * by the compositor until it is explicitly mapped again.
    268  * All active operations (e.g., move, resize) are canceled and all
    269  * attributes (e.g. title, state, stacking, ...) are discarded for
    270  * an xdg_toplevel surface when it is unmapped. The xdg_toplevel returns to
    271  * the state it had right after xdg_surface.get_toplevel. The client
    272  * can re-map the toplevel by perfoming a commit without any buffer
    273  * attached, waiting for a configure event and handling it as usual (see
    274  * xdg_surface description).
    275  *
    276  * Attaching a null buffer to a toplevel unmaps the surface.
    277  */
    278 extern const struct wl_interface xdg_toplevel_interface;
    279 /**
    280  * @page page_iface_xdg_popup xdg_popup
    281  * @section page_iface_xdg_popup_desc Description
    282  *
    283  * A popup surface is a short-lived, temporary surface. It can be used to
    284  * implement for example menus, popovers, tooltips and other similar user
    285  * interface concepts.
    286  *
    287  * A popup can be made to take an explicit grab. See xdg_popup.grab for
    288  * details.
    289  *
    290  * When the popup is dismissed, a popup_done event will be sent out, and at
    291  * the same time the surface will be unmapped. See the xdg_popup.popup_done
    292  * event for details.
    293  *
    294  * Explicitly destroying the xdg_popup object will also dismiss the popup and
    295  * unmap the surface. Clients that want to dismiss the popup when another
    296  * surface of their own is clicked should dismiss the popup using the destroy
    297  * request.
    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 client must call wl_surface.commit on the corresponding wl_surface
    306  * for the xdg_popup state to take effect.
    307  * @section page_iface_xdg_popup_api API
    308  * See @ref iface_xdg_popup.
    309  */
    310 /**
    311  * @defgroup iface_xdg_popup The xdg_popup interface
    312  *
    313  * A popup surface is a short-lived, temporary surface. It can be used to
    314  * implement for example menus, popovers, tooltips and other similar user
    315  * interface concepts.
    316  *
    317  * A popup can be made to take an explicit grab. See xdg_popup.grab for
    318  * details.
    319  *
    320  * When the popup is dismissed, a popup_done event will be sent out, and at
    321  * the same time the surface will be unmapped. See the xdg_popup.popup_done
    322  * event for details.
    323  *
    324  * Explicitly destroying the xdg_popup object will also dismiss the popup and
    325  * unmap the surface. Clients that want to dismiss the popup when another
    326  * surface of their own is clicked should dismiss the popup using the destroy
    327  * request.
    328  *
    329  * A newly created xdg_popup will be stacked on top of all previously created
    330  * xdg_popup surfaces associated with the same xdg_toplevel.
    331  *
    332  * The parent of an xdg_popup must be mapped (see the xdg_surface
    333  * description) before the xdg_popup itself.
    334  *
    335  * The client must call wl_surface.commit on the corresponding wl_surface
    336  * for the xdg_popup state to take effect.
    337  */
    338 extern const struct wl_interface xdg_popup_interface;
    339 
    340 #ifndef XDG_WM_BASE_ERROR_ENUM
    341 #define XDG_WM_BASE_ERROR_ENUM
    342 enum xdg_wm_base_error {
    343 	/**
    344 	 * given wl_surface has another role
    345 	 */
    346 	XDG_WM_BASE_ERROR_ROLE = 0,
    347 	/**
    348 	 * xdg_wm_base was destroyed before children
    349 	 */
    350 	XDG_WM_BASE_ERROR_DEFUNCT_SURFACES = 1,
    351 	/**
    352 	 * the client tried to map or destroy a non-topmost popup
    353 	 */
    354 	XDG_WM_BASE_ERROR_NOT_THE_TOPMOST_POPUP = 2,
    355 	/**
    356 	 * the client specified an invalid popup parent surface
    357 	 */
    358 	XDG_WM_BASE_ERROR_INVALID_POPUP_PARENT = 3,
    359 	/**
    360 	 * the client provided an invalid surface state
    361 	 */
    362 	XDG_WM_BASE_ERROR_INVALID_SURFACE_STATE = 4,
    363 	/**
    364 	 * the client provided an invalid positioner
    365 	 */
    366 	XDG_WM_BASE_ERROR_INVALID_POSITIONER = 5,
    367 };
    368 #endif /* XDG_WM_BASE_ERROR_ENUM */
    369 
    370 /**
    371  * @ingroup iface_xdg_wm_base
    372  * @struct xdg_wm_base_listener
    373  */
    374 struct xdg_wm_base_listener {
    375 	/**
    376 	 * check if the client is alive
    377 	 *
    378 	 * The ping event asks the client if it's still alive. Pass the
    379 	 * serial specified in the event back to the compositor by sending
    380 	 * a "pong" request back with the specified serial. See
    381 	 * xdg_wm_base.pong.
    382 	 *
    383 	 * Compositors can use this to determine if the client is still
    384 	 * alive. It's unspecified what will happen if the client doesn't
    385 	 * respond to the ping request, or in what timeframe. Clients
    386 	 * should try to respond in a reasonable amount of time.
    387 	 *
    388 	 * A compositor is free to ping in any way it wants, but a client
    389 	 * must always respond to any xdg_wm_base object it created.
    390 	 * @param serial pass this to the pong request
    391 	 */
    392 	void (*ping)(void *data,
    393 		     struct xdg_wm_base *xdg_wm_base,
    394 		     uint32_t serial);
    395 };
    396 
    397 /**
    398  * @ingroup iface_xdg_wm_base
    399  */
    400 static inline int
    401 xdg_wm_base_add_listener(struct xdg_wm_base *xdg_wm_base,
    402 			 const struct xdg_wm_base_listener *listener, void *data)
    403 {
    404 	return wl_proxy_add_listener((struct wl_proxy *) xdg_wm_base,
    405 				     (void (**)(void)) listener, data);
    406 }
    407 
    408 #define XDG_WM_BASE_DESTROY 0
    409 #define XDG_WM_BASE_CREATE_POSITIONER 1
    410 #define XDG_WM_BASE_GET_XDG_SURFACE 2
    411 #define XDG_WM_BASE_PONG 3
    412 
    413 /**
    414  * @ingroup iface_xdg_wm_base
    415  */
    416 #define XDG_WM_BASE_PING_SINCE_VERSION 1
    417 
    418 /**
    419  * @ingroup iface_xdg_wm_base
    420  */
    421 #define XDG_WM_BASE_DESTROY_SINCE_VERSION 1
    422 /**
    423  * @ingroup iface_xdg_wm_base
    424  */
    425 #define XDG_WM_BASE_CREATE_POSITIONER_SINCE_VERSION 1
    426 /**
    427  * @ingroup iface_xdg_wm_base
    428  */
    429 #define XDG_WM_BASE_GET_XDG_SURFACE_SINCE_VERSION 1
    430 /**
    431  * @ingroup iface_xdg_wm_base
    432  */
    433 #define XDG_WM_BASE_PONG_SINCE_VERSION 1
    434 
    435 /** @ingroup iface_xdg_wm_base */
    436 static inline void
    437 xdg_wm_base_set_user_data(struct xdg_wm_base *xdg_wm_base, void *user_data)
    438 {
    439 	wl_proxy_set_user_data((struct wl_proxy *) xdg_wm_base, user_data);
    440 }
    441 
    442 /** @ingroup iface_xdg_wm_base */
    443 static inline void *
    444 xdg_wm_base_get_user_data(struct xdg_wm_base *xdg_wm_base)
    445 {
    446 	return wl_proxy_get_user_data((struct wl_proxy *) xdg_wm_base);
    447 }
    448 
    449 static inline uint32_t
    450 xdg_wm_base_get_version(struct xdg_wm_base *xdg_wm_base)
    451 {
    452 	return wl_proxy_get_version((struct wl_proxy *) xdg_wm_base);
    453 }
    454 
    455 /**
    456  * @ingroup iface_xdg_wm_base
    457  *
    458  * Destroy this xdg_wm_base object.
    459  *
    460  * Destroying a bound xdg_wm_base object while there are surfaces
    461  * still alive created by this xdg_wm_base object instance is illegal
    462  * and will result in a protocol error.
    463  */
    464 static inline void
    465 xdg_wm_base_destroy(struct xdg_wm_base *xdg_wm_base)
    466 {
    467 	wl_proxy_marshal((struct wl_proxy *) xdg_wm_base,
    468 			 XDG_WM_BASE_DESTROY);
    469 
    470 	wl_proxy_destroy((struct wl_proxy *) xdg_wm_base);
    471 }
    472 
    473 /**
    474  * @ingroup iface_xdg_wm_base
    475  *
    476  * Create a positioner object. A positioner object is used to position
    477  * surfaces relative to some parent surface. See the interface description
    478  * and xdg_surface.get_popup for details.
    479  */
    480 static inline struct xdg_positioner *
    481 xdg_wm_base_create_positioner(struct xdg_wm_base *xdg_wm_base)
    482 {
    483 	struct wl_proxy *id;
    484 
    485 	id = wl_proxy_marshal_constructor((struct wl_proxy *) xdg_wm_base,
    486 			 XDG_WM_BASE_CREATE_POSITIONER, &xdg_positioner_interface, NULL);
    487 
    488 	return (struct xdg_positioner *) id;
    489 }
    490 
    491 /**
    492  * @ingroup iface_xdg_wm_base
    493  *
    494  * This creates an xdg_surface for the given surface. While xdg_surface
    495  * itself is not a role, the corresponding surface may only be assigned
    496  * a role extending xdg_surface, such as xdg_toplevel or xdg_popup.
    497  *
    498  * This creates an xdg_surface for the given surface. An xdg_surface is
    499  * used as basis to define a role to a given surface, such as xdg_toplevel
    500  * or xdg_popup. It also manages functionality shared between xdg_surface
    501  * based surface roles.
    502  *
    503  * See the documentation of xdg_surface for more details about what an
    504  * xdg_surface is and how it is used.
    505  */
    506 static inline struct xdg_surface *
    507 xdg_wm_base_get_xdg_surface(struct xdg_wm_base *xdg_wm_base, struct wl_surface *surface)
    508 {
    509 	struct wl_proxy *id;
    510 
    511 	id = wl_proxy_marshal_constructor((struct wl_proxy *) xdg_wm_base,
    512 			 XDG_WM_BASE_GET_XDG_SURFACE, &xdg_surface_interface, NULL, surface);
    513 
    514 	return (struct xdg_surface *) id;
    515 }
    516 
    517 /**
    518  * @ingroup iface_xdg_wm_base
    519  *
    520  * A client must respond to a ping event with a pong request or
    521  * the client may be deemed unresponsive. See xdg_wm_base.ping.
    522  */
    523 static inline void
    524 xdg_wm_base_pong(struct xdg_wm_base *xdg_wm_base, uint32_t serial)
    525 {
    526 	wl_proxy_marshal((struct wl_proxy *) xdg_wm_base,
    527 			 XDG_WM_BASE_PONG, serial);
    528 }
    529 
    530 #ifndef XDG_POSITIONER_ERROR_ENUM
    531 #define XDG_POSITIONER_ERROR_ENUM
    532 enum xdg_positioner_error {
    533 	/**
    534 	 * invalid input provided
    535 	 */
    536 	XDG_POSITIONER_ERROR_INVALID_INPUT = 0,
    537 };
    538 #endif /* XDG_POSITIONER_ERROR_ENUM */
    539 
    540 #ifndef XDG_POSITIONER_ANCHOR_ENUM
    541 #define XDG_POSITIONER_ANCHOR_ENUM
    542 enum xdg_positioner_anchor {
    543 	XDG_POSITIONER_ANCHOR_NONE = 0,
    544 	XDG_POSITIONER_ANCHOR_TOP = 1,
    545 	XDG_POSITIONER_ANCHOR_BOTTOM = 2,
    546 	XDG_POSITIONER_ANCHOR_LEFT = 3,
    547 	XDG_POSITIONER_ANCHOR_RIGHT = 4,
    548 	XDG_POSITIONER_ANCHOR_TOP_LEFT = 5,
    549 	XDG_POSITIONER_ANCHOR_BOTTOM_LEFT = 6,
    550 	XDG_POSITIONER_ANCHOR_TOP_RIGHT = 7,
    551 	XDG_POSITIONER_ANCHOR_BOTTOM_RIGHT = 8,
    552 };
    553 #endif /* XDG_POSITIONER_ANCHOR_ENUM */
    554 
    555 #ifndef XDG_POSITIONER_GRAVITY_ENUM
    556 #define XDG_POSITIONER_GRAVITY_ENUM
    557 enum xdg_positioner_gravity {
    558 	XDG_POSITIONER_GRAVITY_NONE = 0,
    559 	XDG_POSITIONER_GRAVITY_TOP = 1,
    560 	XDG_POSITIONER_GRAVITY_BOTTOM = 2,
    561 	XDG_POSITIONER_GRAVITY_LEFT = 3,
    562 	XDG_POSITIONER_GRAVITY_RIGHT = 4,
    563 	XDG_POSITIONER_GRAVITY_TOP_LEFT = 5,
    564 	XDG_POSITIONER_GRAVITY_BOTTOM_LEFT = 6,
    565 	XDG_POSITIONER_GRAVITY_TOP_RIGHT = 7,
    566 	XDG_POSITIONER_GRAVITY_BOTTOM_RIGHT = 8,
    567 };
    568 #endif /* XDG_POSITIONER_GRAVITY_ENUM */
    569 
    570 #ifndef XDG_POSITIONER_CONSTRAINT_ADJUSTMENT_ENUM
    571 #define XDG_POSITIONER_CONSTRAINT_ADJUSTMENT_ENUM
    572 /**
    573  * @ingroup iface_xdg_positioner
    574  * vertically resize the surface
    575  *
    576  * Resize the surface vertically so that it is completely unconstrained.
    577  */
    578 enum xdg_positioner_constraint_adjustment {
    579 	XDG_POSITIONER_CONSTRAINT_ADJUSTMENT_NONE = 0,
    580 	XDG_POSITIONER_CONSTRAINT_ADJUSTMENT_SLIDE_X = 1,
    581 	XDG_POSITIONER_CONSTRAINT_ADJUSTMENT_SLIDE_Y = 2,
    582 	XDG_POSITIONER_CONSTRAINT_ADJUSTMENT_FLIP_X = 4,
    583 	XDG_POSITIONER_CONSTRAINT_ADJUSTMENT_FLIP_Y = 8,
    584 	XDG_POSITIONER_CONSTRAINT_ADJUSTMENT_RESIZE_X = 16,
    585 	XDG_POSITIONER_CONSTRAINT_ADJUSTMENT_RESIZE_Y = 32,
    586 };
    587 #endif /* XDG_POSITIONER_CONSTRAINT_ADJUSTMENT_ENUM */
    588 
    589 #define XDG_POSITIONER_DESTROY 0
    590 #define XDG_POSITIONER_SET_SIZE 1
    591 #define XDG_POSITIONER_SET_ANCHOR_RECT 2
    592 #define XDG_POSITIONER_SET_ANCHOR 3
    593 #define XDG_POSITIONER_SET_GRAVITY 4
    594 #define XDG_POSITIONER_SET_CONSTRAINT_ADJUSTMENT 5
    595 #define XDG_POSITIONER_SET_OFFSET 6
    596 #define XDG_POSITIONER_SET_REACTIVE 7
    597 #define XDG_POSITIONER_SET_PARENT_SIZE 8
    598 #define XDG_POSITIONER_SET_PARENT_CONFIGURE 9
    599 
    600 
    601 /**
    602  * @ingroup iface_xdg_positioner
    603  */
    604 #define XDG_POSITIONER_DESTROY_SINCE_VERSION 1
    605 /**
    606  * @ingroup iface_xdg_positioner
    607  */
    608 #define XDG_POSITIONER_SET_SIZE_SINCE_VERSION 1
    609 /**
    610  * @ingroup iface_xdg_positioner
    611  */
    612 #define XDG_POSITIONER_SET_ANCHOR_RECT_SINCE_VERSION 1
    613 /**
    614  * @ingroup iface_xdg_positioner
    615  */
    616 #define XDG_POSITIONER_SET_ANCHOR_SINCE_VERSION 1
    617 /**
    618  * @ingroup iface_xdg_positioner
    619  */
    620 #define XDG_POSITIONER_SET_GRAVITY_SINCE_VERSION 1
    621 /**
    622  * @ingroup iface_xdg_positioner
    623  */
    624 #define XDG_POSITIONER_SET_CONSTRAINT_ADJUSTMENT_SINCE_VERSION 1
    625 /**
    626  * @ingroup iface_xdg_positioner
    627  */
    628 #define XDG_POSITIONER_SET_OFFSET_SINCE_VERSION 1
    629 /**
    630  * @ingroup iface_xdg_positioner
    631  */
    632 #define XDG_POSITIONER_SET_REACTIVE_SINCE_VERSION 3
    633 /**
    634  * @ingroup iface_xdg_positioner
    635  */
    636 #define XDG_POSITIONER_SET_PARENT_SIZE_SINCE_VERSION 3
    637 /**
    638  * @ingroup iface_xdg_positioner
    639  */
    640 #define XDG_POSITIONER_SET_PARENT_CONFIGURE_SINCE_VERSION 3
    641 
    642 /** @ingroup iface_xdg_positioner */
    643 static inline void
    644 xdg_positioner_set_user_data(struct xdg_positioner *xdg_positioner, void *user_data)
    645 {
    646 	wl_proxy_set_user_data((struct wl_proxy *) xdg_positioner, user_data);
    647 }
    648 
    649 /** @ingroup iface_xdg_positioner */
    650 static inline void *
    651 xdg_positioner_get_user_data(struct xdg_positioner *xdg_positioner)
    652 {
    653 	return wl_proxy_get_user_data((struct wl_proxy *) xdg_positioner);
    654 }
    655 
    656 static inline uint32_t
    657 xdg_positioner_get_version(struct xdg_positioner *xdg_positioner)
    658 {
    659 	return wl_proxy_get_version((struct wl_proxy *) xdg_positioner);
    660 }
    661 
    662 /**
    663  * @ingroup iface_xdg_positioner
    664  *
    665  * Notify the compositor that the xdg_positioner will no longer be used.
    666  */
    667 static inline void
    668 xdg_positioner_destroy(struct xdg_positioner *xdg_positioner)
    669 {
    670 	wl_proxy_marshal((struct wl_proxy *) xdg_positioner,
    671 			 XDG_POSITIONER_DESTROY);
    672 
    673 	wl_proxy_destroy((struct wl_proxy *) xdg_positioner);
    674 }
    675 
    676 /**
    677  * @ingroup iface_xdg_positioner
    678  *
    679  * Set the size of the surface that is to be positioned with the positioner
    680  * object. The size is in surface-local coordinates and corresponds to the
    681  * window geometry. See xdg_surface.set_window_geometry.
    682  *
    683  * If a zero or negative size is set the invalid_input error is raised.
    684  */
    685 static inline void
    686 xdg_positioner_set_size(struct xdg_positioner *xdg_positioner, int32_t width, int32_t height)
    687 {
    688 	wl_proxy_marshal((struct wl_proxy *) xdg_positioner,
    689 			 XDG_POSITIONER_SET_SIZE, width, height);
    690 }
    691 
    692 /**
    693  * @ingroup iface_xdg_positioner
    694  *
    695  * Specify the anchor rectangle within the parent surface that the child
    696  * surface will be placed relative to. The rectangle is relative to the
    697  * window geometry as defined by xdg_surface.set_window_geometry of the
    698  * parent surface.
    699  *
    700  * When the xdg_positioner object is used to position a child surface, the
    701  * anchor rectangle may not extend outside the window geometry of the
    702  * positioned child's parent surface.
    703  *
    704  * If a negative size is set the invalid_input error is raised.
    705  */
    706 static inline void
    707 xdg_positioner_set_anchor_rect(struct xdg_positioner *xdg_positioner, int32_t x, int32_t y, int32_t width, int32_t height)
    708 {
    709 	wl_proxy_marshal((struct wl_proxy *) xdg_positioner,
    710 			 XDG_POSITIONER_SET_ANCHOR_RECT, x, y, width, height);
    711 }
    712 
    713 /**
    714  * @ingroup iface_xdg_positioner
    715  *
    716  * Defines the anchor point for the anchor rectangle. The specified anchor
    717  * is used derive an anchor point that the child surface will be
    718  * positioned relative to. If a corner anchor is set (e.g. 'top_left' or
    719  * 'bottom_right'), the anchor point will be at the specified corner;
    720  * otherwise, the derived anchor point will be centered on the specified
    721  * edge, or in the center of the anchor rectangle if no edge is specified.
    722  */
    723 static inline void
    724 xdg_positioner_set_anchor(struct xdg_positioner *xdg_positioner, uint32_t anchor)
    725 {
    726 	wl_proxy_marshal((struct wl_proxy *) xdg_positioner,
    727 			 XDG_POSITIONER_SET_ANCHOR, anchor);
    728 }
    729 
    730 /**
    731  * @ingroup iface_xdg_positioner
    732  *
    733  * Defines in what direction a surface should be positioned, relative to
    734  * the anchor point of the parent surface. If a corner gravity is
    735  * specified (e.g. 'bottom_right' or 'top_left'), then the child surface
    736  * will be placed towards the specified gravity; otherwise, the child
    737  * surface will be centered over the anchor point on any axis that had no
    738  * gravity specified.
    739  */
    740 static inline void
    741 xdg_positioner_set_gravity(struct xdg_positioner *xdg_positioner, uint32_t gravity)
    742 {
    743 	wl_proxy_marshal((struct wl_proxy *) xdg_positioner,
    744 			 XDG_POSITIONER_SET_GRAVITY, gravity);
    745 }
    746 
    747 /**
    748  * @ingroup iface_xdg_positioner
    749  *
    750  * Specify how the window should be positioned if the originally intended
    751  * position caused the surface to be constrained, meaning at least
    752  * partially outside positioning boundaries set by the compositor. The
    753  * adjustment is set by constructing a bitmask describing the adjustment to
    754  * be made when the surface is constrained on that axis.
    755  *
    756  * If no bit for one axis is set, the compositor will assume that the child
    757  * surface should not change its position on that axis when constrained.
    758  *
    759  * If more than one bit for one axis is set, the order of how adjustments
    760  * are applied is specified in the corresponding adjustment descriptions.
    761  *
    762  * The default adjustment is none.
    763  */
    764 static inline void
    765 xdg_positioner_set_constraint_adjustment(struct xdg_positioner *xdg_positioner, uint32_t constraint_adjustment)
    766 {
    767 	wl_proxy_marshal((struct wl_proxy *) xdg_positioner,
    768 			 XDG_POSITIONER_SET_CONSTRAINT_ADJUSTMENT, constraint_adjustment);
    769 }
    770 
    771 /**
    772  * @ingroup iface_xdg_positioner
    773  *
    774  * Specify the surface position offset relative to the position of the
    775  * anchor on the anchor rectangle and the anchor on the surface. For
    776  * example if the anchor of the anchor rectangle is at (x, y), the surface
    777  * has the gravity bottom|right, and the offset is (ox, oy), the calculated
    778  * surface position will be (x + ox, y + oy). The offset position of the
    779  * surface is the one used for constraint testing. See
    780  * set_constraint_adjustment.
    781  *
    782  * An example use case is placing a popup menu on top of a user interface
    783  * element, while aligning the user interface element of the parent surface
    784  * with some user interface element placed somewhere in the popup surface.
    785  */
    786 static inline void
    787 xdg_positioner_set_offset(struct xdg_positioner *xdg_positioner, int32_t x, int32_t y)
    788 {
    789 	wl_proxy_marshal((struct wl_proxy *) xdg_positioner,
    790 			 XDG_POSITIONER_SET_OFFSET, x, y);
    791 }
    792 
    793 /**
    794  * @ingroup iface_xdg_positioner
    795  *
    796  * When set reactive, the surface is reconstrained if the conditions used
    797  * for constraining changed, e.g. the parent window moved.
    798  *
    799  * If the conditions changed and the popup was reconstrained, an
    800  * xdg_popup.configure event is sent with updated geometry, followed by an
    801  * xdg_surface.configure event.
    802  */
    803 static inline void
    804 xdg_positioner_set_reactive(struct xdg_positioner *xdg_positioner)
    805 {
    806 	wl_proxy_marshal((struct wl_proxy *) xdg_positioner,
    807 			 XDG_POSITIONER_SET_REACTIVE);
    808 }
    809 
    810 /**
    811  * @ingroup iface_xdg_positioner
    812  *
    813  * Set the parent window geometry the compositor should use when
    814  * positioning the popup. The compositor may use this information to
    815  * determine the future state the popup should be constrained using. If
    816  * this doesn't match the dimension of the parent the popup is eventually
    817  * positioned against, the behavior is undefined.
    818  *
    819  * The arguments are given in the surface-local coordinate space.
    820  */
    821 static inline void
    822 xdg_positioner_set_parent_size(struct xdg_positioner *xdg_positioner, int32_t parent_width, int32_t parent_height)
    823 {
    824 	wl_proxy_marshal((struct wl_proxy *) xdg_positioner,
    825 			 XDG_POSITIONER_SET_PARENT_SIZE, parent_width, parent_height);
    826 }
    827 
    828 /**
    829  * @ingroup iface_xdg_positioner
    830  *
    831  * Set the serial of an xdg_surface.configure event this positioner will be
    832  * used in response to. The compositor may use this information together
    833  * with set_parent_size to determine what future state the popup should be
    834  * constrained using.
    835  */
    836 static inline void
    837 xdg_positioner_set_parent_configure(struct xdg_positioner *xdg_positioner, uint32_t serial)
    838 {
    839 	wl_proxy_marshal((struct wl_proxy *) xdg_positioner,
    840 			 XDG_POSITIONER_SET_PARENT_CONFIGURE, serial);
    841 }
    842 
    843 #ifndef XDG_SURFACE_ERROR_ENUM
    844 #define XDG_SURFACE_ERROR_ENUM
    845 enum xdg_surface_error {
    846 	XDG_SURFACE_ERROR_NOT_CONSTRUCTED = 1,
    847 	XDG_SURFACE_ERROR_ALREADY_CONSTRUCTED = 2,
    848 	XDG_SURFACE_ERROR_UNCONFIGURED_BUFFER = 3,
    849 };
    850 #endif /* XDG_SURFACE_ERROR_ENUM */
    851 
    852 /**
    853  * @ingroup iface_xdg_surface
    854  * @struct xdg_surface_listener
    855  */
    856 struct xdg_surface_listener {
    857 	/**
    858 	 * suggest a surface change
    859 	 *
    860 	 * The configure event marks the end of a configure sequence. A
    861 	 * configure sequence is a set of one or more events configuring
    862 	 * the state of the xdg_surface, including the final
    863 	 * xdg_surface.configure event.
    864 	 *
    865 	 * Where applicable, xdg_surface surface roles will during a
    866 	 * configure sequence extend this event as a latched state sent as
    867 	 * events before the xdg_surface.configure event. Such events
    868 	 * should be considered to make up a set of atomically applied
    869 	 * configuration states, where the xdg_surface.configure commits
    870 	 * the accumulated state.
    871 	 *
    872 	 * Clients should arrange their surface for the new states, and
    873 	 * then send an ack_configure request with the serial sent in this
    874 	 * configure event at some point before committing the new surface.
    875 	 *
    876 	 * If the client receives multiple configure events before it can
    877 	 * respond to one, it is free to discard all but the last event it
    878 	 * received.
    879 	 * @param serial serial of the configure event
    880 	 */
    881 	void (*configure)(void *data,
    882 			  struct xdg_surface *xdg_surface,
    883 			  uint32_t serial);
    884 };
    885 
    886 /**
    887  * @ingroup iface_xdg_surface
    888  */
    889 static inline int
    890 xdg_surface_add_listener(struct xdg_surface *xdg_surface,
    891 			 const struct xdg_surface_listener *listener, void *data)
    892 {
    893 	return wl_proxy_add_listener((struct wl_proxy *) xdg_surface,
    894 				     (void (**)(void)) listener, data);
    895 }
    896 
    897 #define XDG_SURFACE_DESTROY 0
    898 #define XDG_SURFACE_GET_TOPLEVEL 1
    899 #define XDG_SURFACE_GET_POPUP 2
    900 #define XDG_SURFACE_SET_WINDOW_GEOMETRY 3
    901 #define XDG_SURFACE_ACK_CONFIGURE 4
    902 
    903 /**
    904  * @ingroup iface_xdg_surface
    905  */
    906 #define XDG_SURFACE_CONFIGURE_SINCE_VERSION 1
    907 
    908 /**
    909  * @ingroup iface_xdg_surface
    910  */
    911 #define XDG_SURFACE_DESTROY_SINCE_VERSION 1
    912 /**
    913  * @ingroup iface_xdg_surface
    914  */
    915 #define XDG_SURFACE_GET_TOPLEVEL_SINCE_VERSION 1
    916 /**
    917  * @ingroup iface_xdg_surface
    918  */
    919 #define XDG_SURFACE_GET_POPUP_SINCE_VERSION 1
    920 /**
    921  * @ingroup iface_xdg_surface
    922  */
    923 #define XDG_SURFACE_SET_WINDOW_GEOMETRY_SINCE_VERSION 1
    924 /**
    925  * @ingroup iface_xdg_surface
    926  */
    927 #define XDG_SURFACE_ACK_CONFIGURE_SINCE_VERSION 1
    928 
    929 /** @ingroup iface_xdg_surface */
    930 static inline void
    931 xdg_surface_set_user_data(struct xdg_surface *xdg_surface, void *user_data)
    932 {
    933 	wl_proxy_set_user_data((struct wl_proxy *) xdg_surface, user_data);
    934 }
    935 
    936 /** @ingroup iface_xdg_surface */
    937 static inline void *
    938 xdg_surface_get_user_data(struct xdg_surface *xdg_surface)
    939 {
    940 	return wl_proxy_get_user_data((struct wl_proxy *) xdg_surface);
    941 }
    942 
    943 static inline uint32_t
    944 xdg_surface_get_version(struct xdg_surface *xdg_surface)
    945 {
    946 	return wl_proxy_get_version((struct wl_proxy *) xdg_surface);
    947 }
    948 
    949 /**
    950  * @ingroup iface_xdg_surface
    951  *
    952  * Destroy the xdg_surface object. An xdg_surface must only be destroyed
    953  * after its role object has been destroyed.
    954  */
    955 static inline void
    956 xdg_surface_destroy(struct xdg_surface *xdg_surface)
    957 {
    958 	wl_proxy_marshal((struct wl_proxy *) xdg_surface,
    959 			 XDG_SURFACE_DESTROY);
    960 
    961 	wl_proxy_destroy((struct wl_proxy *) xdg_surface);
    962 }
    963 
    964 /**
    965  * @ingroup iface_xdg_surface
    966  *
    967  * This creates an xdg_toplevel object for the given xdg_surface and gives
    968  * the associated wl_surface the xdg_toplevel role.
    969  *
    970  * See the documentation of xdg_toplevel for more details about what an
    971  * xdg_toplevel is and how it is used.
    972  */
    973 static inline struct xdg_toplevel *
    974 xdg_surface_get_toplevel(struct xdg_surface *xdg_surface)
    975 {
    976 	struct wl_proxy *id;
    977 
    978 	id = wl_proxy_marshal_constructor((struct wl_proxy *) xdg_surface,
    979 			 XDG_SURFACE_GET_TOPLEVEL, &xdg_toplevel_interface, NULL);
    980 
    981 	return (struct xdg_toplevel *) id;
    982 }
    983 
    984 /**
    985  * @ingroup iface_xdg_surface
    986  *
    987  * This creates an xdg_popup object for the given xdg_surface and gives
    988  * the associated wl_surface the xdg_popup role.
    989  *
    990  * If null is passed as a parent, a parent surface must be specified using
    991  * some other protocol, before committing the initial state.
    992  *
    993  * See the documentation of xdg_popup for more details about what an
    994  * xdg_popup is and how it is used.
    995  */
    996 static inline struct xdg_popup *
    997 xdg_surface_get_popup(struct xdg_surface *xdg_surface, struct xdg_surface *parent, struct xdg_positioner *positioner)
    998 {
    999 	struct wl_proxy *id;
   1000 
   1001 	id = wl_proxy_marshal_constructor((struct wl_proxy *) xdg_surface,
   1002 			 XDG_SURFACE_GET_POPUP, &xdg_popup_interface, NULL, parent, positioner);
   1003 
   1004 	return (struct xdg_popup *) id;
   1005 }
   1006 
   1007 /**
   1008  * @ingroup iface_xdg_surface
   1009  *
   1010  * The window geometry of a surface is its "visible bounds" from the
   1011  * user's perspective. Client-side decorations often have invisible
   1012  * portions like drop-shadows which should be ignored for the
   1013  * purposes of aligning, placing and constraining windows.
   1014  *
   1015  * The window geometry is double buffered, and will be applied at the
   1016  * time wl_surface.commit of the corresponding wl_surface is called.
   1017  *
   1018  * When maintaining a position, the compositor should treat the (x, y)
   1019  * coordinate of the window geometry as the top left corner of the window.
   1020  * A client changing the (x, y) window geometry coordinate should in
   1021  * general not alter the position of the window.
   1022  *
   1023  * Once the window geometry of the surface is set, it is not possible to
   1024  * unset it, and it will remain the same until set_window_geometry is
   1025  * called again, even if a new subsurface or buffer is attached.
   1026  *
   1027  * If never set, the value is the full bounds of the surface,
   1028  * including any subsurfaces. This updates dynamically on every
   1029  * commit. This unset is meant for extremely simple clients.
   1030  *
   1031  * The arguments are given in the surface-local coordinate space of
   1032  * the wl_surface associated with this xdg_surface.
   1033  *
   1034  * The width and height must be greater than zero. Setting an invalid size
   1035  * will raise an error. When applied, the effective window geometry will be
   1036  * the set window geometry clamped to the bounding rectangle of the
   1037  * combined geometry of the surface of the xdg_surface and the associated
   1038  * subsurfaces.
   1039  */
   1040 static inline void
   1041 xdg_surface_set_window_geometry(struct xdg_surface *xdg_surface, int32_t x, int32_t y, int32_t width, int32_t height)
   1042 {
   1043 	wl_proxy_marshal((struct wl_proxy *) xdg_surface,
   1044 			 XDG_SURFACE_SET_WINDOW_GEOMETRY, x, y, width, height);
   1045 }
   1046 
   1047 /**
   1048  * @ingroup iface_xdg_surface
   1049  *
   1050  * When a configure event is received, if a client commits the
   1051  * surface in response to the configure event, then the client
   1052  * must make an ack_configure request sometime before the commit
   1053  * request, passing along the serial of the configure event.
   1054  *
   1055  * For instance, for toplevel surfaces the compositor might use this
   1056  * information to move a surface to the top left only when the client has
   1057  * drawn itself for the maximized or fullscreen state.
   1058  *
   1059  * If the client receives multiple configure events before it
   1060  * can respond to one, it only has to ack the last configure event.
   1061  *
   1062  * A client is not required to commit immediately after sending
   1063  * an ack_configure request - it may even ack_configure several times
   1064  * before its next surface commit.
   1065  *
   1066  * A client may send multiple ack_configure requests before committing, but
   1067  * only the last request sent before a commit indicates which configure
   1068  * event the client really is responding to.
   1069  */
   1070 static inline void
   1071 xdg_surface_ack_configure(struct xdg_surface *xdg_surface, uint32_t serial)
   1072 {
   1073 	wl_proxy_marshal((struct wl_proxy *) xdg_surface,
   1074 			 XDG_SURFACE_ACK_CONFIGURE, serial);
   1075 }
   1076 
   1077 #ifndef XDG_TOPLEVEL_RESIZE_EDGE_ENUM
   1078 #define XDG_TOPLEVEL_RESIZE_EDGE_ENUM
   1079 /**
   1080  * @ingroup iface_xdg_toplevel
   1081  * edge values for resizing
   1082  *
   1083  * These values are used to indicate which edge of a surface
   1084  * is being dragged in a resize operation.
   1085  */
   1086 enum xdg_toplevel_resize_edge {
   1087 	XDG_TOPLEVEL_RESIZE_EDGE_NONE = 0,
   1088 	XDG_TOPLEVEL_RESIZE_EDGE_TOP = 1,
   1089 	XDG_TOPLEVEL_RESIZE_EDGE_BOTTOM = 2,
   1090 	XDG_TOPLEVEL_RESIZE_EDGE_LEFT = 4,
   1091 	XDG_TOPLEVEL_RESIZE_EDGE_TOP_LEFT = 5,
   1092 	XDG_TOPLEVEL_RESIZE_EDGE_BOTTOM_LEFT = 6,
   1093 	XDG_TOPLEVEL_RESIZE_EDGE_RIGHT = 8,
   1094 	XDG_TOPLEVEL_RESIZE_EDGE_TOP_RIGHT = 9,
   1095 	XDG_TOPLEVEL_RESIZE_EDGE_BOTTOM_RIGHT = 10,
   1096 };
   1097 #endif /* XDG_TOPLEVEL_RESIZE_EDGE_ENUM */
   1098 
   1099 #ifndef XDG_TOPLEVEL_STATE_ENUM
   1100 #define XDG_TOPLEVEL_STATE_ENUM
   1101 /**
   1102  * @ingroup iface_xdg_toplevel
   1103  * the surface is tiled
   1104  *
   1105  * The window is currently in a tiled layout and the bottom edge is
   1106  * considered to be adjacent to another part of the tiling grid.
   1107  */
   1108 enum xdg_toplevel_state {
   1109 	/**
   1110 	 * the surface is maximized
   1111 	 */
   1112 	XDG_TOPLEVEL_STATE_MAXIMIZED = 1,
   1113 	/**
   1114 	 * the surface is fullscreen
   1115 	 */
   1116 	XDG_TOPLEVEL_STATE_FULLSCREEN = 2,
   1117 	/**
   1118 	 * the surface is being resized
   1119 	 */
   1120 	XDG_TOPLEVEL_STATE_RESIZING = 3,
   1121 	/**
   1122 	 * the surface is now activated
   1123 	 */
   1124 	XDG_TOPLEVEL_STATE_ACTIVATED = 4,
   1125 	/**
   1126 	 * @since 2
   1127 	 */
   1128 	XDG_TOPLEVEL_STATE_TILED_LEFT = 5,
   1129 	/**
   1130 	 * @since 2
   1131 	 */
   1132 	XDG_TOPLEVEL_STATE_TILED_RIGHT = 6,
   1133 	/**
   1134 	 * @since 2
   1135 	 */
   1136 	XDG_TOPLEVEL_STATE_TILED_TOP = 7,
   1137 	/**
   1138 	 * @since 2
   1139 	 */
   1140 	XDG_TOPLEVEL_STATE_TILED_BOTTOM = 8,
   1141 };
   1142 /**
   1143  * @ingroup iface_xdg_toplevel
   1144  */
   1145 #define XDG_TOPLEVEL_STATE_TILED_LEFT_SINCE_VERSION 2
   1146 /**
   1147  * @ingroup iface_xdg_toplevel
   1148  */
   1149 #define XDG_TOPLEVEL_STATE_TILED_RIGHT_SINCE_VERSION 2
   1150 /**
   1151  * @ingroup iface_xdg_toplevel
   1152  */
   1153 #define XDG_TOPLEVEL_STATE_TILED_TOP_SINCE_VERSION 2
   1154 /**
   1155  * @ingroup iface_xdg_toplevel
   1156  */
   1157 #define XDG_TOPLEVEL_STATE_TILED_BOTTOM_SINCE_VERSION 2
   1158 #endif /* XDG_TOPLEVEL_STATE_ENUM */
   1159 
   1160 /**
   1161  * @ingroup iface_xdg_toplevel
   1162  * @struct xdg_toplevel_listener
   1163  */
   1164 struct xdg_toplevel_listener {
   1165 	/**
   1166 	 * suggest a surface change
   1167 	 *
   1168 	 * This configure event asks the client to resize its toplevel
   1169 	 * surface or to change its state. The configured state should not
   1170 	 * be applied immediately. See xdg_surface.configure for details.
   1171 	 *
   1172 	 * The width and height arguments specify a hint to the window
   1173 	 * about how its surface should be resized in window geometry
   1174 	 * coordinates. See set_window_geometry.
   1175 	 *
   1176 	 * If the width or height arguments are zero, it means the client
   1177 	 * should decide its own window dimension. This may happen when the
   1178 	 * compositor needs to configure the state of the surface but
   1179 	 * doesn't have any information about any previous or expected
   1180 	 * dimension.
   1181 	 *
   1182 	 * The states listed in the event specify how the width/height
   1183 	 * arguments should be interpreted, and possibly how it should be
   1184 	 * drawn.
   1185 	 *
   1186 	 * Clients must send an ack_configure in response to this event.
   1187 	 * See xdg_surface.configure and xdg_surface.ack_configure for
   1188 	 * details.
   1189 	 */
   1190 	void (*configure)(void *data,
   1191 			  struct xdg_toplevel *xdg_toplevel,
   1192 			  int32_t width,
   1193 			  int32_t height,
   1194 			  struct wl_array *states);
   1195 	/**
   1196 	 * surface wants to be closed
   1197 	 *
   1198 	 * The close event is sent by the compositor when the user wants
   1199 	 * the surface to be closed. This should be equivalent to the user
   1200 	 * clicking the close button in client-side decorations, if your
   1201 	 * application has any.
   1202 	 *
   1203 	 * This is only a request that the user intends to close the
   1204 	 * window. The client may choose to ignore this request, or show a
   1205 	 * dialog to ask the user to save their data, etc.
   1206 	 */
   1207 	void (*close)(void *data,
   1208 		      struct xdg_toplevel *xdg_toplevel);
   1209 };
   1210 
   1211 /**
   1212  * @ingroup iface_xdg_toplevel
   1213  */
   1214 static inline int
   1215 xdg_toplevel_add_listener(struct xdg_toplevel *xdg_toplevel,
   1216 			  const struct xdg_toplevel_listener *listener, void *data)
   1217 {
   1218 	return wl_proxy_add_listener((struct wl_proxy *) xdg_toplevel,
   1219 				     (void (**)(void)) listener, data);
   1220 }
   1221 
   1222 #define XDG_TOPLEVEL_DESTROY 0
   1223 #define XDG_TOPLEVEL_SET_PARENT 1
   1224 #define XDG_TOPLEVEL_SET_TITLE 2
   1225 #define XDG_TOPLEVEL_SET_APP_ID 3
   1226 #define XDG_TOPLEVEL_SHOW_WINDOW_MENU 4
   1227 #define XDG_TOPLEVEL_MOVE 5
   1228 #define XDG_TOPLEVEL_RESIZE 6
   1229 #define XDG_TOPLEVEL_SET_MAX_SIZE 7
   1230 #define XDG_TOPLEVEL_SET_MIN_SIZE 8
   1231 #define XDG_TOPLEVEL_SET_MAXIMIZED 9
   1232 #define XDG_TOPLEVEL_UNSET_MAXIMIZED 10
   1233 #define XDG_TOPLEVEL_SET_FULLSCREEN 11
   1234 #define XDG_TOPLEVEL_UNSET_FULLSCREEN 12
   1235 #define XDG_TOPLEVEL_SET_MINIMIZED 13
   1236 
   1237 /**
   1238  * @ingroup iface_xdg_toplevel
   1239  */
   1240 #define XDG_TOPLEVEL_CONFIGURE_SINCE_VERSION 1
   1241 /**
   1242  * @ingroup iface_xdg_toplevel
   1243  */
   1244 #define XDG_TOPLEVEL_CLOSE_SINCE_VERSION 1
   1245 
   1246 /**
   1247  * @ingroup iface_xdg_toplevel
   1248  */
   1249 #define XDG_TOPLEVEL_DESTROY_SINCE_VERSION 1
   1250 /**
   1251  * @ingroup iface_xdg_toplevel
   1252  */
   1253 #define XDG_TOPLEVEL_SET_PARENT_SINCE_VERSION 1
   1254 /**
   1255  * @ingroup iface_xdg_toplevel
   1256  */
   1257 #define XDG_TOPLEVEL_SET_TITLE_SINCE_VERSION 1
   1258 /**
   1259  * @ingroup iface_xdg_toplevel
   1260  */
   1261 #define XDG_TOPLEVEL_SET_APP_ID_SINCE_VERSION 1
   1262 /**
   1263  * @ingroup iface_xdg_toplevel
   1264  */
   1265 #define XDG_TOPLEVEL_SHOW_WINDOW_MENU_SINCE_VERSION 1
   1266 /**
   1267  * @ingroup iface_xdg_toplevel
   1268  */
   1269 #define XDG_TOPLEVEL_MOVE_SINCE_VERSION 1
   1270 /**
   1271  * @ingroup iface_xdg_toplevel
   1272  */
   1273 #define XDG_TOPLEVEL_RESIZE_SINCE_VERSION 1
   1274 /**
   1275  * @ingroup iface_xdg_toplevel
   1276  */
   1277 #define XDG_TOPLEVEL_SET_MAX_SIZE_SINCE_VERSION 1
   1278 /**
   1279  * @ingroup iface_xdg_toplevel
   1280  */
   1281 #define XDG_TOPLEVEL_SET_MIN_SIZE_SINCE_VERSION 1
   1282 /**
   1283  * @ingroup iface_xdg_toplevel
   1284  */
   1285 #define XDG_TOPLEVEL_SET_MAXIMIZED_SINCE_VERSION 1
   1286 /**
   1287  * @ingroup iface_xdg_toplevel
   1288  */
   1289 #define XDG_TOPLEVEL_UNSET_MAXIMIZED_SINCE_VERSION 1
   1290 /**
   1291  * @ingroup iface_xdg_toplevel
   1292  */
   1293 #define XDG_TOPLEVEL_SET_FULLSCREEN_SINCE_VERSION 1
   1294 /**
   1295  * @ingroup iface_xdg_toplevel
   1296  */
   1297 #define XDG_TOPLEVEL_UNSET_FULLSCREEN_SINCE_VERSION 1
   1298 /**
   1299  * @ingroup iface_xdg_toplevel
   1300  */
   1301 #define XDG_TOPLEVEL_SET_MINIMIZED_SINCE_VERSION 1
   1302 
   1303 /** @ingroup iface_xdg_toplevel */
   1304 static inline void
   1305 xdg_toplevel_set_user_data(struct xdg_toplevel *xdg_toplevel, void *user_data)
   1306 {
   1307 	wl_proxy_set_user_data((struct wl_proxy *) xdg_toplevel, user_data);
   1308 }
   1309 
   1310 /** @ingroup iface_xdg_toplevel */
   1311 static inline void *
   1312 xdg_toplevel_get_user_data(struct xdg_toplevel *xdg_toplevel)
   1313 {
   1314 	return wl_proxy_get_user_data((struct wl_proxy *) xdg_toplevel);
   1315 }
   1316 
   1317 static inline uint32_t
   1318 xdg_toplevel_get_version(struct xdg_toplevel *xdg_toplevel)
   1319 {
   1320 	return wl_proxy_get_version((struct wl_proxy *) xdg_toplevel);
   1321 }
   1322 
   1323 /**
   1324  * @ingroup iface_xdg_toplevel
   1325  *
   1326  * This request destroys the role surface and unmaps the surface;
   1327  * see "Unmapping" behavior in interface section for details.
   1328  */
   1329 static inline void
   1330 xdg_toplevel_destroy(struct xdg_toplevel *xdg_toplevel)
   1331 {
   1332 	wl_proxy_marshal((struct wl_proxy *) xdg_toplevel,
   1333 			 XDG_TOPLEVEL_DESTROY);
   1334 
   1335 	wl_proxy_destroy((struct wl_proxy *) xdg_toplevel);
   1336 }
   1337 
   1338 /**
   1339  * @ingroup iface_xdg_toplevel
   1340  *
   1341  * Set the "parent" of this surface. This surface should be stacked
   1342  * above the parent surface and all other ancestor surfaces.
   1343  *
   1344  * Parent windows should be set on dialogs, toolboxes, or other
   1345  * "auxiliary" surfaces, so that the parent is raised when the dialog
   1346  * is raised.
   1347  *
   1348  * Setting a null parent for a child window removes any parent-child
   1349  * relationship for the child. Setting a null parent for a window which
   1350  * currently has no parent is a no-op.
   1351  *
   1352  * If the parent is unmapped then its children are managed as
   1353  * though the parent of the now-unmapped parent has become the
   1354  * parent of this surface. If no parent exists for the now-unmapped
   1355  * parent then the children are managed as though they have no
   1356  * parent surface.
   1357  */
   1358 static inline void
   1359 xdg_toplevel_set_parent(struct xdg_toplevel *xdg_toplevel, struct xdg_toplevel *parent)
   1360 {
   1361 	wl_proxy_marshal((struct wl_proxy *) xdg_toplevel,
   1362 			 XDG_TOPLEVEL_SET_PARENT, parent);
   1363 }
   1364 
   1365 /**
   1366  * @ingroup iface_xdg_toplevel
   1367  *
   1368  * Set a short title for the surface.
   1369  *
   1370  * This string may be used to identify the surface in a task bar,
   1371  * window list, or other user interface elements provided by the
   1372  * compositor.
   1373  *
   1374  * The string must be encoded in UTF-8.
   1375  */
   1376 static inline void
   1377 xdg_toplevel_set_title(struct xdg_toplevel *xdg_toplevel, const char *title)
   1378 {
   1379 	wl_proxy_marshal((struct wl_proxy *) xdg_toplevel,
   1380 			 XDG_TOPLEVEL_SET_TITLE, title);
   1381 }
   1382 
   1383 /**
   1384  * @ingroup iface_xdg_toplevel
   1385  *
   1386  * Set an application identifier for the surface.
   1387  *
   1388  * The app ID identifies the general class of applications to which
   1389  * the surface belongs. The compositor can use this to group multiple
   1390  * surfaces together, or to determine how to launch a new application.
   1391  *
   1392  * For D-Bus activatable applications, the app ID is used as the D-Bus
   1393  * service name.
   1394  *
   1395  * The compositor shell will try to group application surfaces together
   1396  * by their app ID. As a best practice, it is suggested to select app
   1397  * ID's that match the basename of the application's .desktop file.
   1398  * For example, "org.freedesktop.FooViewer" where the .desktop file is
   1399  * "org.freedesktop.FooViewer.desktop".
   1400  *
   1401  * Like other properties, a set_app_id request can be sent after the
   1402  * xdg_toplevel has been mapped to update the property.
   1403  *
   1404  * See the desktop-entry specification [0] for more details on
   1405  * application identifiers and how they relate to well-known D-Bus
   1406  * names and .desktop files.
   1407  *
   1408  * [0] http://standards.freedesktop.org/desktop-entry-spec/
   1409  */
   1410 static inline void
   1411 xdg_toplevel_set_app_id(struct xdg_toplevel *xdg_toplevel, const char *app_id)
   1412 {
   1413 	wl_proxy_marshal((struct wl_proxy *) xdg_toplevel,
   1414 			 XDG_TOPLEVEL_SET_APP_ID, app_id);
   1415 }
   1416 
   1417 /**
   1418  * @ingroup iface_xdg_toplevel
   1419  *
   1420  * Clients implementing client-side decorations might want to show
   1421  * a context menu when right-clicking on the decorations, giving the
   1422  * user a menu that they can use to maximize or minimize the window.
   1423  *
   1424  * This request asks the compositor to pop up such a window menu at
   1425  * the given position, relative to the local surface coordinates of
   1426  * the parent surface. There are no guarantees as to what menu items
   1427  * the window menu contains.
   1428  *
   1429  * This request must be used in response to some sort of user action
   1430  * like a button press, key press, or touch down event.
   1431  */
   1432 static inline void
   1433 xdg_toplevel_show_window_menu(struct xdg_toplevel *xdg_toplevel, struct wl_seat *seat, uint32_t serial, int32_t x, int32_t y)
   1434 {
   1435 	wl_proxy_marshal((struct wl_proxy *) xdg_toplevel,
   1436 			 XDG_TOPLEVEL_SHOW_WINDOW_MENU, seat, serial, x, y);
   1437 }
   1438 
   1439 /**
   1440  * @ingroup iface_xdg_toplevel
   1441  *
   1442  * Start an interactive, user-driven move of the surface.
   1443  *
   1444  * This request must be used in response to some sort of user action
   1445  * like a button press, key press, or touch down event. The passed
   1446  * serial is used to determine the type of interactive move (touch,
   1447  * pointer, etc).
   1448  *
   1449  * The server may ignore move requests depending on the state of
   1450  * the surface (e.g. fullscreen or maximized), or if the passed serial
   1451  * is no longer valid.
   1452  *
   1453  * If triggered, the surface will lose the focus of the device
   1454  * (wl_pointer, wl_touch, etc) used for the move. It is up to the
   1455  * compositor to visually indicate that the move is taking place, such as
   1456  * updating a pointer cursor, during the move. There is no guarantee
   1457  * that the device focus will return when the move is completed.
   1458  */
   1459 static inline void
   1460 xdg_toplevel_move(struct xdg_toplevel *xdg_toplevel, struct wl_seat *seat, uint32_t serial)
   1461 {
   1462 	wl_proxy_marshal((struct wl_proxy *) xdg_toplevel,
   1463 			 XDG_TOPLEVEL_MOVE, seat, serial);
   1464 }
   1465 
   1466 /**
   1467  * @ingroup iface_xdg_toplevel
   1468  *
   1469  * Start a user-driven, interactive resize of the surface.
   1470  *
   1471  * This request must be used in response to some sort of user action
   1472  * like a button press, key press, or touch down event. The passed
   1473  * serial is used to determine the type of interactive resize (touch,
   1474  * pointer, etc).
   1475  *
   1476  * The server may ignore resize requests depending on the state of
   1477  * the surface (e.g. fullscreen or maximized).
   1478  *
   1479  * If triggered, the client will receive configure events with the
   1480  * "resize" state enum value and the expected sizes. See the "resize"
   1481  * enum value for more details about what is required. The client
   1482  * must also acknowledge configure events using "ack_configure". After
   1483  * the resize is completed, the client will receive another "configure"
   1484  * event without the resize state.
   1485  *
   1486  * If triggered, the surface also will lose the focus of the device
   1487  * (wl_pointer, wl_touch, etc) used for the resize. It is up to the
   1488  * compositor to visually indicate that the resize is taking place,
   1489  * such as updating a pointer cursor, during the resize. There is no
   1490  * guarantee that the device focus will return when the resize is
   1491  * completed.
   1492  *
   1493  * The edges parameter specifies how the surface should be resized,
   1494  * and is one of the values of the resize_edge enum. The compositor
   1495  * may use this information to update the surface position for
   1496  * example when dragging the top left corner. The compositor may also
   1497  * use this information to adapt its behavior, e.g. choose an
   1498  * appropriate cursor image.
   1499  */
   1500 static inline void
   1501 xdg_toplevel_resize(struct xdg_toplevel *xdg_toplevel, struct wl_seat *seat, uint32_t serial, uint32_t edges)
   1502 {
   1503 	wl_proxy_marshal((struct wl_proxy *) xdg_toplevel,
   1504 			 XDG_TOPLEVEL_RESIZE, seat, serial, edges);
   1505 }
   1506 
   1507 /**
   1508  * @ingroup iface_xdg_toplevel
   1509  *
   1510  * Set a maximum size for the window.
   1511  *
   1512  * The client can specify a maximum size so that the compositor does
   1513  * not try to configure the window beyond this size.
   1514  *
   1515  * The width and height arguments are in window geometry coordinates.
   1516  * See xdg_surface.set_window_geometry.
   1517  *
   1518  * Values set in this way are double-buffered. They will get applied
   1519  * on the next commit.
   1520  *
   1521  * The compositor can use this information to allow or disallow
   1522  * different states like maximize or fullscreen and draw accurate
   1523  * animations.
   1524  *
   1525  * Similarly, a tiling window manager may use this information to
   1526  * place and resize client windows in a more effective way.
   1527  *
   1528  * The client should not rely on the compositor to obey the maximum
   1529  * size. The compositor may decide to ignore the values set by the
   1530  * client and request a larger size.
   1531  *
   1532  * If never set, or a value of zero in the request, means that the
   1533  * client has no expected maximum size in the given dimension.
   1534  * As a result, a client wishing to reset the maximum size
   1535  * to an unspecified state can use zero for width and height in the
   1536  * request.
   1537  *
   1538  * Requesting a maximum size to be smaller than the minimum size of
   1539  * a surface is illegal and will result in a protocol error.
   1540  *
   1541  * The width and height must be greater than or equal to zero. Using
   1542  * strictly negative values for width and height will result in a
   1543  * protocol error.
   1544  */
   1545 static inline void
   1546 xdg_toplevel_set_max_size(struct xdg_toplevel *xdg_toplevel, int32_t width, int32_t height)
   1547 {
   1548 	wl_proxy_marshal((struct wl_proxy *) xdg_toplevel,
   1549 			 XDG_TOPLEVEL_SET_MAX_SIZE, width, height);
   1550 }
   1551 
   1552 /**
   1553  * @ingroup iface_xdg_toplevel
   1554  *
   1555  * Set a minimum size for the window.
   1556  *
   1557  * The client can specify a minimum size so that the compositor does
   1558  * not try to configure the window below this size.
   1559  *
   1560  * The width and height arguments are in window geometry coordinates.
   1561  * See xdg_surface.set_window_geometry.
   1562  *
   1563  * Values set in this way are double-buffered. They will get applied
   1564  * on the next commit.
   1565  *
   1566  * The compositor can use this information to allow or disallow
   1567  * different states like maximize or fullscreen and draw accurate
   1568  * animations.
   1569  *
   1570  * Similarly, a tiling window manager may use this information to
   1571  * place and resize client windows in a more effective way.
   1572  *
   1573  * The client should not rely on the compositor to obey the minimum
   1574  * size. The compositor may decide to ignore the values set by the
   1575  * client and request a smaller size.
   1576  *
   1577  * If never set, or a value of zero in the request, means that the
   1578  * client has no expected minimum size in the given dimension.
   1579  * As a result, a client wishing to reset the minimum size
   1580  * to an unspecified state can use zero for width and height in the
   1581  * request.
   1582  *
   1583  * Requesting a minimum size to be larger than the maximum size of
   1584  * a surface is illegal and will result in a protocol error.
   1585  *
   1586  * The width and height must be greater than or equal to zero. Using
   1587  * strictly negative values for width and height will result in a
   1588  * protocol error.
   1589  */
   1590 static inline void
   1591 xdg_toplevel_set_min_size(struct xdg_toplevel *xdg_toplevel, int32_t width, int32_t height)
   1592 {
   1593 	wl_proxy_marshal((struct wl_proxy *) xdg_toplevel,
   1594 			 XDG_TOPLEVEL_SET_MIN_SIZE, width, height);
   1595 }
   1596 
   1597 /**
   1598  * @ingroup iface_xdg_toplevel
   1599  *
   1600  * Maximize the surface.
   1601  *
   1602  * After requesting that the surface should be maximized, the compositor
   1603  * will respond by emitting a configure event. Whether this configure
   1604  * actually sets the window maximized is subject to compositor policies.
   1605  * The client must then update its content, drawing in the configured
   1606  * state. The client must also acknowledge the configure when committing
   1607  * the new content (see ack_configure).
   1608  *
   1609  * It is up to the compositor to decide how and where to maximize the
   1610  * surface, for example which output and what region of the screen should
   1611  * be used.
   1612  *
   1613  * If the surface was already maximized, the compositor will still emit
   1614  * a configure event with the "maximized" state.
   1615  *
   1616  * If the surface is in a fullscreen state, this request has no direct
   1617  * effect. It may alter the state the surface is returned to when
   1618  * unmaximized unless overridden by the compositor.
   1619  */
   1620 static inline void
   1621 xdg_toplevel_set_maximized(struct xdg_toplevel *xdg_toplevel)
   1622 {
   1623 	wl_proxy_marshal((struct wl_proxy *) xdg_toplevel,
   1624 			 XDG_TOPLEVEL_SET_MAXIMIZED);
   1625 }
   1626 
   1627 /**
   1628  * @ingroup iface_xdg_toplevel
   1629  *
   1630  * Unmaximize the surface.
   1631  *
   1632  * After requesting that the surface should be unmaximized, the compositor
   1633  * will respond by emitting a configure event. Whether this actually
   1634  * un-maximizes the window is subject to compositor policies.
   1635  * If available and applicable, the compositor will include the window
   1636  * geometry dimensions the window had prior to being maximized in the
   1637  * configure event. The client must then update its content, drawing it in
   1638  * the configured state. The client must also acknowledge the configure
   1639  * when committing the new content (see ack_configure).
   1640  *
   1641  * It is up to the compositor to position the surface after it was
   1642  * unmaximized; usually the position the surface had before maximizing, if
   1643  * applicable.
   1644  *
   1645  * If the surface was already not maximized, the compositor will still
   1646  * emit a configure event without the "maximized" state.
   1647  *
   1648  * If the surface is in a fullscreen state, this request has no direct
   1649  * effect. It may alter the state the surface is returned to when
   1650  * unmaximized unless overridden by the compositor.
   1651  */
   1652 static inline void
   1653 xdg_toplevel_unset_maximized(struct xdg_toplevel *xdg_toplevel)
   1654 {
   1655 	wl_proxy_marshal((struct wl_proxy *) xdg_toplevel,
   1656 			 XDG_TOPLEVEL_UNSET_MAXIMIZED);
   1657 }
   1658 
   1659 /**
   1660  * @ingroup iface_xdg_toplevel
   1661  *
   1662  * Make the surface fullscreen.
   1663  *
   1664  * After requesting that the surface should be fullscreened, the
   1665  * compositor will respond by emitting a configure event. Whether the
   1666  * client is actually put into a fullscreen state is subject to compositor
   1667  * policies. The client must also acknowledge the configure when
   1668  * committing the new content (see ack_configure).
   1669  *
   1670  * The output passed by the request indicates the client's preference as
   1671  * to which display it should be set fullscreen on. If this value is NULL,
   1672  * it's up to the compositor to choose which display will be used to map
   1673  * this surface.
   1674  *
   1675  * If the surface doesn't cover the whole output, the compositor will
   1676  * position the surface in the center of the output and compensate with
   1677  * with border fill covering the rest of the output. The content of the
   1678  * border fill is undefined, but should be assumed to be in some way that
   1679  * attempts to blend into the surrounding area (e.g. solid black).
   1680  *
   1681  * If the fullscreened surface is not opaque, the compositor must make
   1682  * sure that other screen content not part of the same surface tree (made
   1683  * up of subsurfaces, popups or similarly coupled surfaces) are not
   1684  * visible below the fullscreened surface.
   1685  */
   1686 static inline void
   1687 xdg_toplevel_set_fullscreen(struct xdg_toplevel *xdg_toplevel, struct wl_output *output)
   1688 {
   1689 	wl_proxy_marshal((struct wl_proxy *) xdg_toplevel,
   1690 			 XDG_TOPLEVEL_SET_FULLSCREEN, output);
   1691 }
   1692 
   1693 /**
   1694  * @ingroup iface_xdg_toplevel
   1695  *
   1696  * Make the surface no longer fullscreen.
   1697  *
   1698  * After requesting that the surface should be unfullscreened, the
   1699  * compositor will respond by emitting a configure event.
   1700  * Whether this actually removes the fullscreen state of the client is
   1701  * subject to compositor policies.
   1702  *
   1703  * Making a surface unfullscreen sets states for the surface based on the following:
   1704  * * the state(s) it may have had before becoming fullscreen
   1705  * * any state(s) decided by the compositor
   1706  * * any state(s) requested by the client while the surface was fullscreen
   1707  *
   1708  * The compositor may include the previous window geometry dimensions in
   1709  * the configure event, if applicable.
   1710  *
   1711  * The client must also acknowledge the configure when committing the new
   1712  * content (see ack_configure).
   1713  */
   1714 static inline void
   1715 xdg_toplevel_unset_fullscreen(struct xdg_toplevel *xdg_toplevel)
   1716 {
   1717 	wl_proxy_marshal((struct wl_proxy *) xdg_toplevel,
   1718 			 XDG_TOPLEVEL_UNSET_FULLSCREEN);
   1719 }
   1720 
   1721 /**
   1722  * @ingroup iface_xdg_toplevel
   1723  *
   1724  * Request that the compositor minimize your surface. There is no
   1725  * way to know if the surface is currently minimized, nor is there
   1726  * any way to unset minimization on this surface.
   1727  *
   1728  * If you are looking to throttle redrawing when minimized, please
   1729  * instead use the wl_surface.frame event for this, as this will
   1730  * also work with live previews on windows in Alt-Tab, Expose or
   1731  * similar compositor features.
   1732  */
   1733 static inline void
   1734 xdg_toplevel_set_minimized(struct xdg_toplevel *xdg_toplevel)
   1735 {
   1736 	wl_proxy_marshal((struct wl_proxy *) xdg_toplevel,
   1737 			 XDG_TOPLEVEL_SET_MINIMIZED);
   1738 }
   1739 
   1740 #ifndef XDG_POPUP_ERROR_ENUM
   1741 #define XDG_POPUP_ERROR_ENUM
   1742 enum xdg_popup_error {
   1743 	/**
   1744 	 * tried to grab after being mapped
   1745 	 */
   1746 	XDG_POPUP_ERROR_INVALID_GRAB = 0,
   1747 };
   1748 #endif /* XDG_POPUP_ERROR_ENUM */
   1749 
   1750 /**
   1751  * @ingroup iface_xdg_popup
   1752  * @struct xdg_popup_listener
   1753  */
   1754 struct xdg_popup_listener {
   1755 	/**
   1756 	 * configure the popup surface
   1757 	 *
   1758 	 * This event asks the popup surface to configure itself given
   1759 	 * the configuration. The configured state should not be applied
   1760 	 * immediately. See xdg_surface.configure for details.
   1761 	 *
   1762 	 * The x and y arguments represent the position the popup was
   1763 	 * placed at given the xdg_positioner rule, relative to the upper
   1764 	 * left corner of the window geometry of the parent surface.
   1765 	 *
   1766 	 * For version 2 or older, the configure event for an xdg_popup is
   1767 	 * only ever sent once for the initial configuration. Starting with
   1768 	 * version 3, it may be sent again if the popup is setup with an
   1769 	 * xdg_positioner with set_reactive requested, or in response to
   1770 	 * xdg_popup.reposition requests.
   1771 	 * @param x x position relative to parent surface window geometry
   1772 	 * @param y y position relative to parent surface window geometry
   1773 	 * @param width window geometry width
   1774 	 * @param height window geometry height
   1775 	 */
   1776 	void (*configure)(void *data,
   1777 			  struct xdg_popup *xdg_popup,
   1778 			  int32_t x,
   1779 			  int32_t y,
   1780 			  int32_t width,
   1781 			  int32_t height);
   1782 	/**
   1783 	 * popup interaction is done
   1784 	 *
   1785 	 * The popup_done event is sent out when a popup is dismissed by
   1786 	 * the compositor. The client should destroy the xdg_popup object
   1787 	 * at this point.
   1788 	 */
   1789 	void (*popup_done)(void *data,
   1790 			   struct xdg_popup *xdg_popup);
   1791 	/**
   1792 	 * signal the completion of a repositioned request
   1793 	 *
   1794 	 * The repositioned event is sent as part of a popup
   1795 	 * configuration sequence, together with xdg_popup.configure and
   1796 	 * lastly xdg_surface.configure to notify the completion of a
   1797 	 * reposition request.
   1798 	 *
   1799 	 * The repositioned event is to notify about the completion of a
   1800 	 * xdg_popup.reposition request. The token argument is the token
   1801 	 * passed in the xdg_popup.reposition request.
   1802 	 *
   1803 	 * Immediately after this event is emitted, xdg_popup.configure and
   1804 	 * xdg_surface.configure will be sent with the updated size and
   1805 	 * position, as well as a new configure serial.
   1806 	 *
   1807 	 * The client should optionally update the content of the popup,
   1808 	 * but must acknowledge the new popup configuration for the new
   1809 	 * position to take effect. See xdg_surface.ack_configure for
   1810 	 * details.
   1811 	 * @param token reposition request token
   1812 	 * @since 3
   1813 	 */
   1814 	void (*repositioned)(void *data,
   1815 			     struct xdg_popup *xdg_popup,
   1816 			     uint32_t token);
   1817 };
   1818 
   1819 /**
   1820  * @ingroup iface_xdg_popup
   1821  */
   1822 static inline int
   1823 xdg_popup_add_listener(struct xdg_popup *xdg_popup,
   1824 		       const struct xdg_popup_listener *listener, void *data)
   1825 {
   1826 	return wl_proxy_add_listener((struct wl_proxy *) xdg_popup,
   1827 				     (void (**)(void)) listener, data);
   1828 }
   1829 
   1830 #define XDG_POPUP_DESTROY 0
   1831 #define XDG_POPUP_GRAB 1
   1832 #define XDG_POPUP_REPOSITION 2
   1833 
   1834 /**
   1835  * @ingroup iface_xdg_popup
   1836  */
   1837 #define XDG_POPUP_CONFIGURE_SINCE_VERSION 1
   1838 /**
   1839  * @ingroup iface_xdg_popup
   1840  */
   1841 #define XDG_POPUP_POPUP_DONE_SINCE_VERSION 1
   1842 /**
   1843  * @ingroup iface_xdg_popup
   1844  */
   1845 #define XDG_POPUP_REPOSITIONED_SINCE_VERSION 3
   1846 
   1847 /**
   1848  * @ingroup iface_xdg_popup
   1849  */
   1850 #define XDG_POPUP_DESTROY_SINCE_VERSION 1
   1851 /**
   1852  * @ingroup iface_xdg_popup
   1853  */
   1854 #define XDG_POPUP_GRAB_SINCE_VERSION 1
   1855 /**
   1856  * @ingroup iface_xdg_popup
   1857  */
   1858 #define XDG_POPUP_REPOSITION_SINCE_VERSION 3
   1859 
   1860 /** @ingroup iface_xdg_popup */
   1861 static inline void
   1862 xdg_popup_set_user_data(struct xdg_popup *xdg_popup, void *user_data)
   1863 {
   1864 	wl_proxy_set_user_data((struct wl_proxy *) xdg_popup, user_data);
   1865 }
   1866 
   1867 /** @ingroup iface_xdg_popup */
   1868 static inline void *
   1869 xdg_popup_get_user_data(struct xdg_popup *xdg_popup)
   1870 {
   1871 	return wl_proxy_get_user_data((struct wl_proxy *) xdg_popup);
   1872 }
   1873 
   1874 static inline uint32_t
   1875 xdg_popup_get_version(struct xdg_popup *xdg_popup)
   1876 {
   1877 	return wl_proxy_get_version((struct wl_proxy *) xdg_popup);
   1878 }
   1879 
   1880 /**
   1881  * @ingroup iface_xdg_popup
   1882  *
   1883  * This destroys the popup. Explicitly destroying the xdg_popup
   1884  * object will also dismiss the popup, and unmap the surface.
   1885  *
   1886  * If this xdg_popup is not the "topmost" popup, a protocol error
   1887  * will be sent.
   1888  */
   1889 static inline void
   1890 xdg_popup_destroy(struct xdg_popup *xdg_popup)
   1891 {
   1892 	wl_proxy_marshal((struct wl_proxy *) xdg_popup,
   1893 			 XDG_POPUP_DESTROY);
   1894 
   1895 	wl_proxy_destroy((struct wl_proxy *) xdg_popup);
   1896 }
   1897 
   1898 /**
   1899  * @ingroup iface_xdg_popup
   1900  *
   1901  * This request makes the created popup take an explicit grab. An explicit
   1902  * grab will be dismissed when the user dismisses the popup, or when the
   1903  * client destroys the xdg_popup. This can be done by the user clicking
   1904  * outside the surface, using the keyboard, or even locking the screen
   1905  * through closing the lid or a timeout.
   1906  *
   1907  * If the compositor denies the grab, the popup will be immediately
   1908  * dismissed.
   1909  *
   1910  * This request must be used in response to some sort of user action like a
   1911  * button press, key press, or touch down event. The serial number of the
   1912  * event should be passed as 'serial'.
   1913  *
   1914  * The parent of a grabbing popup must either be an xdg_toplevel surface or
   1915  * another xdg_popup with an explicit grab. If the parent is another
   1916  * xdg_popup it means that the popups are nested, with this popup now being
   1917  * the topmost popup.
   1918  *
   1919  * Nested popups must be destroyed in the reverse order they were created
   1920  * in, e.g. the only popup you are allowed to destroy at all times is the
   1921  * topmost one.
   1922  *
   1923  * When compositors choose to dismiss a popup, they may dismiss every
   1924  * nested grabbing popup as well. When a compositor dismisses popups, it
   1925  * will follow the same dismissing order as required from the client.
   1926  *
   1927  * The parent of a grabbing popup must either be another xdg_popup with an
   1928  * active explicit grab, or an xdg_popup or xdg_toplevel, if there are no
   1929  * explicit grabs already taken.
   1930  *
   1931  * If the topmost grabbing popup is destroyed, the grab will be returned to
   1932  * the parent of the popup, if that parent previously had an explicit grab.
   1933  *
   1934  * If the parent is a grabbing popup which has already been dismissed, this
   1935  * popup will be immediately dismissed. If the parent is a popup that did
   1936  * not take an explicit grab, an error will be raised.
   1937  *
   1938  * During a popup grab, the client owning the grab will receive pointer
   1939  * and touch events for all their surfaces as normal (similar to an
   1940  * "owner-events" grab in X11 parlance), while the top most grabbing popup
   1941  * will always have keyboard focus.
   1942  */
   1943 static inline void
   1944 xdg_popup_grab(struct xdg_popup *xdg_popup, struct wl_seat *seat, uint32_t serial)
   1945 {
   1946 	wl_proxy_marshal((struct wl_proxy *) xdg_popup,
   1947 			 XDG_POPUP_GRAB, seat, serial);
   1948 }
   1949 
   1950 /**
   1951  * @ingroup iface_xdg_popup
   1952  *
   1953  * Reposition an already-mapped popup. The popup will be placed given the
   1954  * details in the passed xdg_positioner object, and a
   1955  * xdg_popup.repositioned followed by xdg_popup.configure and
   1956  * xdg_surface.configure will be emitted in response. Any parameters set
   1957  * by the previous positioner will be discarded.
   1958  *
   1959  * The passed token will be sent in the corresponding
   1960  * xdg_popup.repositioned event. The new popup position will not take
   1961  * effect until the corresponding configure event is acknowledged by the
   1962  * client. See xdg_popup.repositioned for details. The token itself is
   1963  * opaque, and has no other special meaning.
   1964  *
   1965  * If multiple reposition requests are sent, the compositor may skip all
   1966  * but the last one.
   1967  *
   1968  * If the popup is repositioned in response to a configure event for its
   1969  * parent, the client should send an xdg_positioner.set_parent_configure
   1970  * and possibly an xdg_positioner.set_parent_size request to allow the
   1971  * compositor to properly constrain the popup.
   1972  *
   1973  * If the popup is repositioned together with a parent that is being
   1974  * resized, but not in response to a configure event, the client should
   1975  * send an xdg_positioner.set_parent_size request.
   1976  */
   1977 static inline void
   1978 xdg_popup_reposition(struct xdg_popup *xdg_popup, struct xdg_positioner *positioner, uint32_t token)
   1979 {
   1980 	wl_proxy_marshal((struct wl_proxy *) xdg_popup,
   1981 			 XDG_POPUP_REPOSITION, positioner, token);
   1982 }
   1983 
   1984 #ifdef  __cplusplus
   1985 }
   1986 #endif
   1987 
   1988 #endif