
org.freedesktop.wayland.server.WlDataOfferRequestsV2 Maven / Gradle / Ivy
Show all versions of wayland-server Show documentation
package org.freedesktop.wayland.server;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
//
//
// Copyright © 2008-2011 Kristian Høgsberg
// Copyright © 2010-2011 Intel Corporation
// Copyright © 2012-2013 Collabora, Ltd.
//
// Permission is hereby granted, free of charge, to any person
// obtaining a copy of this software and associated documentation files
// (the "Software"), to deal in the Software without restriction,
// including without limitation the rights to use, copy, modify, merge,
// publish, distribute, sublicense, and/or sell copies of the Software,
// and to permit persons to whom the Software is furnished to do so,
// subject to the following conditions:
//
// The above copyright notice and this permission notice (including the
// next paragraph) shall be included in all copies or substantial
// portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
// BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
//
/**
* offer to transfer data
*
*
* A wl_data_offer represents a piece of data offered for transfer
* by another client (the source client). It is used by the
* copy-and-paste and drag-and-drop mechanisms. The offer
* describes the different mime types that the data can be
* converted to and provides the mechanism for transferring the
* data directly from the source client.
*
*/
public interface WlDataOfferRequestsV2 extends WlDataOfferRequests {
int VERSION = 2;
/**
* accept one of the offered mime types
*
*
* Indicate that the client can accept the given mime type, or
* NULL for not accepted.
*
* For objects of version 2 or older, this request is used by the
* client to give feedback whether the client can receive the given
* mime type, or NULL if none is accepted; the feedback does not
* determine whether the drag-and-drop operation succeeds or not.
*
* For objects of version 3 or newer, this request determines the
* final result of the drag-and-drop operation. If the end result
* is that no mime types were accepted, the drag-and-drop operation
* will be cancelled and the corresponding drag source will receive
* wl_data_source.cancelled. Clients may still use this event in
* conjunction with wl_data_source.action for feedback.
*
* @param requester The protocol object that made the request.
* @param serial serial number of the accept request
* @param mimeType mime type accepted by the client
*/
public void accept(WlDataOfferResource requester, int serial, @Nullable String mimeType);
/**
* request that the data is transferred
*
*
* To transfer the offered data, the client issues this request
* and indicates the mime type it wants to receive. The transfer
* happens through the passed file descriptor (typically created
* with the pipe system call). The source client writes the data
* in the mime type representation requested and then closes the
* file descriptor.
*
* The receiving client reads from the read end of the pipe until
* EOF and then closes its end, at which point the transfer is
* complete.
*
* This request may happen multiple times for different mime types,
* both before and after wl_data_device.drop. Drag-and-drop destination
* clients may preemptively fetch data or examine it more closely to
* determine acceptance.
*
* @param requester The protocol object that made the request.
* @param mimeType mime type desired by receiver
* @param fd file descriptor for data transfer
*/
public void receive(WlDataOfferResource requester, @Nonnull String mimeType, int fd);
/**
* destroy data offer
*
*
* Destroy the data offer.
*
* @param requester The protocol object that made the request.
*/
public void destroy(WlDataOfferResource requester);
}