diff options
author | Derek Foreman <derek.foreman@collabora.com> | 2024-04-20 11:21:04 -0500 |
---|---|---|
committer | Simon Ser <contact@emersion.fr> | 2024-04-24 16:40:18 +0000 |
commit | e60c631ff2860de1d9f064f4f438c0412a6dea6b (patch) | |
tree | a6dae065619bae38daaa966a57aa6e0de35b1d84 | |
parent | 9069af78a71f6b2aadb11334e5bef9a670a5043d (diff) |
client: print debug events that have no listener
Currently WAYLAND_DEBUG text ignores events that have no listener.
It can be helpful to know when you're receiving unhandled events,
as you may have forgotten to add a listener, or adding a dispatch
may have magically seemed to fix code that doesn't appear to be
dispatching anything.
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
-rw-r--r-- | src/wayland-client.c | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/src/wayland-client.c b/src/wayland-client.c index 75fad4f..9cf2793 100644 --- a/src/wayland-client.c +++ b/src/wayland-client.c @@ -1647,10 +1647,16 @@ dispatch_event(struct wl_display *display, struct wl_event_queue *queue) validate_closure_objects(closure); proxy = closure->proxy; proxy_destroyed = !!(proxy->flags & WL_PROXY_FLAG_DESTROYED); + + if (debug_client) { + bool discarded = proxy_destroyed || + !(proxy->dispatcher || proxy->object.implementation); + + wl_closure_print(closure, &proxy->object, false, discarded, + id_from_object, queue->name); + } + if (proxy_destroyed) { - if (debug_client) - wl_closure_print(closure, &proxy->object, false, true, - id_from_object, queue->name); destroy_queued_closure(closure); return; } @@ -1658,17 +1664,9 @@ dispatch_event(struct wl_display *display, struct wl_event_queue *queue) pthread_mutex_unlock(&display->mutex); if (proxy->dispatcher) { - if (debug_client) - wl_closure_print(closure, &proxy->object, false, false, - id_from_object, queue->name); - 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, - id_from_object, queue->name); - wl_closure_invoke(closure, WL_CLOSURE_INVOKE_CLIENT, &proxy->object, opcode, proxy->user_data); } |