fordon_greeman / moosicpalyer

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