thiep pushed a commit to branch master.

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

commit aa0ace21d7d1aa014fd3a5e743d8787ee35622aa
Author: Thiep Ha <thie...@gmail.com>
Date:   Tue May 3 10:42:31 2016 +0000

    ecore wayland: add selection type
    
    We have copy & paste and drag & drop selection types, but we cannot
    distinguish between these two types when requesters receive data
    from data ready event.
    This patch adds a new enum to help selection requesters distinguish
    between two selection types and have suitable actions for each type.
---
 src/lib/ecore_wl2/Ecore_Wl2.h         | 7 +++++++
 src/lib/ecore_wl2/ecore_wl2_dnd.c     | 3 +++
 src/lib/ecore_wl2/ecore_wl2_private.h | 1 +
 3 files changed, 11 insertions(+)

diff --git a/src/lib/ecore_wl2/Ecore_Wl2.h b/src/lib/ecore_wl2/Ecore_Wl2.h
index 2308a9a..ff53140 100644
--- a/src/lib/ecore_wl2/Ecore_Wl2.h
+++ b/src/lib/ecore_wl2/Ecore_Wl2.h
@@ -129,11 +129,18 @@ typedef struct _Ecore_Wl2_Event_Data_Source_Send
    int fd;
 } Ecore_Wl2_Event_Data_Source_Send;
 
+typedef enum
+{
+   ECORE_WL2_SELECTION_CNP,
+   ECORE_WL2_SELECTION_DND
+} Ecore_Wl2_Selection_Type;
+
 typedef struct _Ecore_Wl2_Event_Selection_Data_Ready
 {
    char *data;
    int len;
    Eina_Bool done;
+   Ecore_Wl2_Selection_Type sel_type;
 } Ecore_Wl2_Event_Selection_Data_Ready;
 
 typedef enum
diff --git a/src/lib/ecore_wl2/ecore_wl2_dnd.c 
b/src/lib/ecore_wl2/ecore_wl2_dnd.c
index 2e4765c..e9feb12 100644
--- a/src/lib/ecore_wl2/ecore_wl2_dnd.c
+++ b/src/lib/ecore_wl2/ecore_wl2_dnd.c
@@ -232,6 +232,7 @@ _selection_data_read(void *data, Ecore_Fd_Handler *fdh)
    event = calloc(1, sizeof(Ecore_Wl2_Event_Selection_Data_Ready));
    if (!event) return ECORE_CALLBACK_CANCEL;
 
+   event->sel_type = source->sel_type;
    if (len <= 0)
      {
         if (source->input->drag.source)
@@ -530,6 +531,7 @@ ecore_wl2_dnd_drag_get(Ecore_Wl2_Input *input, const char 
*type)
 
    if (!*t) return EINA_FALSE;
 
+   input->drag.source->sel_type = ECORE_WL2_SELECTION_DND;
    _selection_data_receive(input->drag.source, type);
 
    return EINA_TRUE;
@@ -639,6 +641,7 @@ ecore_wl2_dnd_selection_get(Ecore_Wl2_Input *input, const 
char *type)
 
    if (!*t) return EINA_FALSE;
 
+   input->selection.source->sel_type = ECORE_WL2_SELECTION_CNP;
    _selection_data_receive(input->selection.source, type);
 
    return EINA_TRUE;
diff --git a/src/lib/ecore_wl2/ecore_wl2_private.h 
b/src/lib/ecore_wl2/ecore_wl2_private.h
index f1bd494..6913edc 100644
--- a/src/lib/ecore_wl2/ecore_wl2_private.h
+++ b/src/lib/ecore_wl2/ecore_wl2_private.h
@@ -188,6 +188,7 @@ typedef struct _Ecore_Wl2_Dnd_Source
    struct wl_array types;
    uint32_t dnd_action;
    uint32_t source_actions;
+   Ecore_Wl2_Selection_Type sel_type;
 } Ecore_Wl2_Dnd_Source;
 
 

-- 


Reply via email to