From: Chris Michael Date: Tue, 29 Sep 2015 16:02:15 +0000 (-0400) Subject: ecore-wl2: Add API function to set a dnd selection X-Git-Tag: accepted/tizen/common/20160921.162828~46 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=2b7bd3c90debe504b845f3d5d3454c9f237bbe67;p=platform%2Fupstream%2Fefl.git ecore-wl2: Add API function to set a dnd selection Change-Id: I4ccc0400197222dcfcc52e460ac87930fe6bbf8d Signed-off-by: Chris Michael --- diff --git a/src/lib/ecore_wayland/ecore_wl_dnd.c b/src/lib/ecore_wayland/ecore_wl_dnd.c index 5076aa1..bb68dd3 100644 --- a/src/lib/ecore_wayland/ecore_wl_dnd.c +++ b/src/lib/ecore_wayland/ecore_wl_dnd.c @@ -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 */