github.com/Seikaijyu/gio@v0.0.1/app/wayland_xdg_shell.h (about)

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