devilhorns pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=915d0653c3194c3824b5ddbbc98ad25d0b9aee69

commit 915d0653c3194c3824b5ddbbc98ad25d0b9aee69
Author: Chris Michael <cp.mich...@samsung.com>
Date:   Tue Sep 29 11:36:35 2015 -0400

    ecore-wl2: Add API function to set dnd drag types
    
    Signed-off-by: Chris Michael <cp.mich...@samsung.com>
---
 src/lib/ecore_wl2/Ecore_Wl2.h     |  3 +++
 src/lib/ecore_wl2/ecore_wl2_dnd.c | 42 +++++++++++++++++++++++++++++++++++++++
 2 files changed, 45 insertions(+)

diff --git a/src/lib/ecore_wl2/Ecore_Wl2.h b/src/lib/ecore_wl2/Ecore_Wl2.h
index 592ca32..6e62f9a 100644
--- a/src/lib/ecore_wl2/Ecore_Wl2.h
+++ b/src/lib/ecore_wl2/Ecore_Wl2.h
@@ -481,6 +481,9 @@ EAPI void ecore_wl2_window_type_set(Ecore_Wl2_Window 
*window, Ecore_Wl2_Window_T
 /* TODO: doxy */
 EAPI Ecore_Wl2_Input *ecore_wl2_window_input_get(Ecore_Wl2_Window *window);
 
+/* TODO: doxy */
+EAPI void ecore_wl2_dnd_drag_types_set(Ecore_Wl2_Input *input, const char 
**types);
+
 /* # ifdef __cplusplus */
 /* } */
 /* # endif */
diff --git a/src/lib/ecore_wl2/ecore_wl2_dnd.c 
b/src/lib/ecore_wl2/ecore_wl2_dnd.c
index 4a20098..70c59ba 100644
--- a/src/lib/ecore_wl2/ecore_wl2_dnd.c
+++ b/src/lib/ecore_wl2/ecore_wl2_dnd.c
@@ -168,3 +168,45 @@ _ecore_wl2_dnd_selection(Ecore_Wl2_Input *input, struct 
wl_data_offer *offer)
         *t = NULL;
      }
 }
+
+EAPI void
+ecore_wl2_dnd_drag_types_set(Ecore_Wl2_Input *input, const char **types)
+{
+   struct wl_data_device_manager *manager;
+   const char *type;
+   char **t;
+
+   EINA_SAFETY_ON_NULL_RETURN(input);
+   EINA_SAFETY_ON_NULL_RETURN(input->display);
+
+   manager = input->display->wl.data_device_manager;
+
+   if (input->data.types)
+     {
+        wl_array_for_each(t, &input->data.types)
+          free(*t);
+        wl_array_release(&input->data.types);
+        wl_array_init(&input->data.types);
+     }
+
+   if (input->data.source) wl_data_source_destroy(input->data.source);
+   input->data.source = NULL;
+
+   input->data.source = wl_data_device_manager_create_data_source(manager);
+   if (!input->data.source)
+     {
+        ERR("Could not create data source: %m");
+        return;
+     }
+
+   for (type = types; *type; type++)
+     {
+        if (!*type) continue;
+        t = wl_array_add(&input->data.types, sizeof(*t));
+        if (t)
+          {
+             *t = strdup(*type);
+             wl_data_source_offer(input->data.source, *t);
+          }
+     }
+}

-- 


Reply via email to