ecore wl dnd: add selection event to distinguish clipboard selection in cbhm 87/78887/2 accepted/tizen/common/20160712.150604 accepted/tizen/ivi/20160712.000513 accepted/tizen/mobile/20160712.000411 accepted/tizen/tv/20160712.000439 accepted/tizen/wearable/20160712.000454 submit/tizen/20160711.123427 submit/tizen/20160711.135813
authorMinchul Lee <slotus.lee@samsung.com>
Thu, 7 Jul 2016 08:25:55 +0000 (17:25 +0900)
committerGerrit Code Review <gerrit@review.vlan103.tizen.org>
Mon, 11 Jul 2016 06:18:23 +0000 (23:18 -0700)
Change-Id: I0811d6c1f011c8fbae4b570505b59ac520aa5c1a
Signed-off-by: Minchul Lee <slotus.lee@samsung.com>
src/lib/ecore_wayland/Ecore_Wayland.h
src/lib/ecore_wayland/ecore_wl_dnd.c

index 3773d95..531a870 100644 (file)
@@ -66,6 +66,9 @@ typedef struct _Ecore_Wl_Event_Window_Show Ecore_Wl_Event_Window_Show;
 typedef struct _Ecore_Wl_Event_Window_Hide Ecore_Wl_Event_Window_Hide;
 typedef struct _Ecore_Wl_Event_Window_Lower Ecore_Wl_Event_Window_Lower;
 typedef struct _Ecore_Wl_Event_Dnd_Enter Ecore_Wl_Event_Dnd_Enter;
+// TIZEN_ONLY(20160706): To distinguish clipboard selection in cbhm
+typedef struct _Ecore_Wl_Event_Dnd_Selection Ecore_Wl_Event_Dnd_Selection;
+//
 typedef struct _Ecore_Wl_Event_Dnd_Position Ecore_Wl_Event_Dnd_Position;
 typedef struct _Ecore_Wl_Event_Dnd_Leave Ecore_Wl_Event_Dnd_Leave;
 typedef struct _Ecore_Wl_Event_Dnd_Drop Ecore_Wl_Event_Dnd_Drop;
@@ -289,6 +292,13 @@ struct _Ecore_Wl_Event_Window_Lower
    unsigned int timestamp;
 };
 
+// TIZEN_ONLY(20160706): To distinguish clipboard selection in cbhm
+struct _Ecore_Wl_Event_Dnd_Selection
+{
+   char *mime_types[10];
+};
+//
+
 struct _Ecore_Wl_Event_Dnd_Enter
 {
    unsigned int win, source;
index 20c4129..11a1dd1 100644 (file)
@@ -20,6 +20,9 @@ struct _dnd_read_ctx
 };
 
 /* local function prototypes */
+// TIZEN_ONLY(20160707): To distinguish clipboard selection in cbhm
+static void _ecore_wl_dnd_selection_cb_free(void *data EINA_UNUSED, void *event);
+//
 static void _ecore_wl_dnd_selection_data_receive(Ecore_Wl_Dnd_Source *source, const char *type);
 static Eina_Bool _ecore_wl_dnd_selection_data_read(void *data, Ecore_Fd_Handler *fd_handler EINA_UNUSED);
 static void _ecore_wl_dnd_selection_data_ready_cb_free(void *data EINA_UNUSED, void *event);
@@ -550,11 +553,18 @@ void
 _ecore_wl_dnd_selection(void *data, struct wl_data_device *data_device EINA_UNUSED, struct wl_data_offer *offer)
 {
    Ecore_Wl_Input *input;
+   // TIZEN_ONLY(20160707): To distinguish clipboard selection in cbhm
+   Ecore_Wl_Event_Dnd_Selection *ev;
+   //
 
    LOGFN(__FILE__, __LINE__, __FUNCTION__);
 
    if (!(input = data)) return;
 
+   // TIZEN_ONLY(20160707): To distinguish clipboard selection in cbhm
+   if (!(ev = calloc(1, sizeof(Ecore_Wl_Event_Dnd_Selection)))) return;
+   //
+
    if (input->selection_source) _ecore_wl_dnd_del(input->selection_source);
    input->selection_source = NULL;
 
@@ -565,8 +575,37 @@ _ecore_wl_dnd_selection(void *data, struct wl_data_device *data_device EINA_UNUS
         input->selection_source = wl_data_offer_get_user_data(offer);
         t = wl_array_add(&input->selection_source->types, sizeof(*t));
         *t = NULL;
+
+        // TIZEN_ONLY(20160707): To distinguish clipboard selection in cbhm
+        int i = 0;
+        for (t = input->selection_source->types.data; *t; t++)
+          {
+             ev->mime_types[i++] = strdup(*t);
+          }
+
+        ecore_event_add(ECORE_WL_EVENT_DND_OFFER, ev, _ecore_wl_dnd_selection_cb_free, NULL);
+        //
+     }
+}
+
+// TIZEN_ONLY(20160707): To distinguish clipboard selection in cbhm
+static void
+_ecore_wl_dnd_selection_cb_free(void *data EINA_UNUSED, void *event)
+{
+   Ecore_Wl_Event_Dnd_Selection *ev;
+   char **t;
+
+   LOGFN(__FILE__, __LINE__, __FUNCTION__);
+
+   if (!(ev = event)) return;
+
+   for (t = ev->mime_types; *t; t++)
+     {
+        free(*t);
      }
+   free(ev);
 }
+//
 
 void
 _ecore_wl_dnd_del(Ecore_Wl_Dnd_Source *source)