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