From 48e29895942be00d391cee484ffa8f7fc4ce4c1c Mon Sep 17 00:00:00 2001 From: =?utf8?q?Kristian=20H=C3=B8gsberg?= Date: Thu, 10 Feb 2011 12:27:35 -0500 Subject: [PATCH] wayland-client: Support WAYLAND_DEBUG client side as well --- wayland/wayland-client.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/wayland/wayland-client.c b/wayland/wayland-client.c index 7bb6451..e3198c7 100644 --- a/wayland/wayland-client.c +++ b/wayland/wayland-client.c @@ -95,6 +95,8 @@ struct wl_display { uint32_t key; }; +static int wl_debug = 0; + static int connection_update(struct wl_connection *connection, uint32_t mask, void *data) @@ -203,6 +205,12 @@ wl_proxy_marshal(struct wl_proxy *proxy, uint32_t opcode, ...) va_end(ap); wl_closure_send(closure, proxy->display->connection); + + if (wl_debug) { + fprintf(stderr, " -> "); + wl_closure_print(closure, &proxy->object); + } + wl_closure_destroy(closure); } @@ -334,8 +342,13 @@ wl_display_connect(const char *name) struct sockaddr_un addr; socklen_t size; const char *runtime_dir; + const char *debug; size_t name_size; + debug = getenv("WAYLAND_DEBUG"); + if (debug) + wl_debug = 1; + display = malloc(sizeof *display); if (display == NULL) return NULL; @@ -480,6 +493,9 @@ handle_event(struct wl_display *display, closure = wl_connection_demarshal(display->connection, size, display->objects, message); + if (wl_debug) + wl_closure_print(closure, &proxy->object); + wl_list_for_each(listener, &proxy->listener_list, link) wl_closure_invoke(closure, &proxy->object, listener->implementation[opcode], -- 2.7.4