dotfiles

my shiny new dotfiles
git clone git://git.jakekoroman.com/dotfiles
Log | Files | Refs | README

xdg-shell-protocol.h (83615B)


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