[PATCH 3/4] Added a reject method to drag_offer.
Kristian Høgsberg
krh at bitplanet.net
Tue Nov 30 12:16:16 PST 2010
On Tue, Nov 30, 2010 at 1:22 PM, Joel Teichroeb <joel at teichroeb.net> wrote:
> 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.
I ended up redoing this one as well - we can't send -1 as a illegal
fd, that means the event sent to the drag source can't have fd = -1
either. I added a reject event to the drag interface.
Kristian
> ---
> 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
>
> _______________________________________________
> wayland-devel mailing list
> wayland-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/wayland-devel
>
More information about the wayland-devel
mailing list