aboutsummaryrefslogtreecommitdiffstats
path: root/src/wayland-client.c
diff options
context:
space:
mode:
authorDerek Foreman <derek.foreman@collabora.com>2021-08-24 17:08:51 -0500
committerDaniel Stone <daniels@collabora.com>2021-11-02 11:27:51 +0000
commitca893075ef75f2ad4688d8fc1dcc20260f91afe9 (patch)
treec522cea50f269b83a4a0c88b1c617871c09f9220 /src/wayland-client.c
parentprotocol: add wl_output.{name,description} (diff)
downloadwayland-ca893075ef75f2ad4688d8fc1dcc20260f91afe9.tar
wayland-ca893075ef75f2ad4688d8fc1dcc20260f91afe9.tar.gz
wayland-ca893075ef75f2ad4688d8fc1dcc20260f91afe9.tar.bz2
wayland-ca893075ef75f2ad4688d8fc1dcc20260f91afe9.tar.lz
wayland-ca893075ef75f2ad4688d8fc1dcc20260f91afe9.tar.xz
wayland-ca893075ef75f2ad4688d8fc1dcc20260f91afe9.tar.zst
wayland-ca893075ef75f2ad4688d8fc1dcc20260f91afe9.zip
debug: Fix printing of new ids
The client side closure traces have incorrect object ids for new server generated objects. This is because create_proxies() overwrites the id in 'n' type arguments by storing a pointer to the actual object in the 'o' field of the union. Getting back to an id from this pointer requires accessing a structure that isn't visible outside of wayland-client.c. Add a function pointer to fish the correct value out of the argument and pass it to wl_closure_print. Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
Diffstat (limited to 'src/wayland-client.c')
-rw-r--r--src/wayland-client.c21
1 files changed, 17 insertions, 4 deletions
diff --git a/src/wayland-client.c b/src/wayland-client.c
index 66f60e3..4fd7c90 100644
--- a/src/wayland-client.c
+++ b/src/wayland-client.c
@@ -847,7 +847,7 @@ wl_proxy_marshal_array_flags(struct wl_proxy *proxy, uint32_t opcode,
}
if (debug_client)
- wl_closure_print(closure, &proxy->object, true, false);
+ wl_closure_print(closure, &proxy->object, true, false, NULL);
if (wl_closure_send(closure, proxy->display->connection)) {
wl_log("Error sending request: %s\n", strerror(errno));
@@ -1531,6 +1531,19 @@ queue_event(struct wl_display *display, int len)
return size;
}
+static uint32_t
+id_from_object(union wl_argument *arg)
+{
+ struct wl_proxy *proxy;
+
+ if (arg->o) {
+ proxy = (struct wl_proxy *)arg->o;
+ return proxy->object.id;
+ }
+
+ return 0;
+}
+
static void
dispatch_event(struct wl_display *display, struct wl_event_queue *queue)
{
@@ -1550,7 +1563,7 @@ dispatch_event(struct wl_display *display, struct wl_event_queue *queue)
proxy_destroyed = !!(proxy->flags & WL_PROXY_FLAG_DESTROYED);
if (proxy_destroyed) {
if (debug_client)
- wl_closure_print(closure, &proxy->object, false, true);
+ wl_closure_print(closure, &proxy->object, false, true, id_from_object);
destroy_queued_closure(closure);
return;
}
@@ -1559,13 +1572,13 @@ dispatch_event(struct wl_display *display, struct wl_event_queue *queue)
if (proxy->dispatcher) {
if (debug_client)
- wl_closure_print(closure, &proxy->object, false, false);
+ wl_closure_print(closure, &proxy->object, false, false, id_from_object);
wl_closure_dispatch(closure, proxy->dispatcher,
&proxy->object, opcode);
} else if (proxy->object.implementation) {
if (debug_client)
- wl_closure_print(closure, &proxy->object, false, false);
+ wl_closure_print(closure, &proxy->object, false, false, id_from_object);
wl_closure_invoke(closure, WL_CLOSURE_INVOKE_CLIENT,
&proxy->object, opcode, proxy->user_data);