summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Blumenkrantz <zmike@osg.samsung.com>2017-05-12 12:08:32 -0400
committerMike Blumenkrantz <zmike@osg.samsung.com>2017-05-12 12:08:26 -0400
commit68a3f43d1e508f4825ee0a9dad99d929d779ec1a (patch)
tree60f4577f5f1e9bbc3cee40c1d022b9e0cbc40a32
parent8afdbaba48ceaf2605d9034ea732da918ac3d496 (diff)
downloadefl-68a3f43d1e508f4825ee0a9dad99d929d779ec1a.tar.gz
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
-rw-r--r--src/lib/ecore_wl2/Ecore_Wl2.h22
-rw-r--r--src/lib/ecore_wl2/ecore_wl2_dnd.c21
2 files changed, 43 insertions, 0 deletions
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
@@ -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 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
@@ -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);