diff options
author | Chris Michael <cp.michael@samsung.com> | 2013-11-07 14:30:49 +0000 |
---|---|---|
committer | Chris Michael <cp.michael@samsung.com> | 2013-11-07 14:31:37 +0000 |
commit | b3e309d04fbd6d3681e06bb3edfc50c8819d004d (patch) | |
tree | 69cd5261207acd1895f1ee762893206078e5640c | |
parent | 9240c2e91c93adacbeb1e6d1ea68d1eec3c5675d (diff) | |
download | efl-b3e309d04fbd6d3681e06bb3edfc50c8819d004d.tar.gz |
Fix getting the clipboard selection and add missing LOGFN macros
Signed-off-by: Chris Michael <cp.michael@samsung.com>
-rw-r--r-- | src/lib/ecore_wayland/ecore_wl_dnd.c | 57 |
1 files changed, 53 insertions, 4 deletions
diff --git a/src/lib/ecore_wayland/ecore_wl_dnd.c b/src/lib/ecore_wayland/ecore_wl_dnd.c index f5849dcf9c..b1bf0664f3 100644 --- a/src/lib/ecore_wayland/ecore_wl_dnd.c +++ b/src/lib/ecore_wayland/ecore_wl_dnd.c @@ -54,6 +54,8 @@ _ecore_wl_dnd_offer_listener = EINA_DEPRECATED EAPI Eina_Bool ecore_wl_dnd_set_selection(Ecore_Wl_Dnd *dnd, const char **types_offered) { + LOGFN(__FILE__, __LINE__, __FUNCTION__); + return ecore_wl_dnd_selection_set(dnd->input, types_offered); } @@ -64,6 +66,8 @@ ecore_wl_dnd_set_selection(Ecore_Wl_Dnd *dnd, const char **types_offered) EINA_DEPRECATED EAPI Eina_Bool ecore_wl_dnd_get_selection(Ecore_Wl_Dnd *dnd, const char *type) { + LOGFN(__FILE__, __LINE__, __FUNCTION__); + return ecore_wl_dnd_selection_get(dnd->input, type); } @@ -108,6 +112,8 @@ ecore_wl_dnd_selection_set(Ecore_Wl_Input *input, const char **types_offered) const char **type; char **t; + LOGFN(__FILE__, __LINE__, __FUNCTION__); + if (!input) return EINA_FALSE; man = input->display->wl.data_device_manager; @@ -125,6 +131,8 @@ ecore_wl_dnd_selection_set(Ecore_Wl_Input *input, const char **types_offered) if (input->data_source) wl_data_source_destroy(input->data_source); input->data_source = NULL; + 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))) return EINA_FALSE; @@ -157,11 +165,15 @@ ecore_wl_dnd_selection_get(Ecore_Wl_Input *input, const char *type) { char **t; + LOGFN(__FILE__, __LINE__, __FUNCTION__); + /* check for valid input and selection source */ if ((!input) || (!input->selection_source)) return EINA_FALSE; - wl_array_for_each(t, &input->selection_source->types) - if (!strcmp(type, *t)) break; + for (t = input->selection_source->types.data; *t; t++) + { + if (!strcmp(type, *t)) break; + } if (!*t) return EINA_FALSE; @@ -177,6 +189,8 @@ ecore_wl_dnd_selection_get(Ecore_Wl_Input *input, const char *type) EAPI Eina_Bool ecore_wl_dnd_selection_owner_has(Ecore_Wl_Input *input) { + LOGFN(__FILE__, __LINE__, __FUNCTION__); + if (!input) return EINA_FALSE; return (input->selection_source != NULL); } @@ -188,6 +202,8 @@ ecore_wl_dnd_selection_owner_has(Ecore_Wl_Input *input) EAPI Eina_Bool ecore_wl_dnd_selection_clear(Ecore_Wl_Input *input) { + LOGFN(__FILE__, __LINE__, __FUNCTION__); + /* check for valid input */ if (!input) return EINA_FALSE; @@ -207,6 +223,8 @@ ecore_wl_dnd_drag_start(Ecore_Wl_Input *input, Ecore_Wl_Window *win, Ecore_Wl_Wi { struct wl_surface *drag_surface; + LOGFN(__FILE__, __LINE__, __FUNCTION__); + /* check for valid input. if not, get the default one */ if (!input) input = _ecore_wl_disp->input; @@ -258,6 +276,8 @@ ecore_wl_dnd_drag_end(Ecore_Wl_Input *input) { Ecore_Wl_Event_Dnd_End *ev; + LOGFN(__FILE__, __LINE__, __FUNCTION__); + /* check for valid input. if not, get the default one */ if (!input) input = _ecore_wl_disp->input; @@ -298,6 +318,8 @@ ecore_wl_dnd_drag_get(Ecore_Wl_Input *input, const char *type) { char **t; + LOGFN(__FILE__, __LINE__, __FUNCTION__); + /* check for valid input and drag source */ if ((!input) || (!input->drag_source)) return EINA_FALSE; @@ -322,6 +344,8 @@ ecore_wl_dnd_drag_types_set(Ecore_Wl_Input *input, const char **types_offered) const char **type; char **t; + LOGFN(__FILE__, __LINE__, __FUNCTION__); + /* check for valid input. if not, get the default one */ if (!input) input = _ecore_wl_disp->input; @@ -363,6 +387,8 @@ ecore_wl_dnd_drag_types_set(Ecore_Wl_Input *input, const char **types_offered) EAPI struct wl_array * ecore_wl_dnd_drag_types_get(Ecore_Wl_Input *input) { + LOGFN(__FILE__, __LINE__, __FUNCTION__); + /* check for valid input. if not, get the default one */ if (!input) input = _ecore_wl_disp->input; @@ -375,6 +401,8 @@ _ecore_wl_dnd_add(Ecore_Wl_Input *input, struct wl_data_device *data_device EINA { Ecore_Wl_Dnd_Source *source; + LOGFN(__FILE__, __LINE__, __FUNCTION__); + if (!(source = malloc(sizeof(Ecore_Wl_Dnd_Source)))) return; @@ -396,6 +424,8 @@ _ecore_wl_dnd_enter(void *data, struct wl_data_device *data_device EINA_UNUSED, char **types; int num = 0; + LOGFN(__FILE__, __LINE__, __FUNCTION__); + if (!(input = data)) return; win = ecore_wl_window_surface_find(surface); @@ -440,6 +470,8 @@ _ecore_wl_dnd_leave(void *data, struct wl_data_device *data_device EINA_UNUSED) Ecore_Wl_Event_Dnd_Leave *ev; Ecore_Wl_Input *input; + LOGFN(__FILE__, __LINE__, __FUNCTION__); + if (!(input = data)) return; if (!(ev = calloc(1, sizeof(Ecore_Wl_Event_Dnd_Leave)))) return; @@ -459,6 +491,8 @@ _ecore_wl_dnd_motion(void *data, struct wl_data_device *data_device EINA_UNUSED, Ecore_Wl_Event_Dnd_Position *ev; Ecore_Wl_Input *input; + LOGFN(__FILE__, __LINE__, __FUNCTION__); + if (!(input = data)) return; input->sx = wl_fixed_to_int(x); @@ -484,6 +518,8 @@ _ecore_wl_dnd_drop(void *data, struct wl_data_device *data_device EINA_UNUSED) Ecore_Wl_Event_Dnd_Drop *ev; Ecore_Wl_Input *input; + LOGFN(__FILE__, __LINE__, __FUNCTION__); + if (!(input = data)) return; if (!(ev = calloc(1, sizeof(Ecore_Wl_Event_Dnd_Drop)))) return; @@ -507,9 +543,12 @@ _ecore_wl_dnd_selection(void *data, struct wl_data_device *data_device EINA_UNUS { Ecore_Wl_Input *input; + LOGFN(__FILE__, __LINE__, __FUNCTION__); + if (!(input = data)) return; if (input->selection_source) _ecore_wl_dnd_del(input->selection_source); + input->selection_source = NULL; if (offer) { @@ -519,13 +558,13 @@ _ecore_wl_dnd_selection(void *data, struct wl_data_device *data_device EINA_UNUS t = wl_array_add(&input->selection_source->types, sizeof(*t)); *t = NULL; } - else - input->selection_source = NULL; } void _ecore_wl_dnd_del(Ecore_Wl_Dnd_Source *source) { + LOGFN(__FILE__, __LINE__, __FUNCTION__); + if (!source) return; source->refcount--; if (source->refcount == 0) @@ -546,6 +585,8 @@ _ecore_wl_dnd_selection_data_receive(Ecore_Wl_Dnd_Source *source, const char *ty struct _dnd_read_ctx *read_ctx = NULL; int p[2]; + LOGFN(__FILE__, __LINE__, __FUNCTION__); + if (pipe2(p, O_CLOEXEC) == -1) return; @@ -601,6 +642,8 @@ _ecore_wl_dnd_selection_data_read(void *data, Ecore_Fd_Handler *fd_handler EINA_ Ecore_Wl_Event_Selection_Data_Ready *event; Eina_Bool ret; + LOGFN(__FILE__, __LINE__, __FUNCTION__); + source = data; len = read(source->fd, buffer, sizeof buffer); @@ -658,6 +701,8 @@ _ecore_wl_dnd_selection_cb_idle(void *data) struct _dnd_task *task; int count, i; + LOGFN(__FILE__, __LINE__, __FUNCTION__); + ctx = data; count = epoll_wait(ctx->epoll_fd, ctx->ep, 1, 0); for (i = 0; i < count; i++) @@ -719,6 +764,8 @@ _ecore_wl_dnd_source_cb_send_free(void *data EINA_UNUSED, void *event) static void _ecore_wl_dnd_source_cb_cancelled(void *data EINA_UNUSED, struct wl_data_source *source) { + LOGFN(__FILE__, __LINE__, __FUNCTION__); + /* FIXME: Raise an Ecore_Wl_Event here */ wl_data_source_destroy(source); } @@ -729,6 +776,8 @@ _ecore_wl_dnd_offer_cb_offer(void *data, struct wl_data_offer *data_offer EINA_U Ecore_Wl_Dnd_Source *source; char **t; + LOGFN(__FILE__, __LINE__, __FUNCTION__); + if (!(source = data)) return; t = wl_array_add(&source->types, sizeof(*t)); |