AtlatestRepositorysigil-ui

sigil-ui / tree / native / wayland / includewayland-util.h

1/*
2 * Copyright © 2008 Kristian Høgsberg
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining
5 * a copy of this software and associated documentation files (the
6 * "Software"), to deal in the Software without restriction, including
7 * without limitation the rights to use, copy, modify, merge, publish,
8 * distribute, sublicense, and/or sell copies of the Software, and to
9 * permit persons to whom the Software is furnished to do so, subject to
10 * the following conditions:
11 *
12 * The above copyright notice and this permission notice (including the
13 * next paragraph) shall be included in all copies or substantial
14 * portions of the Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
20 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
21 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
22 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23 * SOFTWARE.
24 */
26/** \file wayland-util.h
27 *
28 * \brief Utility classes, functions, and macros.
29 */
31#ifndef WAYLAND_UTIL_H
32#define WAYLAND_UTIL_H
34#include <math.h>
35#include <stddef.h>
36#include <inttypes.h>
37#include <stdarg.h>
39#ifdef __cplusplus
40extern "C" {
41#endif
43/** Visibility attribute */
44#if defined(__GNUC__) && __GNUC__ >= 4
45#define WL_EXPORT __attribute__ ((visibility("default")))
46#else
47#define WL_EXPORT
48#endif
50/** Deprecated attribute */
51#if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 202311L) || (defined(__cplusplus) && __cplusplus >= 201402L)
52#define WL_DEPRECATED [[deprecated]]
53#elif defined(__GNUC__) && __GNUC__ >= 4
54#define WL_DEPRECATED __attribute__ ((deprecated))
55#else
56#define WL_DEPRECATED
57#endif
59/**
60 * Printf-style argument attribute
61 *
62 * \param x Ordinality of the format string argument
63 * \param y Ordinality of the argument to check against the format string
64 *
65 * \sa https://gcc.gnu.org/onlinedocs/gcc-3.2.1/gcc/Function-Attributes.html
66 */
67#if defined(__GNUC__) && __GNUC__ >= 4
68#define WL_PRINTF(x, y) __attribute__((__format__(__printf__, x, y)))
69#else
70#define WL_PRINTF(x, y)
71#endif
73#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 202311L
74#define WL_TYPEOF(expr) typeof(expr)
75#else
76#define WL_TYPEOF(expr) __typeof__(expr)
77#endif
79/** \class wl_object
80 *
81 * \brief A protocol object.
82 *
83 * A `wl_object` is an opaque struct identifying the protocol object
84 * underlying a `wl_proxy` or `wl_resource`.
85 *
86 * \note Functions accessing a `wl_object` are not normally used by client code.
87 * Clients should normally use the higher level interface generated by the
88 * scanner to interact with compositor objects.
89 *
90 */
91struct wl_object;
93/**
94 * The maximum size of a protocol message.
95 *
96 * If a message size exceeds this value, the connection will be dropped.
97 * Servers will send an invalid_method error before disconnecting.
98 */
99#define WL_MAX_MESSAGE_SIZE 4096
101/**
102 * Protocol message signature
103 *
104 * A wl_message describes the signature of an actual protocol message, such as a
105 * request or event, that adheres to the Wayland protocol wire format. The
106 * protocol implementation uses a wl_message within its demarshal machinery for
107 * decoding messages between a compositor and its clients. In a sense, a
108 * wl_message is to a protocol message like a class is to an object.
109 *
110 * The `name` of a wl_message is the name of the corresponding protocol message.
111 *
112 * The `signature` is an ordered list of symbols representing the data types
113 * of message arguments and, optionally, a protocol version and indicators for
114 * nullability. A leading integer in the `signature` indicates the _since_
115 * version of the protocol message. A `?` preceding a data type symbol indicates
116 * that the following argument type is nullable. While it is a protocol violation
117 * to send messages with non-nullable arguments set to `NULL`, event handlers in
118 * clients might still get called with non-nullable object arguments set to
119 * `NULL`. This can happen when the client destroyed the object being used as
120 * argument on its side and an event referencing that object was sent before the
121 * server knew about its destruction. As this race cannot be prevented, clients
122 * should - as a general rule - program their event handlers such that they can
123 * handle object arguments declared non-nullable being `NULL` gracefully.
124 *
125 * When no arguments accompany a message, `signature` is an empty string.
126 *
127 * Symbols:
128 *
129 * * `i`: int
130 * * `u`: uint
131 * * `f`: fixed
132 * * `s`: string
133 * * `o`: object
134 * * `n`: new_id
135 * * `a`: array
136 * * `h`: fd
137 * * `?`: following argument (`o` or `s`) is nullable
138 *
139 * While demarshaling primitive arguments is straightforward, when demarshaling
140 * messages containing `object` or `new_id` arguments, the protocol
141 * implementation often must determine the type of the object. The `types` of a
142 * wl_message is an array of wl_interface references that correspond to `o` and
143 * `n` arguments in `signature`, with `NULL` placeholders for arguments with
144 * non-object types.
145 *
146 * Consider the protocol event wl_display `delete_id` that has a single `uint`
147 * argument. The wl_message is:
148 *
149 * \code
150 * { "delete_id", "u", [NULL] }
151 * \endcode
152 *
153 * Here, the message `name` is `"delete_id"`, the `signature` is `"u"`, and the
154 * argument `types` is `[NULL]`, indicating that the `uint` argument has no
155 * corresponding wl_interface since it is a primitive argument.
156 *
157 * In contrast, consider a `wl_foo` interface supporting protocol request `bar`
158 * that has existed since version 2, and has two arguments: a `uint` and an
159 * object of type `wl_baz_interface` that may be `NULL`. Such a `wl_message`
160 * might be:
161 *
162 * \code
163 * { "bar", "2u?o", [NULL, &wl_baz_interface] }
164 * \endcode
165 *
166 * Here, the message `name` is `"bar"`, and the `signature` is `"2u?o"`. Notice
167 * how the `2` indicates the protocol version, the `u` indicates the first
168 * argument type is `uint`, and the `?o` indicates that the second argument
169 * is an object that may be `NULL`. Lastly, the argument `types` array indicates
170 * that no wl_interface corresponds to the first argument, while the type
171 * `wl_baz_interface` corresponds to the second argument.
172 *
173 * \sa wl_argument
174 * \sa wl_interface
175 * \sa <a href="https://wayland.freedesktop.org/docs/html/ch04.html#sect-Protocol-Wire-Format">Wire Format</a>
176 */
177struct wl_message {
178 /** Message name */
179 const char *name;
180 /** Message signature */
181 const char *signature;
182 /** Object argument interfaces */
183 const struct wl_interface **types;
184};
186/**
187 * Protocol object interface
188 *
189 * A wl_interface describes the API of a protocol object defined in the Wayland
190 * protocol specification. The protocol implementation uses a wl_interface
191 * within its marshalling machinery for encoding client requests.
192 *
193 * The `name` of a wl_interface is the name of the corresponding protocol
194 * interface, and `version` represents the version of the interface. The members
195 * `method_count` and `event_count` represent the number of `methods` (requests)
196 * and `events` in the respective wl_message members.
197 *
198 * For example, consider a protocol interface `foo`, marked as version `1`, with
199 * two requests and one event.
200 *
201 * \code{.xml}
202 * <interface name="foo" version="1">
203 * <request name="a"></request>
204 * <request name="b"></request>
205 * <event name="c"></event>
206 * </interface>
207 * \endcode
208 *
209 * Given two wl_message arrays `foo_requests` and `foo_events`, a wl_interface
210 * for `foo` might be:
211 *
212 * \code
213 * struct wl_interface foo_interface = {
214 * "foo", 1,
215 * 2, foo_requests,
216 * 1, foo_events
217 * };
218 * \endcode
219 *
220 * \note The server side of the protocol may define interface <em>implementation
221 * types</em> that incorporate the term `interface` in their name. Take
222 * care to not confuse these server-side `struct`s with a wl_interface
223 * variable whose name also ends in `interface`. For example, while the
224 * server may define a type `struct wl_foo_interface`, the client may
225 * define a `struct wl_interface wl_foo_interface`.
226 *
227 * \sa wl_message
228 * \sa wl_proxy
229 * \sa <a href="https://wayland.freedesktop.org/docs/html/ch04.html#sect-Protocol-Interfaces">Interfaces</a>
230 * \sa <a href="https://wayland.freedesktop.org/docs/html/ch04.html#sect-Protocol-Versioning">Versioning</a>
231 */
232struct wl_interface {
233 /** Interface name */
234 const char *name;
235 /** Interface version */
236 int version;
237 /** Number of methods (requests) */
238 int method_count;
239 /** Method (request) signatures */
240 const struct wl_message *methods;
241 /** Number of events */
242 int event_count;
243 /** Event signatures */
244 const struct wl_message *events;
245};
247/** \class wl_list
248 *
249 * \brief Doubly-linked list
250 *
251 * On its own, an instance of `struct wl_list` represents the sentinel head of
252 * a doubly-linked list, and must be initialized using wl_list_init().
253 * When empty, the list head's `next` and `prev` members point to the list head
254 * itself, otherwise `next` references the first element in the list, and `prev`
255 * refers to the last element in the list.
256 *
257 * Use the `struct wl_list` type to represent both the list head and the links
258 * between elements within the list. Use wl_list_empty() to determine if the
259 * list is empty in O(1).
260 *
261 * All elements in the list must be of the same type. The element type must have
262 * a `struct wl_list` member, often named `link` by convention. Prior to
263 * insertion, there is no need to initialize an element's `link` - invoking
264 * wl_list_init() on an individual list element's `struct wl_list` member is
265 * unnecessary if the very next operation is wl_list_insert(). However, a
266 * common idiom is to initialize an element's `link` prior to removal - ensure
267 * safety by invoking wl_list_init() before wl_list_remove().
268 *
269 * Consider a list reference `struct wl_list foo_list`, an element type as
270 * `struct element`, and an element's link member as `struct wl_list link`.
271 *
272 * The following code initializes a list and adds three elements to it.
273 *
274 * \code
275 * struct wl_list foo_list;
276 *
277 * struct element {
278 * int foo;
279 * struct wl_list link;
280 * };
281 * struct element e1, e2, e3;
282 *
283 * wl_list_init(&foo_list);
284 * wl_list_insert(&foo_list, &e1.link); // e1 is the first element
285 * wl_list_insert(&foo_list, &e2.link); // e2 is now the first element
286 * wl_list_insert(&e2.link, &e3.link); // insert e3 after e2
287 * \endcode
288 *
289 * The list now looks like <em>[e2, e3, e1]</em>.
290 *
291 * The `wl_list` API provides some iterator macros. For example, to iterate
292 * a list in ascending order:
293 *
294 * \code
295 * struct element *e;
296 * wl_list_for_each(e, foo_list, link) {
297 * do_something_with_element(e);
298 * }
299 * \endcode
300 *
301 * See the documentation of each iterator for details.
302 * \sa http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/include/linux/list.h
303 */
304struct wl_list {
305 /** Previous list element */
306 struct wl_list *prev;
307 /** Next list element */
308 struct wl_list *next;
309};
311/**
312 * Initializes the list.
313 *
314 * \param list List to initialize
315 *
316 * \memberof wl_list
317 */
318void
319wl_list_init(struct wl_list *list);
321/**
322 * Inserts an element into the list, after the element represented by \p list.
323 * When \p list is a reference to the list itself (the head), set the containing
324 * struct of \p elm as the first element in the list.
325 *
326 * \note If \p elm is already part of a list, inserting it again will lead to
327 * list corruption.
328 *
329 * \param list List element after which the new element is inserted
330 * \param elm Link of the containing struct to insert into the list
331 *
332 * \memberof wl_list
333 */
334void
335wl_list_insert(struct wl_list *list, struct wl_list *elm);
337/**
338 * Removes an element from the list.
339 *
340 * \note This operation leaves \p elm in an invalid state.
341 *
342 * \param elm Link of the containing struct to remove from the list
343 *
344 * \memberof wl_list
345 */
346void
347wl_list_remove(struct wl_list *elm);
349/**
350 * Determines the length of the list.
351 *
352 * \note This is an O(n) operation.
353 *
354 * \param list List whose length is to be determined
355 *
356 * \return Number of elements in the list
357 *
358 * \memberof wl_list
359 */
360int
361wl_list_length(const struct wl_list *list);
363/**
364 * Determines if the list is empty.
365 *
366 * \param list List whose emptiness is to be determined
367 *
368 * \return 1 if empty, or 0 if not empty
369 *
370 * \memberof wl_list
371 */
372int
373wl_list_empty(const struct wl_list *list);
375/**
376 * Inserts all of the elements of one list into another, after the element
377 * represented by \p list.
378 *
379 * \note This leaves \p other in an invalid state.
380 *
381 * \param list List element after which the other list elements will be inserted
382 * \param other List of elements to insert
383 *
384 * \memberof wl_list
385 */
386void
387wl_list_insert_list(struct wl_list *list, struct wl_list *other);
389/**
390 * Retrieves a pointer to a containing struct, given a member name.
391 *
392 * This macro allows "conversion" from a pointer to a member to its containing
393 * struct. This is useful if you have a contained item like a wl_list,
394 * wl_listener, or wl_signal, provided via a callback or other means, and would
395 * like to retrieve the struct that contains it.
396 *
397 * To demonstrate, the following example retrieves a pointer to
398 * `example_container` given only its `destroy_listener` member:
399 *
400 * \code
401 * struct example_container {
402 * struct wl_listener destroy_listener;
403 * // other members...
404 * };
405 *
406 * void example_container_destroy(struct wl_listener *listener, void *data)
407 * {
408 * struct example_container *ctr;
409 *
410 * ctr = wl_container_of(listener, ctr, destroy_listener);
411 * // destroy ctr...
412 * }
413 * \endcode
414 *
415 * \note `sample` need not be a valid pointer. A null or uninitialised pointer
416 * is sufficient.
417 *
418 * \param ptr Valid pointer to the contained member
419 * \param sample Pointer to a struct whose type contains \p ptr
420 * \param member Named location of \p ptr within the \p sample type
421 *
422 * \return The container for the specified pointer
423 */
424#define wl_container_of(ptr, sample, member) \
425 (WL_TYPEOF(sample))((char *)(ptr) - \
426 offsetof(WL_TYPEOF(*sample), member))
428/**
429 * Iterates over a list.
430 *
431 * This macro expresses a for-each iterator for wl_list. Given a list and
432 * wl_list link member name (often named `link` by convention), this macro
433 * assigns each element in the list to \p pos, which can then be referenced in
434 * a trailing code block. For example, given a wl_list of `struct message`
435 * elements:
436 *
437 * \code
438 * struct message {
439 * char *contents;
440 * wl_list link;
441 * };
442 *
443 * struct wl_list *message_list;
444 * // Assume message_list now "contains" many messages
445 *
446 * struct message *m;
447 * wl_list_for_each(m, message_list, link) {
448 * do_something_with_message(m);
449 * }
450 * \endcode
451 *
452 * \param pos Cursor that each list element will be assigned to
453 * \param head Head of the list to iterate over
454 * \param member Name of the link member within the element struct
455 *
456 * \relates wl_list
457 */
458#define wl_list_for_each(pos, head, member) \
459 for (pos = wl_container_of((head)->next, pos, member); \
460 &pos->member != (head); \
461 pos = wl_container_of(pos->member.next, pos, member))
463/**
464 * Iterates over a list, safe against removal of the list element.
465 *
466 * \note Only removal of the current element, \p pos, is safe. Removing
467 * any other element during traversal may lead to a loop malfunction.
468 *
469 * \sa wl_list_for_each()
470 *
471 * \param pos Cursor that each list element will be assigned to
472 * \param tmp Temporary pointer of the same type as \p pos
473 * \param head Head of the list to iterate over
474 * \param member Name of the link member within the element struct
475 *
476 * \relates wl_list
477 */
478#define wl_list_for_each_safe(pos, tmp, head, member) \
479 for (pos = wl_container_of((head)->next, pos, member), \
480 tmp = wl_container_of((pos)->member.next, tmp, member); \
481 &pos->member != (head); \
482 pos = tmp, \
483 tmp = wl_container_of(pos->member.next, tmp, member))
485/**
486 * Iterates backwards over a list.
487 *
488 * \sa wl_list_for_each()
489 *
490 * \param pos Cursor that each list element will be assigned to
491 * \param head Head of the list to iterate over
492 * \param member Name of the link member within the element struct
493 *
494 * \relates wl_list
495 */
496#define wl_list_for_each_reverse(pos, head, member) \
497 for (pos = wl_container_of((head)->prev, pos, member); \
498 &pos->member != (head); \
499 pos = wl_container_of(pos->member.prev, pos, member))
501/**
502 * Iterates backwards over a list, safe against removal of the list element.
503 *
504 * \note Only removal of the current element, \p pos, is safe. Removing
505 * any other element during traversal may lead to a loop malfunction.
506 *
507 * \sa wl_list_for_each()
508 *
509 * \param pos Cursor that each list element will be assigned to
510 * \param tmp Temporary pointer of the same type as \p pos
511 * \param head Head of the list to iterate over
512 * \param member Name of the link member within the element struct
513 *
514 * \relates wl_list
515 */
516#define wl_list_for_each_reverse_safe(pos, tmp, head, member) \
517 for (pos = wl_container_of((head)->prev, pos, member), \
518 tmp = wl_container_of((pos)->member.prev, tmp, member); \
519 &pos->member != (head); \
520 pos = tmp, \
521 tmp = wl_container_of(pos->member.prev, tmp, member))
523/**
524 * \class wl_array
525 *
526 * Dynamic array
527 *
528 * A wl_array is a dynamic array that can only grow until released. It is
529 * intended for relatively small allocations whose size is variable or not known
530 * in advance. While construction of a wl_array does not require all elements to
531 * be of the same size, wl_array_for_each() does require all elements to have
532 * the same type and size.
533 *
534 */
535struct wl_array {
536 /** Array size */
537 size_t size;
538 /** Allocated space */
539 size_t alloc;
540 /** Array data */
541 void *data;
542};
544/**
545 * Initializes the array.
546 *
547 * \param array Array to initialize
548 *
549 * \memberof wl_array
550 */
551void
552wl_array_init(struct wl_array *array);
554/**
555 * Releases the array data.
556 *
557 * \note Leaves the array in an invalid state.
558 *
559 * \param array Array whose data is to be released
560 *
561 * \memberof wl_array
562 */
563void
564wl_array_release(struct wl_array *array);
566/**
567 * Increases the size of the array by \p size bytes.
568 *
569 * \param array Array whose size is to be increased
570 * \param size Number of bytes to increase the size of the array by
571 *
572 * \return A pointer to the beginning of the newly appended space, or NULL when
573 * resizing fails.
574 *
575 * \memberof wl_array
576 */
577void *
578wl_array_add(struct wl_array *array, size_t size);
580/**
581 * Copies the contents of \p source to \p array.
582 *
583 * \param array Destination array to copy to
584 * \param source Source array to copy from
585 *
586 * \return 0 on success, or -1 on failure
587 *
588 * \memberof wl_array
589 */
590int
591wl_array_copy(struct wl_array *array, struct wl_array *source);
593/**
594 * Iterates over an array.
595 *
596 * This macro expresses a for-each iterator for wl_array. It assigns each
597 * element in the array to \p pos, which can then be referenced in a trailing
598 * code block. \p pos must be a pointer to the array element type, and all
599 * array elements must be of the same type and size.
600 *
601 * \param pos Cursor that each array element will be assigned to
602 * \param array Array to iterate over
603 *
604 * \relates wl_array
605 * \sa wl_list_for_each()
606 */
607#define wl_array_for_each(pos, array) \
608 for (pos = (array)->data; \
609 (array)->size != 0 && \
610 (const char *) pos < ((const char *) (array)->data + (array)->size); \
611 (pos)++)
613/**
614 * Fixed-point number
615 *
616 * A `wl_fixed_t` is a 24.8 signed fixed-point number with a sign bit, 23 bits
617 * of integer precision and 8 bits of decimal precision. Consider `wl_fixed_t`
618 * as an opaque struct with methods that facilitate conversion to and from
619 * `double` and `int` types.
620 */
621typedef int32_t wl_fixed_t;
623/**
624 * Converts a fixed-point number to a floating-point number.
625 *
626 * \param f Fixed-point number to convert
627 *
628 * \return Floating-point representation of the fixed-point argument
629 */
630static inline double
631wl_fixed_to_double(wl_fixed_t f)
633 return f / 256.0;
636/**
637 * Converts a floating-point number to a fixed-point number.
638 *
639 * \param d Floating-point number to convert
640 *
641 * \return Fixed-point representation of the floating-point argument
642 */
643static inline wl_fixed_t
644wl_fixed_from_double(double d)
646 return (wl_fixed_t) (round(d * 256.0));
649/**
650 * Converts a fixed-point number to an integer.
651 *
652 * \param f Fixed-point number to convert
653 *
654 * \return Integer component of the fixed-point argument
655 */
656static inline int
657wl_fixed_to_int(wl_fixed_t f)
659 return f / 256;
662/**
663 * Converts an integer to a fixed-point number.
664 *
665 * \param i Integer to convert
666 *
667 * \return Fixed-point representation of the integer argument
668 */
669static inline wl_fixed_t
670wl_fixed_from_int(int i)
672 return i * 256;
675/**
676 * Protocol message argument data types
677 *
678 * This union represents all of the argument types in the Wayland protocol wire
679 * format. The protocol implementation uses wl_argument within its marshalling
680 * machinery for dispatching messages between a client and a compositor.
681 *
682 * \sa wl_message
683 * \sa wl_interface
684 * \sa <a href="https://wayland.freedesktop.org/docs/html/ch04.html#sect-Protocol-wire-Format">Wire Format</a>
685 */
686union wl_argument {
687 int32_t i; /**< `int` */
688 uint32_t u; /**< `uint` */
689 wl_fixed_t f; /**< `fixed` */
690 const char *s; /**< `string` */
691 struct wl_object *o; /**< `object` */
692 uint32_t n; /**< `new_id` */
693 struct wl_array *a; /**< `array` */
694 int32_t h; /**< `fd` */
695};
697/**
698 * Dispatcher function type alias
699 *
700 * A dispatcher is a function that handles the emitting of callbacks in client
701 * code. For programs directly using the C library, this is done by using
702 * libffi to call function pointers. When binding to languages other than C,
703 * dispatchers provide a way to abstract the function calling process to be
704 * friendlier to other function calling systems.
705 *
706 * A dispatcher takes five arguments: The first is the dispatcher-specific
707 * implementation associated with the target object. The second is the object
708 * upon which the callback is being invoked (either wl_proxy or wl_resource).
709 * The third and fourth arguments are the opcode and the wl_message
710 * corresponding to the callback. The final argument is an array of arguments
711 * received from the other process via the wire protocol.
712 *
713 * \param user_data Dispatcher-specific implementation data
714 * \param target Callback invocation target (wl_proxy or `wl_resource`)
715 * \param opcode Callback opcode
716 * \param msg Callback message signature
717 * \param args Array of received arguments
718 *
719 * \return 0 on success, or -1 on failure
720 */
721typedef int (*wl_dispatcher_func_t)(const void *user_data, void *target,
722 uint32_t opcode, const struct wl_message *msg,
723 union wl_argument *args);
725/**
726 * Log function type alias
727 *
728 * The C implementation of the Wayland protocol abstracts the details of
729 * logging. Users may customize the logging behavior, with a function conforming
730 * to the `wl_log_func_t` type, via `wl_log_set_handler_client` and
731 * `wl_log_set_handler_server`.
732 *
733 * A `wl_log_func_t` must conform to the expectations of `vprintf`, and
734 * expects two arguments: a string to write and a corresponding variable
735 * argument list. While the string to write may contain format specifiers and
736 * use values in the variable argument list, the behavior of any `wl_log_func_t`
737 * depends on the implementation.
738 *
739 * \note Take care to not confuse this with `wl_protocol_logger_func_t`, which
740 * is a specific server-side logger for requests and events.
741 *
742 * \param fmt String to write to the log, containing optional format
743 * specifiers
744 * \param args Variable argument list
745 *
746 * \sa wl_log_set_handler_client
747 * \sa wl_log_set_handler_server
748 */
749typedef void (*wl_log_func_t)(const char *fmt, va_list args) WL_PRINTF(1, 0);
751/**
752 * Return value of an iterator function
753 *
754 * \sa wl_client_for_each_resource_iterator_func_t
755 * \sa wl_client_for_each_resource
756 */
757enum wl_iterator_result {
758 /** Stop the iteration */
759 WL_ITERATOR_STOP,
760 /** Continue the iteration */
761 WL_ITERATOR_CONTINUE
762};
764#ifdef __cplusplus
766#endif
768#endif