ecore-wl2: add function for setting a drag source's actions without a drag
authorMike Blumenkrantz <zmike@osg.samsung.com>
Fri, 12 May 2017 16:08:32 +0000 (12:08 -0400)
committerMike Blumenkrantz <zmike@osg.samsung.com>
Fri, 12 May 2017 16:08:25 +0000 (12:08 -0400)
in some cases it may be desired to have a drag data source without ever
initiating a drag, so ensure that it's possible to set the actions of the
source which will be passed for drag operations in this case

@feature

src/lib/ecore_wl2/Ecore_Wl2.h
src/lib/ecore_wl2/ecore_wl2_dnd.c

index 79cd8e5..e791ef8 100644 (file)
@@ -1087,6 +1087,16 @@ EAPI void ecore_wl2_dnd_drag_types_set(Ecore_Wl2_Input *input, const char **type
 EAPI uint32_t ecore_wl2_dnd_drag_start(Ecore_Wl2_Input *input, Ecore_Wl2_Window *window, Ecore_Wl2_Window *drag_window);
 
 /**
+ * Call wl_data_source.set_actions on an existing source
+ *
+ * @param input the input to use
+ *
+ * @see ecore_wl2_dnd_drag_start for a more useful function.
+ *
+ * @since 1.20
+ */
+EAPI EAPI void ecore_wl2_dnd_set_actions(Ecore_Wl2_Input *input);
+/**
  * End a drag started by a call to ecore_wl2_dnd_drag_start
  *
  * @param input the input object on which the drag was started
index e64fb21..e7c8da8 100644 (file)
@@ -491,6 +491,17 @@ ecore_wl2_dnd_drag_start(Ecore_Wl2_Input *input, Ecore_Wl2_Window *window, Ecore
 }
 
 EAPI void
+ecore_wl2_dnd_set_actions(Ecore_Wl2_Input *input)
+{
+   EINA_SAFETY_ON_NULL_RETURN(input);
+   EINA_SAFETY_ON_NULL_RETURN(input->data.drag.source);
+   EINA_SAFETY_ON_NULL_RETURN(input->data.drag.types.data);
+   if (input->display->wl.data_device_manager_version >= WL_DATA_SOURCE_SET_ACTIONS_SINCE_VERSION)
+     wl_data_source_set_actions(input->data.drag.source,
+       WL_DATA_DEVICE_MANAGER_DND_ACTION_MOVE | WL_DATA_DEVICE_MANAGER_DND_ACTION_COPY);
+}
+
+EAPI void
 ecore_wl2_dnd_drag_end(Ecore_Wl2_Input *input)
 {
    Ecore_Wl2_Event_Dnd_End *ev;