discomfitor pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=68a3f43d1e508f4825ee0a9dad99d929d779ec1a

commit 68a3f43d1e508f4825ee0a9dad99d929d779ec1a
Author: Mike Blumenkrantz <[email protected]>
Date:   Fri May 12 12:08:32 2017 -0400

    ecore-wl2: add functions for proxying a selection receive externally
    
    in some cases (e.g,, x11 bridged selections) it is necessary to use
    alternate means when transferring a selection, and so performing the
    entire piped receive is not necessary. instead, extend the lifetime
    of the data offer until the proxied receive has completed
    
    @feature
---
 src/lib/ecore_wl2/Ecore_Wl2.h     | 22 ++++++++++++++++++++++
 src/lib/ecore_wl2/ecore_wl2_dnd.c | 21 +++++++++++++++++++++
 2 files changed, 43 insertions(+)

diff --git a/src/lib/ecore_wl2/Ecore_Wl2.h b/src/lib/ecore_wl2/Ecore_Wl2.h
index e791ef8..dc5d12c 100644
--- a/src/lib/ecore_wl2/Ecore_Wl2.h
+++ b/src/lib/ecore_wl2/Ecore_Wl2.h
@@ -1412,6 +1412,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
  *
  * @param offer the offer to use
diff --git a/src/lib/ecore_wl2/ecore_wl2_dnd.c 
b/src/lib/ecore_wl2/ecore_wl2_dnd.c
index e7c8da8..fc0dfd2 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
@@ -862,6 +863,26 @@ ecore_wl2_offer_receive(Ecore_Wl2_Offer *offer, char *mime)
 }
 
 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)
 {
    EINA_SAFETY_ON_NULL_RETURN(offer);

-- 


Reply via email to