From: Thiep Ha Date: Tue, 3 May 2016 10:42:31 +0000 (+0000) Subject: ecore wayland: add selection type X-Git-Tag: upstream/1.20.0~6525 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=aa0ace21d7d1aa014fd3a5e743d8787ee35622aa;p=platform%2Fupstream%2Fefl.git 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. --- 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;