aboutsummaryrefslogtreecommitdiff
path: root/src/wayland-client-core.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/wayland-client-core.h')
-rw-r--r--src/wayland-client-core.h119
1 files changed, 106 insertions, 13 deletions
diff --git a/src/wayland-client-core.h b/src/wayland-client-core.h
index 94c25e3..af7c184 100644
--- a/src/wayland-client-core.h
+++ b/src/wayland-client-core.h
@@ -119,9 +119,27 @@ struct wl_display;
*/
struct wl_event_queue;
+/** Destroy proxy after marshalling
+ * @ingroup wl_proxy
+ */
+#define WL_MARSHAL_FLAG_DESTROY (1 << 0)
+
void
wl_event_queue_destroy(struct wl_event_queue *queue);
+struct wl_proxy *
+wl_proxy_marshal_flags(struct wl_proxy *proxy, uint32_t opcode,
+ const struct wl_interface *interface,
+ uint32_t version,
+ uint32_t flags, ...);
+
+struct wl_proxy *
+wl_proxy_marshal_array_flags(struct wl_proxy *proxy, uint32_t opcode,
+ const struct wl_interface *interface,
+ uint32_t version,
+ uint32_t flags,
+ union wl_argument *args);
+
void
wl_proxy_marshal(struct wl_proxy *p, uint32_t opcode, ...);
@@ -270,31 +288,106 @@ wl_display_read_events(struct wl_display *display);
void
wl_log_set_handler_client(wl_log_func_t handler);
-enum wl_protocol_logger_client_type {
- WL_PROTOCOL_LOGGER_CLIENT_REQUEST,
- WL_PROTOCOL_LOGGER_CLIENT_EVENT,
+/**
+ * The message type.
+ */
+enum wl_client_message_type {
+ /** The message is a request */
+ WL_CLIENT_MESSAGE_REQUEST,
+
+ /** The message is an event */
+ WL_CLIENT_MESSAGE_EVENT,
+};
+
+/**
+ * The message discard reason codes.
+ */
+enum wl_client_message_discarded_reason {
+ /** The message was handled normally, and not discarded. */
+ WL_CLIENT_MESSAGE_NOT_DISCARDED = 0,
+
+ /** The target was not alive at dispatch time */
+ WL_CLIENT_MESSAGE_DISCARD_DEAD_PROXY_ON_DISPATCH,
+
+ /** The target had no listener or dispatcher */
+ WL_CLIENT_MESSAGE_DISCARD_NO_LISTENER_ON_DISPATCH,
+
+ /** The target was not valid when the event was demarshalled */
+ WL_CLIENT_MESSAGE_DISCARD_UNKNOWN_ID_ON_DEMARSHAL,
};
-struct wl_protocol_logger_client_message {
+/**
+ * The structure used to communicate details about an observed message to the
+ * registered observers.
+ */
+struct wl_client_observed_message {
+ /** The target for the message */
struct wl_proxy *proxy;
+
+ /** The message opcode */
int message_opcode;
+
+ /** The protocol message structure */
const struct wl_message *message;
+
+ /** The count of arguments to the message */
int arguments_count;
+
+ /** The argument array for the messagge */
const union wl_argument *arguments;
+
+ /** The discard reason code */
+ enum wl_client_message_discarded_reason discarded_reason;
+
+ /**
+ * The discard reason string, or NULL if the event was not discarded.
+ *
+ * This string is only for convenience for a observer that does
+ * logging. The string values should not be considered stable, and
+ * are not localized.
+ */
+ const char *discarded_reason_str;
};
-typedef void (*wl_protocol_logger_client_func_t)(
- void *user_data,
- enum wl_protocol_logger_client_type direction,
- const struct wl_protocol_logger_client_message *message);
+/**
+ * The signature for a client message observer function, as registered with
+ * wl_display_add_client_observer().
+ *
+ * \param user_data \c user_data pointer given when the observer was
+ * registered with \c wl_display_create_client_observer
+ * \param type type of message
+ * \param message details for the message
+ */
+typedef void (*wl_client_message_observer_func_t)(
+ void *user_data, enum wl_client_message_type type,
+ const struct wl_client_observed_message *message);
+
+/** \class wl_client_observer
+ *
+ * \brief Represents a client message observer
+ *
+ * A client observer allows the client to observe all request and event
+ * message traffic to and from the client. For events, the observer is
+ * also given a discard reason if the event wasn't handled.
+ *
+ * The typical use for the observer is to allow the client implementation to
+ * do its own debug logging, as the default when setting WAYLAND_DEBUG is to
+ * log to stderr.
+ *
+ * With this runtime call, the client can also enable and disable the observer
+ * at any time.
+ *
+ * The protocol-logger-test.c file has an example of a logger implementation.
+ */
+struct wl_client_observer;
-struct wl_protocol_logger_client *
-wl_display_add_protocol_logger_client(struct wl_display *display,
- wl_protocol_logger_client_func_t,
- void *user_data);
+struct wl_client_observer *
+wl_display_create_client_observer(struct wl_display *display,
+ wl_client_message_observer_func_t observer,
+ void *user_data);
void
-wl_protocol_logger_client_destroy(struct wl_protocol_logger_client *logger);
+wl_client_observer_destroy(struct wl_client_observer *observer);
#ifdef __cplusplus
}