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.
This commit is contained in:
Thiep Ha 2016-05-03 10:42:31 +00:00
parent bcba96656a
commit aa0ace21d7
3 changed files with 11 additions and 0 deletions

View File

@ -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

View File

@ -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;

View File

@ -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;