[PATCH] connection : correct debugging info in wl_closure_print
Jason Ekstrand
jason at jlekstrand.net
Wed Feb 27 07:11:48 PST 2013
Elvis,
Unfortunately, this conflicts with the following commit:
http://cgit.freedesktop.org/wayland/wayland/commit/?id=2fc248dc2c877d02694db40aad52180d71373d5a
Also, due to the changes in wl_closure the actual object is no longer
even stored for arguments of type new_id, so this isn't even possible.
--Jason Ekstrand
On Wed, Feb 27, 2013 at 3:18 AM, Elvis Lee <kwangwoong.lee at lge.com> wrote:
> - print new object id on server side
> - print new object name when wl_registry.bind
> ---
> src/connection.c | 10 +++++++---
> src/wayland-client.c | 4 ++--
> src/wayland-private.h | 2 +-
> src/wayland-server.c | 6 +++---
> 4 files changed, 13 insertions(+), 9 deletions(-)
>
> diff --git a/src/connection.c b/src/connection.c
> index 8707d40..1c5f52c 100644
> --- a/src/connection.c
> +++ b/src/connection.c
> @@ -65,6 +65,7 @@ union wl_value {
> struct wl_object *object;
> uint32_t new_id;
> struct wl_array *array;
> + uint32_t *object_id;
> };
>
> static void
> @@ -976,7 +977,7 @@ wl_closure_queue(struct wl_closure *closure, struct wl_connection *connection)
> }
>
> void
> -wl_closure_print(struct wl_closure *closure, struct wl_object *target, int send)
> +wl_closure_print(struct wl_closure *closure, struct wl_object *target, int send, int server)
> {
> union wl_value *value;
> int32_t si;
> @@ -1028,11 +1029,14 @@ wl_closure_print(struct wl_closure *closure, struct wl_object *target, int send)
> fprintf(stderr, "new id %s@",
> (closure->message->types[i - 2]) ?
> closure->message->types[i - 2]->name :
> - "[unknown]");
> + strcmp(target->interface->name, "wl_registry") == 0 ?
> + /* picking 's' from wl_registry.bind : "usun" */
> + ((union wl_value *)closure->args[i - 2])->string :
> + "[unknown]");
> if (send && value->new_id != 0)
> fprintf(stderr, "%u", value->new_id);
> else if (!send && value->object != NULL)
> - fprintf(stderr, "%u", value->object->id);
> + fprintf(stderr, "%u", server ? *value->object_id : value->object->id);
> else
> fprintf(stderr, "nil");
> break;
> diff --git a/src/wayland-client.c b/src/wayland-client.c
> index 785f4ee..271c402 100644
> --- a/src/wayland-client.c
> +++ b/src/wayland-client.c
> @@ -369,7 +369,7 @@ wl_proxy_marshal(struct wl_proxy *proxy, uint32_t opcode, ...)
> }
>
> if (wl_debug)
> - wl_closure_print(closure, &proxy->object, true);
> + wl_closure_print(closure, &proxy->object, true, false);
>
> if (wl_closure_send(closure, proxy->display->connection)) {
> fprintf(stderr, "Error sending request: %m\n");
> @@ -834,7 +834,7 @@ dispatch_event(struct wl_display *display, struct wl_event_queue *queue)
>
> if (proxy->object.implementation) {
> if (wl_debug)
> - wl_closure_print(closure, &proxy->object, false);
> + wl_closure_print(closure, &proxy->object, false, false);
>
> wl_closure_invoke(closure, &proxy->object,
> proxy->object.implementation[opcode],
> diff --git a/src/wayland-private.h b/src/wayland-private.h
> index 4ec9896..1ed5e0a 100644
> --- a/src/wayland-private.h
> +++ b/src/wayland-private.h
> @@ -118,7 +118,7 @@ wl_closure_send(struct wl_closure *closure, struct wl_connection *connection);
> int
> wl_closure_queue(struct wl_closure *closure, struct wl_connection *connection);
> void
> -wl_closure_print(struct wl_closure *closure, struct wl_object *target, int send);
> +wl_closure_print(struct wl_closure *closure, struct wl_object *target, int send, int server);
> void
> wl_closure_destroy(struct wl_closure *closure);
>
> diff --git a/src/wayland-server.c b/src/wayland-server.c
> index dae7177..c3e7754 100644
> --- a/src/wayland-server.c
> +++ b/src/wayland-server.c
> @@ -132,7 +132,7 @@ wl_resource_post_event(struct wl_resource *resource, uint32_t opcode, ...)
> destroy_client, resource->client);
>
> if (wl_debug)
> - wl_closure_print(closure, object, true);
> + wl_closure_print(closure, object, true, true);
>
> wl_closure_destroy(closure);
> }
> @@ -158,7 +158,7 @@ wl_resource_queue_event(struct wl_resource *resource, uint32_t opcode, ...)
> destroy_client, resource->client);
>
> if (wl_debug)
> - wl_closure_print(closure, object, true);
> + wl_closure_print(closure, object, true, true);
>
> wl_closure_destroy(closure);
> }
> @@ -292,7 +292,7 @@ wl_client_connection_data(int fd, uint32_t mask, void *data)
> }
>
> if (wl_debug)
> - wl_closure_print(closure, object, false);
> + wl_closure_print(closure, object, false, true);
>
> deref_new_objects(closure);
>
> --
> 1.7.9.5
>
> _______________________________________________
> wayland-devel mailing list
> wayland-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/wayland-devel
More information about the wayland-devel
mailing list