diff --git a/protocol/wayland.xml b/protocol/wayland.xml index 7e6392aa..51a83efe 100644 --- a/protocol/wayland.xml +++ b/protocol/wayland.xml @@ -157,6 +157,115 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -184,14 +293,6 @@ - - - - - - - - @@ -240,145 +341,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/connection.c b/src/connection.c index 8c9a64d1..f19280a0 100644 --- a/src/connection.c +++ b/src/connection.c @@ -449,7 +449,7 @@ wl_connection_vmarshal(struct wl_connection *connection, closure->types[i] = &ffi_type_uint32; closure->args[i] = p; object = va_arg(ap, struct wl_object *); - *p++ = object->id; + *p++ = object ? object->id : 0; break; case 'a': @@ -493,6 +493,8 @@ wl_connection_vmarshal(struct wl_connection *connection, &dup_fd, sizeof dup_fd); break; default: + fprintf(stderr, "unhandled format code: '%c'\n", + message->signature[i - 2]); assert(0); break; } @@ -632,7 +634,7 @@ wl_connection_demarshal(struct wl_connection *connection, closure->types[i] = &ffi_type_uint32; closure->args[i] = p; object = wl_map_lookup(objects, *p); - if (*p == 0 || object != NULL) { + if (object != NULL) { printf("not a new object (%d), " "message %s(%s)\n", *p, message->name, message->signature); diff --git a/src/wayland-client.c b/src/wayland-client.c index c8bbe8f3..939c17d1 100644 --- a/src/wayland-client.c +++ b/src/wayland-client.c @@ -152,8 +152,9 @@ wl_proxy_create_for_id(struct wl_proxy *factory, proxy->object.interface = interface; proxy->object.implementation = NULL; - proxy->object.id = wl_map_insert_at(&display->objects, id, proxy); + proxy->object.id = id; proxy->display = display; + wl_map_insert_at(&display->objects, id, proxy); return proxy; } diff --git a/src/wayland-server.c b/src/wayland-server.c index 48116398..7c93e3f9 100644 --- a/src/wayland-server.c +++ b/src/wayland-server.c @@ -874,3 +874,16 @@ wl_client_add_object(struct wl_client *client, return resource; } + +WL_EXPORT struct wl_resource * +wl_client_new_object(struct wl_client *client, + const struct wl_interface *interface, + const void *implementation, void *data) +{ + uint32_t id; + + id = wl_map_insert_new(&client->objects, WL_MAP_SERVER_SIDE, NULL); + return wl_client_add_object(client, + interface, implementation, id, data); + +} diff --git a/src/wayland-server.h b/src/wayland-server.h index 269a0790..4de2e835 100644 --- a/src/wayland-server.h +++ b/src/wayland-server.h @@ -104,6 +104,10 @@ struct wl_resource * wl_client_add_object(struct wl_client *client, const struct wl_interface *interface, const void *implementation, uint32_t id, void *data); +struct wl_resource * +wl_client_new_object(struct wl_client *client, + const struct wl_interface *interface, + const void *implementation, void *data); struct wl_resource { struct wl_object object; @@ -176,39 +180,6 @@ struct wl_input_device { struct wl_listener grab_listener; }; -struct wl_drag_offer { - struct wl_resource resource; -}; - -struct wl_drag { - struct wl_resource resource; - struct wl_grab grab; - struct wl_drag_offer drag_offer; - struct wl_surface *source; - struct wl_surface *drag_focus; - struct wl_client *target; - int32_t x, y, sx, sy; - struct wl_array types; - const char *type; - uint32_t pointer_focus_time; - struct wl_listener drag_focus_listener; -}; - -struct wl_selection_offer { - struct wl_resource resource; -}; - -struct wl_selection { - struct wl_resource resource; - struct wl_client *client; - struct wl_input_device *input_device; - struct wl_selection_offer selection_offer; - struct wl_surface *selection_focus; - struct wl_client *target; - struct wl_array types; - struct wl_listener selection_focus_listener; -}; - void wl_resource_post_event(struct wl_resource *resource, uint32_t opcode, ...); void wl_resource_queue_event(struct wl_resource *resource, @@ -217,11 +188,6 @@ void wl_resource_post_error(struct wl_resource *resource, uint32_t code, const char *msg, ...); void wl_resource_post_no_memory(struct wl_resource *resource); -int -wl_display_set_compositor(struct wl_display *display, - struct wl_compositor *compositor, - const struct wl_compositor_interface *implementation); - void wl_display_post_frame(struct wl_display *display, struct wl_surface *surface, uint32_t msecs); @@ -287,11 +253,6 @@ wl_shm_init(struct wl_display *display, void wl_shm_finish(struct wl_shm *shm); -int -wl_compositor_init(struct wl_compositor *compositor, - const struct wl_compositor_interface *interface, - struct wl_display *display); - #ifdef __cplusplus } #endif