wayland_xdg_shell.h raw

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