summaryrefslogtreecommitdiff
path: root/compositor.c
diff options
context:
space:
mode:
authorKristian Høgsberg <krh@bitplanet.net>2010-09-02 20:55:16 -0400
committerKristian Høgsberg <krh@bitplanet.net>2010-09-02 20:55:16 -0400
commit13b8ae49867bee41e2d6f73d7afdeba4ecd7570c (patch)
tree93914b13987c9790db29f972b8fab7ae1e338ef9 /compositor.c
parentf66d0f4e14818b12d2c02f924237a2e8a90de720 (diff)
Add convenience functions for posting display events
Diffstat (limited to 'compositor.c')
-rw-r--r--compositor.c22
1 files changed, 5 insertions, 17 deletions
diff --git a/compositor.c b/compositor.c
index 1959ed2..175e5a7 100644
--- a/compositor.c
+++ b/compositor.c
@@ -590,14 +590,11 @@ static void
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 @@ compositor_create_surface(struct wl_client *client,
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 @@ wl_drag_set_pointer_focus(struct wl_drag *drag,
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 const struct wl_drag_offer_interface drag_offer_interface = {
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