Add convenience functions for posting display events
diff --git a/compositor.c b/compositor.c
index 1959ed2..175e5a7 100644
--- a/compositor.c
+++ b/compositor.c
@@ -590,14 +590,11 @@
shell_create_drag(struct wl_client *client,
struct wl_shell *shell, uint32_t id)
{
- struct wl_display *display = wl_client_get_display(client);
struct wl_drag *drag;
drag = malloc(sizeof *drag);
if (drag == NULL) {
- wl_client_post_event(client,
- (struct wl_object *) display,
- WL_DISPLAY_NO_MEMORY);
+ wl_client_post_no_memory(client);
return;
}
@@ -627,9 +624,7 @@
surface = wlsc_surface_create(ec, NULL, 0, 0, 0, 0);
if (surface == NULL) {
- wl_client_post_event(client,
- (struct wl_object *) ec->wl_display,
- WL_DISPLAY_NO_MEMORY);
+ wl_client_post_no_memory(client);
return;
}
@@ -1065,12 +1060,8 @@
if (surface &&
(!drag->pointer_focus ||
drag->pointer_focus->client != surface->base.client)) {
- wl_surface_post_event(&surface->base,
- (struct wl_object *) surface->compositor->wl_display,
- WL_DISPLAY_GLOBAL,
- &drag->drag_offer.base,
- drag->drag_offer.base.interface->name,
- drag->drag_offer.base.interface->version);
+ wl_client_post_global(surface->base.client,
+ &drag->drag_offer.base);
end = drag->types.data + drag->types.size;
for (p = drag->types.data; p < end; p++)
@@ -1138,16 +1129,13 @@
static void
drag_offer(struct wl_client *client, struct wl_drag *drag, const char *type)
{
- struct wl_display *display = wl_client_get_display (client);
char **p;
p = wl_array_add(&drag->types, sizeof *p);
if (p)
*p = strdup(type);
if (!p || !*p)
- wl_client_post_event(client,
- (struct wl_object *) display,
- WL_DISPLAY_NO_MEMORY);
+ wl_client_post_no_memory(client);
}
static void