Add reject round trip to dnd protocol

This lets a drag target reject a drop.
dev
Kristian Høgsberg 14 years ago
parent 41da90897c
commit d44bc8b8ee
  1. 14
      clients/dnd.c
  2. 12
      compositor/compositor.c
  3. 5
      protocol/wayland.xml

@ -271,9 +271,16 @@ drag_finish(void *data, struct wl_drag *drag, int fd)
free(dnd_drag);
}
static void
drag_reject(void *data, struct wl_drag *drag)
{
fprintf(stderr, "drop rejected\n");
}
static const struct wl_drag_listener drag_listener = {
drag_target,
drag_finish
drag_finish,
drag_reject
};
static void
@ -379,10 +386,7 @@ drag_offer_drop(void *data, struct wl_drag_offer *offer)
if (!dnd_offer->drag_type) {
fprintf(stderr, "got 'drop', but no target\n");
/* FIXME: Should send response so compositor and
* source knows it's over. Can't send -1 to indicate
* 'no target' though becauses of the way fd passing
* currently works. */
wl_drag_offer_reject(offer);
return;
}

@ -1137,9 +1137,19 @@ drag_offer_receive(struct wl_client *client,
close(fd);
}
static void
drag_offer_reject(struct wl_client *client, struct wl_drag_offer *offer)
{
struct wl_drag *drag = container_of(offer, struct wl_drag, drag_offer);
wl_client_post_event(drag->source->client, &drag->resource.base,
WL_DRAG_REJECT);
}
static const struct wl_drag_offer_interface drag_offer_interface = {
drag_offer_accept,
drag_offer_receive
drag_offer_receive,
drag_offer_reject
};
static void

@ -209,6 +209,8 @@
<event name="finish">
<arg name="fd" type="fd"/>
</event>
<event name="reject"/>
</interface>
@ -226,6 +228,9 @@
<arg name="fd" type="fd"/>
</request>
<!-- Called to reject a drop -->
<request name="reject"/>
<!-- Sent before the pointer_focus event to announce the types
offered. One event per offered mime type. -->
<event name="offer">

Loading…
Cancel
Save