[PATCH 3/4] Added a reject method to drag_offer.
Joel Teichroeb
joel at teichroeb.net
Tue Nov 30 10:22:15 PST 2010
Currently reject just calles drag_finish and does not bother with any fd
stuff. In the future this should be extended to tell the compositor to
do some kind of animation when a drag is rejected.
---
compositor/compositor.c | 13 ++++++++++++-
protocol/wayland.xml | 4 ++++
2 files changed, 16 insertions(+), 1 deletions(-)
diff --git a/compositor/compositor.c b/compositor/compositor.c
index cbb0b6b..1a7a44f 100644
--- a/compositor/compositor.c
+++ b/compositor/compositor.c
@@ -1137,9 +1137,20 @@ 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_FINISH, -1);
+}
+
static const struct wl_drag_offer_interface drag_offer_interface = {
drag_offer_accept,
- drag_offer_receive
+ drag_offer_receive,
+ drag_offer_reject
};
static void
diff --git a/protocol/wayland.xml b/protocol/wayland.xml
index 24c53c2..edfa130 100644
--- a/protocol/wayland.xml
+++ b/protocol/wayland.xml
@@ -226,6 +226,10 @@
<arg name="fd" type="fd"/>
</request>
+ <!-- Called instead of receive to tell the compositor that the drag
+ is not wanted. -->
+ <request name="reject"/>
+
<!-- Sent before the pointer_focus event to announce the types
offered. One event per offered mime type. -->
<event name="offer">
--
1.7.3.2
More information about the wayland-devel
mailing list