diff --git a/src/lib/ecore_wl2/Ecore_Wl2.h b/src/lib/ecore_wl2/Ecore_Wl2.h index e791ef85c3..dc5d12cc37 100644 --- a/src/lib/ecore_wl2/Ecore_Wl2.h +++ b/src/lib/ecore_wl2/Ecore_Wl2.h @@ -1411,6 +1411,28 @@ EAPI void ecore_wl2_offer_accept(Ecore_Wl2_Offer *offer, const char *mime_type); */ EAPI void ecore_wl2_offer_receive(Ecore_Wl2_Offer *offer, char *mime); +/** + * Request the data from this offer on an externally managed fd. + * The event ECORE_WL2_EVENT_OFFER_DATA_READY is called when the data is available. + * There offer will be not destroyed as long as requested data is not emitted by the event. + * + * @param offer the offer to use + * @param mime the mimetype to receive + * @param fd the fd to pass for receiving + * + * @since 1.20 + */ +EAPI void ecore_wl2_offer_proxy_receive(Ecore_Wl2_Offer *offer, const char *mime, int fd); + +/** + * End the use of a proxy received offer. This may invalidate the offer object + * + * @param offer the offer + * + * @since 1.20 + */ +EAPI void ecore_wl2_offer_proxy_receive_end(Ecore_Wl2_Offer *offer); + /** * Check if the given offer supports the given mimetype * diff --git a/src/lib/ecore_wl2/ecore_wl2_dnd.c b/src/lib/ecore_wl2/ecore_wl2_dnd.c index e7c8da8661..fc0dfd2306 100644 --- a/src/lib/ecore_wl2/ecore_wl2_dnd.c +++ b/src/lib/ecore_wl2/ecore_wl2_dnd.c @@ -54,6 +54,7 @@ struct _Ecore_Wl2_Offer Eina_List *reads; int ref; unsigned int window_id; + Eina_Bool proxied : 1; }; static int @@ -861,6 +862,26 @@ ecore_wl2_offer_receive(Ecore_Wl2_Offer *offer, char *mime) return; } +EAPI void +ecore_wl2_offer_proxy_receive(Ecore_Wl2_Offer *offer, const char *mime, int fd) +{ + EINA_SAFETY_ON_NULL_RETURN(offer); + + if (!offer->proxied) offer->ref++; + offer->proxied = 1; + wl_data_offer_receive(offer->offer, mime, fd); +} + +EAPI void +ecore_wl2_offer_proxy_receive_end(Ecore_Wl2_Offer *offer) +{ + EINA_SAFETY_ON_NULL_RETURN(offer); + + if (!offer->proxied) return; + offer->proxied = 0; + _ecore_wl2_offer_unref(offer); +} + EAPI void ecore_wl2_offer_finish(Ecore_Wl2_Offer *offer) {