ecore-wl2: Add API function to set a dnd selection 98/87798/2
authorChris Michael <cp.michael@samsung.com>
Tue, 29 Sep 2015 16:02:15 +0000 (12:02 -0400)
committerGerrit Code Review <gerrit@review.vlan103.tizen.org>
Mon, 12 Sep 2016 05:27:35 +0000 (22:27 -0700)
Change-Id: I4ccc0400197222dcfcc52e460ac87930fe6bbf8d
Signed-off-by: Chris Michael <cp.michael@samsung.com>
src/lib/ecore_wayland/ecore_wl_dnd.c

index 5076aa1..bb68dd3 100644 (file)
@@ -112,7 +112,7 @@ ecore_wl_dnd_selection_has_owner(Ecore_Wl_Dnd *dnd)
 EAPI Eina_Bool
 ecore_wl_dnd_selection_set(Ecore_Wl_Input *input, const char **types_offered)
 {
-   struct wl_data_device_manager *man;
+   struct wl_data_device_manager *manager;
    const char **type;
    char **t;
 
@@ -120,7 +120,7 @@ ecore_wl_dnd_selection_set(Ecore_Wl_Input *input, const char **types_offered)
 
    if (!input) return EINA_FALSE;
 
-   man = input->display->wl.data_device_manager;
+   manager = input->display->wl.data_device_manager;
 
    /* free any old types offered */
    if (input->data_types.data)
@@ -136,15 +136,19 @@ ecore_wl_dnd_selection_set(Ecore_Wl_Input *input, const char **types_offered)
    if (!types_offered[0]) return EINA_FALSE;
 
    /* try to create a new data source */
-   if (!(input->data_source = wl_data_device_manager_create_data_source(man)))
+   if (!(input->data_source = wl_data_device_manager_create_data_source(manager)))
      return EINA_FALSE;
 
    /* add these types to the data source */
    for (type = types_offered; *type; type++)
      {
+        if (!*type) continue;
         t = wl_array_add(&input->data_types, sizeof(*t));
-        if (t) *t = strdup(*type);
-        wl_data_source_offer(input->data_source, *t);
+        if (t)
+          {
+             *t = strdup(*type);
+             wl_data_source_offer(input->data_source, *t);
+          }
      }
 
    /* add a listener for data source events */