summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThiep Ha <thiepha@gmail.com>2015-05-10 17:49:24 +0900
committerThiep Ha <thiepha@gmail.com>2015-05-10 17:49:24 +0900
commitec5deb8688dc23f9aa4b2dc4cede8948136c7bfe (patch)
treedcd3aa122cf01674b941b465331a4611a3ee16ce
parent1ce417eb8b928053cd21b0fe829923745821aff8 (diff)
downloadefl-devs/thiep/dnd.tar.gz
ecore-wayland: add Ecore_Wayland_Selection typedevs/thiep/dnd
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.
-rw-r--r--src/lib/ecore_wayland/Ecore_Wayland.h8
-rw-r--r--src/lib/ecore_wayland/ecore_wl_dnd.c3
-rw-r--r--src/lib/ecore_wayland/ecore_wl_private.h1
3 files changed, 12 insertions, 0 deletions
diff --git a/src/lib/ecore_wayland/Ecore_Wayland.h b/src/lib/ecore_wayland/Ecore_Wayland.h
index 173501407f..a76722dea2 100644
--- a/src/lib/ecore_wayland/Ecore_Wayland.h
+++ b/src/lib/ecore_wayland/Ecore_Wayland.h
@@ -84,8 +84,15 @@ enum _Ecore_Wl_Window_Buffer_Type
ECORE_WL_WINDOW_BUFFER_TYPE_SHM
};
+enum _Ecore_Wl_Selection
+{
+ ECORE_WL_SELECTION_CNP,
+ ECORE_WL_SELECTION_DND
+};
+
typedef enum _Ecore_Wl_Window_Type Ecore_Wl_Window_Type;
typedef enum _Ecore_Wl_Window_Buffer_Type Ecore_Wl_Window_Buffer_Type;
+typedef enum _Ecore_Wl_Selection Ecore_Wl_Selection;
/** @since 1.7.6 */
struct _Ecore_Wl_Global
@@ -210,6 +217,7 @@ struct _Ecore_Wl_Event_Selection_Data_Ready
char *data;
int len;
Eina_Bool done;
+ Ecore_Wl_Selection selection;
};
struct _Ecore_Wl_Event_Interfaces_Bound
diff --git a/src/lib/ecore_wayland/ecore_wl_dnd.c b/src/lib/ecore_wayland/ecore_wl_dnd.c
index 51653283a0..82a3a1673b 100644
--- a/src/lib/ecore_wayland/ecore_wl_dnd.c
+++ b/src/lib/ecore_wayland/ecore_wl_dnd.c
@@ -176,6 +176,7 @@ ecore_wl_dnd_selection_get(Ecore_Wl_Input *input, const char *type)
if (!*t) return EINA_FALSE;
+ input->selection_source->selection = ECORE_WL_SELECTION_CNP;
_ecore_wl_dnd_selection_data_receive(input->selection_source, type);
return EINA_TRUE;
@@ -331,6 +332,7 @@ ecore_wl_dnd_drag_get(Ecore_Wl_Input *input, const char *type)
if (!*t) return EINA_FALSE;
+ input->drag_source->selection = ECORE_WL_SELECTION_DND;
_ecore_wl_dnd_selection_data_receive(input->drag_source, type);
return EINA_TRUE;
@@ -659,6 +661,7 @@ _ecore_wl_dnd_selection_data_read(void *data, Ecore_Fd_Handler *fd_handler EINA_
if (!(event = calloc(1, sizeof(Ecore_Wl_Event_Selection_Data_Ready))))
return ECORE_CALLBACK_CANCEL;
+ event->selection = source->selection;
if (len <= 0)
{
close(source->fd);
diff --git a/src/lib/ecore_wayland/ecore_wl_private.h b/src/lib/ecore_wayland/ecore_wl_private.h
index 77c12dbdf6..686852217a 100644
--- a/src/lib/ecore_wayland/ecore_wl_private.h
+++ b/src/lib/ecore_wayland/ecore_wl_private.h
@@ -263,6 +263,7 @@ struct _Ecore_Wl_Dnd_Source
struct wl_data_offer *data_offer;
struct wl_array types;
+ Ecore_Wl_Selection selection;
int refcount;
int fd;