}
void
+wl_closure_print(struct wl_closure *closure, struct wl_object *target)
+{
+ struct wl_object *object;
+ int i;
+
+ fprintf(stderr, "%s(%d).%s(",
+ target->interface->name, target->id,
+ closure->message->name);
+
+ for (i = 2; i < closure->count; i++) {
+ if (i > 2)
+ fprintf(stderr, ", ");
+ switch (closure->message->signature[i - 2]) {
+ case 'u':
+ fprintf(stderr, "%u", closure->values[i].uint32);
+ break;
+ case 'i':
+ fprintf(stderr, "%d", closure->values[i].uint32);
+ break;
+ case 's':
+ fprintf(stderr, "\"%s\"", closure->values[i].string);
+ break;
+ case 'o':
+ object = closure->values[i].object;
+ fprintf(stderr, "object %u", object ? object->id : 0);
+ break;
+ case 'n':
+ fprintf(stderr, "new id %u",
+ closure->values[i].uint32);
+ break;
+ case 'a':
+ fprintf(stderr, "array");
+ break;
+ case 'h':
+ fprintf(stderr, "fd %d", closure->values[i].uint32);
+ break;
+ }
+ }
+
+ fprintf(stderr, ")\n");
+}
+
+void
wl_closure_destroy(struct wl_closure *closure)
{
int i;
wl_closure_invoke(struct wl_closure *closure,
struct wl_object *target, void (*func)(void), void *data);
void
+wl_closure_print(struct wl_closure *closure, struct wl_object *target);
+void
wl_closure_destroy(struct wl_closure *closure);
#endif
WL_EXPORT struct wl_surface wl_grab_surface;
+static int wl_debug = 0;
+
WL_EXPORT void
wl_client_post_event(struct wl_client *client, struct wl_object *sender,
uint32_t opcode, ...)
continue;
}
+
+ if (wl_debug)
+ wl_closure_print(closure, object);
+
wl_closure_invoke(closure, object,
object->implementation[opcode], client);
wl_display_create(void)
{
struct wl_display *display;
+ const char *debug;
+
+ debug = getenv("WAYLAND_DEBUG");
+ if (debug)
+ wl_debug = 1;
display = malloc(sizeof *display);
if (display == NULL)