17 # define alloca __builtin_alloca
19 # define alloca __alloca
20 # elif defined _MSC_VER
22 # define alloca _alloca
23 # elif !defined HAVE_ALLOCA
27 void *alloca (size_t);
31 #include "ecore_xcb_private.h"
32 //#include "Ecore_X_Atoms.h"
34 #define ECORE_XCB_SELECTION_DATA(x) ((Ecore_X_Selection_Data *)(x))
36 /* local function prototypes */
37 static Eina_Bool _ecore_xcb_selection_converter_text(char *target,
44 static void *_ecore_xcb_selection_parser_text(const char *target __UNUSED__,
47 int format __UNUSED__);
48 static void *_ecore_xcb_selection_parser_files(const char *target,
51 int format __UNUSED__);
52 static void *_ecore_xcb_selection_parser_targets(const char *target __UNUSED__,
55 int format __UNUSED__);
57 //static int _ecore_xcb_selection_data_free(void *data);
58 static int _ecore_xcb_selection_data_text_free(void *data);
59 static int _ecore_xcb_selection_data_targets_free(void *data);
60 static int _ecore_xcb_selection_data_files_free(void *data);
61 static int _ecore_xcb_selection_data_default_free(void *data);
62 static Eina_Bool _ecore_xcb_selection_set(Ecore_X_Window win,
65 Ecore_X_Atom selection);
66 static void _ecore_xcb_selection_request(Ecore_X_Window win,
67 Ecore_X_Atom selection,
69 static Ecore_X_Atom _ecore_xcb_selection_target_atom_get(const char *target);
72 static Ecore_X_Selection_Intern _selections[4];
73 static Ecore_X_Selection_Converter *_converters = NULL;
74 static Ecore_X_Selection_Parser *_parsers = NULL;
78 _ecore_xcb_selection_init(void)
80 LOGFN(__FILE__, __LINE__, __FUNCTION__);
82 memset(_selections, 0, sizeof(_selections));
85 ecore_x_selection_converter_atom_add(ECORE_X_ATOM_TEXT,
86 _ecore_xcb_selection_converter_text);
87 ecore_x_selection_converter_atom_add(ECORE_X_ATOM_UTF8_STRING,
88 _ecore_xcb_selection_converter_text);
89 ecore_x_selection_converter_atom_add(ECORE_X_ATOM_COMPOUND_TEXT,
90 _ecore_xcb_selection_converter_text);
91 ecore_x_selection_converter_atom_add(ECORE_X_ATOM_STRING,
92 _ecore_xcb_selection_converter_text);
95 ecore_x_selection_parser_add("text/plain",
96 _ecore_xcb_selection_parser_text);
97 ecore_x_selection_parser_add(ECORE_X_SELECTION_TARGET_UTF8_STRING,
98 _ecore_xcb_selection_parser_text);
99 ecore_x_selection_parser_add("text/uri-list",
100 _ecore_xcb_selection_parser_files);
101 ecore_x_selection_parser_add("_NETSCAPE_URL",
102 _ecore_xcb_selection_parser_files);
103 ecore_x_selection_parser_add(ECORE_X_SELECTION_TARGET_TARGETS,
104 _ecore_xcb_selection_parser_targets);
108 _ecore_xcb_selection_shutdown(void)
110 Ecore_X_Selection_Converter *cnv;
111 Ecore_X_Selection_Parser *prs;
113 LOGFN(__FILE__, __LINE__, __FUNCTION__);
115 /* free selection converters */
119 Ecore_X_Selection_Converter *tmp;
131 Ecore_X_Selection_Parser *tmp;
141 /* public functions */
143 ecore_x_selection_converter_atom_add(Ecore_X_Atom target,
144 Eina_Bool (*func)(char *target,
152 Ecore_X_Selection_Converter *cnv;
154 LOGFN(__FILE__, __LINE__, __FUNCTION__);
161 if (cnv->target == target)
171 cnv->next = calloc(1, sizeof(Ecore_X_Selection_Converter));
172 if (!cnv->next) return;
177 _converters = calloc(1, sizeof(Ecore_X_Selection_Converter));
178 if (!_converters) return;
181 cnv->target = target;
186 ecore_x_selection_converter_add(char *target,
187 Eina_Bool (*func)(char *target,
192 Ecore_X_Atom *atom_ret,
195 Ecore_X_Atom atarget;
197 LOGFN(__FILE__, __LINE__, __FUNCTION__);
199 if ((!func) || (!target)) return;
200 atarget = _ecore_xcb_selection_target_atom_get(target);
201 ecore_x_selection_converter_atom_add(atarget, func);
205 ecore_x_selection_converter_del(char *target)
207 Ecore_X_Atom atarget;
209 LOGFN(__FILE__, __LINE__, __FUNCTION__);
212 atarget = _ecore_xcb_selection_target_atom_get(target);
213 ecore_x_selection_converter_atom_del(atarget);
217 ecore_x_selection_converter_atom_del(Ecore_X_Atom target)
219 Ecore_X_Selection_Converter *conv, *pconv = NULL;
221 LOGFN(__FILE__, __LINE__, __FUNCTION__);
226 if (conv->target == target)
229 pconv->next = conv->next;
231 _converters = conv->next;
241 ecore_x_selection_parser_add(const char *target,
242 void *(*func)(const char *target, void *data, int size, int format))
244 Ecore_X_Selection_Parser *prs;
246 LOGFN(__FILE__, __LINE__, __FUNCTION__);
254 if (!strcmp(prs->target, target))
261 prs->next = calloc(1, sizeof(Ecore_X_Selection_Parser));
266 _parsers = calloc(1, sizeof(Ecore_X_Selection_Parser));
269 prs->target = strdup(target);
274 ecore_x_selection_parser_del(const char *target)
276 Ecore_X_Selection_Parser *prs, *pprs = NULL;
278 LOGFN(__FILE__, __LINE__, __FUNCTION__);
285 if (!strcmp(prs->target, target))
288 pprs->next = prs->next;
290 _parsers = prs->next;
301 * Claim ownership of the PRIMARY selection and set its data.
302 * @param w The window to which this selection belongs
303 * @param data The data associated with the selection
304 * @param size The size of the data buffer in bytes
305 * @return Returns 1 if the ownership of the selection was successfully
306 * claimed, or 0 if unsuccessful.
309 ecore_x_selection_primary_set(Ecore_X_Window win,
313 LOGFN(__FILE__, __LINE__, __FUNCTION__);
315 return _ecore_xcb_selection_set(win, data, size,
316 ECORE_X_ATOM_SELECTION_PRIMARY);
320 * Release ownership of the primary selection
321 * @return Returns 1 if the selection was successfully cleared,
322 * or 0 if unsuccessful.
325 ecore_x_selection_primary_clear(void)
327 LOGFN(__FILE__, __LINE__, __FUNCTION__);
329 return _ecore_xcb_selection_set(XCB_NONE, NULL, 0,
330 ECORE_X_ATOM_SELECTION_PRIMARY);
334 ecore_x_selection_primary_request(Ecore_X_Window win,
337 LOGFN(__FILE__, __LINE__, __FUNCTION__);
339 _ecore_xcb_selection_request(win, ECORE_X_ATOM_SELECTION_PRIMARY, target);
343 * Claim ownership of the SECONDARY selection and set its data.
344 * @param w The window to which this selection belongs
345 * @param data The data associated with the selection
346 * @param size The size of the data buffer in bytes
347 * @return Returns 1 if the ownership of the selection was successfully
348 * claimed, or 0 if unsuccessful.
351 ecore_x_selection_secondary_set(Ecore_X_Window win,
355 LOGFN(__FILE__, __LINE__, __FUNCTION__);
357 return _ecore_xcb_selection_set(win, data, size,
358 ECORE_X_ATOM_SELECTION_SECONDARY);
362 * Release ownership of the secondary selection
363 * @return Returns 1 if the selection was successfully cleared,
364 * or 0 if unsuccessful.
367 ecore_x_selection_secondary_clear(void)
369 LOGFN(__FILE__, __LINE__, __FUNCTION__);
371 return _ecore_xcb_selection_set(XCB_NONE, NULL, 0,
372 ECORE_X_ATOM_SELECTION_SECONDARY);
376 ecore_x_selection_secondary_request(Ecore_X_Window win,
379 LOGFN(__FILE__, __LINE__, __FUNCTION__);
381 _ecore_xcb_selection_request(win, ECORE_X_ATOM_SELECTION_SECONDARY, target);
385 * Claim ownership of the XDND selection and set its data.
386 * @param w The window to which this selection belongs
387 * @param data The data associated with the selection
388 * @param size The size of the data buffer in bytes
389 * @return Returns 1 if the ownership of the selection was successfully
390 * claimed, or 0 if unsuccessful.
393 ecore_x_selection_xdnd_set(Ecore_X_Window win,
397 LOGFN(__FILE__, __LINE__, __FUNCTION__);
399 return _ecore_xcb_selection_set(win, data, size,
400 ECORE_X_ATOM_SELECTION_XDND);
404 * Release ownership of the XDND selection
405 * @return Returns 1 if the selection was successfully cleared,
406 * or 0 if unsuccessful.
409 ecore_x_selection_xdnd_clear(void)
411 LOGFN(__FILE__, __LINE__, __FUNCTION__);
413 return _ecore_xcb_selection_set(XCB_NONE, NULL, 0,
414 ECORE_X_ATOM_SELECTION_XDND);
418 ecore_x_selection_xdnd_request(Ecore_X_Window win,
422 Ecore_X_DND_Target *_target;
424 LOGFN(__FILE__, __LINE__, __FUNCTION__);
427 _target = _ecore_xcb_dnd_target_get();
428 atom = _ecore_xcb_selection_target_atom_get(target);
430 xcb_convert_selection(_ecore_xcb_conn, win, ECORE_X_ATOM_SELECTION_XDND,
431 atom, ECORE_X_ATOM_SELECTION_PROP_XDND, _target->time);
435 * Claim ownership of the CLIPBOARD selection and set its data.
436 * @param w The window to which this selection belongs
437 * @param data The data associated with the selection
438 * @param size The size of the data buffer in bytes
439 * @return Returns 1 if the ownership of the selection was successfully
440 * claimed, or 0 if unsuccessful.
442 * Get the converted data from a previous CLIPBOARD selection
443 * request. The buffer must be freed when done with.
446 ecore_x_selection_clipboard_set(Ecore_X_Window win,
450 LOGFN(__FILE__, __LINE__, __FUNCTION__);
452 return _ecore_xcb_selection_set(win, data, size,
453 ECORE_X_ATOM_SELECTION_CLIPBOARD);
457 * Release ownership of the clipboard selection
458 * @return Returns 1 if the selection was successfully cleared,
459 * or 0 if unsuccessful.
462 ecore_x_selection_clipboard_clear(void)
464 LOGFN(__FILE__, __LINE__, __FUNCTION__);
466 return _ecore_xcb_selection_set(XCB_NONE, NULL, 0,
467 ECORE_X_ATOM_SELECTION_CLIPBOARD);
471 ecore_x_selection_clipboard_request(Ecore_X_Window win,
474 LOGFN(__FILE__, __LINE__, __FUNCTION__);
476 _ecore_xcb_selection_request(win, ECORE_X_ATOM_SELECTION_CLIPBOARD, target);
480 ecore_x_selection_convert(Ecore_X_Atom selection,
484 Ecore_X_Atom *targtype,
487 Ecore_X_Selection_Intern *sel;
488 Ecore_X_Selection_Converter *cnv;
492 LOGFN(__FILE__, __LINE__, __FUNCTION__);
494 sel = _ecore_xcb_selection_get(selection);
495 tgt_str = _ecore_xcb_selection_target_get(target);
497 for (cnv = _converters; cnv; cnv = cnv->next)
499 if (cnv->target == target)
503 r = cnv->convert(tgt_str, sel->data, sel->length, &data, size,
508 if (data_ret) *data_ret = data;
521 ecore_x_selection_notify_send(Ecore_X_Window requestor,
522 Ecore_X_Atom selection,
524 Ecore_X_Atom property,
527 xcb_selection_notify_event_t ev;
529 LOGFN(__FILE__, __LINE__, __FUNCTION__);
532 memset(&ev, 0, sizeof(xcb_selection_notify_event_t));
534 ev.response_type = XCB_SELECTION_NOTIFY;
535 ev.requestor = requestor;
536 ev.selection = selection;
538 ev.property = property;
541 xcb_send_event(_ecore_xcb_conn, 0, requestor,
542 XCB_EVENT_MASK_NO_EVENT, (const char *)&ev);
549 ecore_x_selection_owner_set(Ecore_X_Window win,
553 LOGFN(__FILE__, __LINE__, __FUNCTION__);
556 xcb_set_selection_owner(_ecore_xcb_conn, win, atom, tim);
560 ecore_x_selection_owner_get(Ecore_X_Atom atom)
562 xcb_get_selection_owner_cookie_t cookie;
563 xcb_get_selection_owner_reply_t *reply;
566 LOGFN(__FILE__, __LINE__, __FUNCTION__);
569 cookie = xcb_get_selection_owner(_ecore_xcb_conn, atom);
570 reply = xcb_get_selection_owner_reply(_ecore_xcb_conn, cookie, NULL);
571 if (!reply) return 0;
578 _ecore_xcb_selection_parse(const char *target,
583 Ecore_X_Selection_Parser *prs;
584 Ecore_X_Selection_Data *sel;
586 for (prs = _parsers; prs; prs = prs->next)
588 if (!strcmp(prs->target, target))
590 sel = prs->parse(target, data, size, format);
595 sel = calloc(1, sizeof(Ecore_X_Selection_Data));
596 if (!sel) return NULL;
597 sel->free = _ecore_xcb_selection_data_default_free;
599 sel->format = format;
605 Ecore_X_Selection_Intern *
606 _ecore_xcb_selection_get(Ecore_X_Atom selection)
608 if (selection == ECORE_X_ATOM_SELECTION_PRIMARY)
609 return &_selections[0];
610 else if (selection == ECORE_X_ATOM_SELECTION_SECONDARY)
611 return &_selections[1];
612 else if (selection == ECORE_X_ATOM_SELECTION_XDND)
613 return &_selections[2];
614 else if (selection == ECORE_X_ATOM_SELECTION_CLIPBOARD)
615 return &_selections[3];
620 /* local functions */
622 _ecore_xcb_selection_set(Ecore_X_Window win,
625 Ecore_X_Atom selection)
627 xcb_get_selection_owner_cookie_t cookie;
628 xcb_get_selection_owner_reply_t *reply;
631 LOGFN(__FILE__, __LINE__, __FUNCTION__);
634 xcb_set_selection_owner(_ecore_xcb_conn, win, selection, XCB_CURRENT_TIME);
636 cookie = xcb_get_selection_owner(_ecore_xcb_conn, selection);
637 reply = xcb_get_selection_owner_reply(_ecore_xcb_conn, cookie, NULL);
638 if (!reply) return EINA_FALSE;
640 if (reply->owner != win)
647 if (selection == ECORE_X_ATOM_SELECTION_PRIMARY)
649 else if (selection == ECORE_X_ATOM_SELECTION_SECONDARY)
651 else if (selection == ECORE_X_ATOM_SELECTION_XDND)
653 else if (selection == ECORE_X_ATOM_SELECTION_CLIPBOARD)
660 unsigned char *buff = NULL;
662 _selections[in].win = win;
663 _selections[in].selection = selection;
664 _selections[in].length = size;
665 _selections[in].time = _ecore_xcb_events_last_time_get();
668 if (!buff) return EINA_FALSE;
669 memcpy(buff, data, size);
670 _selections[in].data = buff;
672 else if (_selections[in].data)
674 free(_selections[in].data);
675 memset(&_selections[in], 0, sizeof(Ecore_X_Selection_Data));
682 _ecore_xcb_selection_request(Ecore_X_Window win,
683 Ecore_X_Atom selection,
686 Ecore_X_Atom atarget, prop;
688 LOGFN(__FILE__, __LINE__, __FUNCTION__);
691 if (selection == ECORE_X_ATOM_SELECTION_PRIMARY)
692 prop = ECORE_X_ATOM_SELECTION_PROP_PRIMARY;
693 else if (selection == ECORE_X_ATOM_SELECTION_SECONDARY)
694 prop = ECORE_X_ATOM_SELECTION_PROP_SECONDARY;
695 else if (selection == ECORE_X_ATOM_SELECTION_CLIPBOARD)
696 prop = ECORE_X_ATOM_SELECTION_PROP_CLIPBOARD;
700 atarget = _ecore_xcb_selection_target_atom_get(target);
702 xcb_convert_selection(_ecore_xcb_conn, win, selection, atarget, prop,
707 _ecore_xcb_selection_converter_text(char *target,
712 Ecore_X_Atom *type __UNUSED__,
713 int *size_type __UNUSED__)
715 Ecore_Xcb_Encoding_Style style;
716 Ecore_Xcb_Textproperty ret;
719 LOGFN(__FILE__, __LINE__, __FUNCTION__);
722 if ((!data) || (!size)) return EINA_FALSE;
724 if (!strcmp(target, ECORE_X_SELECTION_TARGET_TEXT))
725 style = XcbTextStyle;
726 else if (!strcmp(target, ECORE_X_SELECTION_TARGET_COMPOUND_TEXT))
727 style = XcbCompoundTextStyle;
728 else if (!strcmp(target, ECORE_X_SELECTION_TARGET_STRING))
729 style = XcbStringStyle;
731 else if (!strcmp(target, ECORE_X_SELECTION_TARGET_UTF8_STRING))
732 style = XcbUTF8StringStyle;
737 str = alloca(size + 1);
738 memcpy(str, data, size);
742 if (_ecore_xcb_utf8_textlist_to_textproperty(&str, 1, style, &ret))
746 size = (strlen((char *)ret.value) + 1);
747 *data_ret = malloc(size);
748 if (!*data_ret) return EINA_FALSE;
749 memcpy(*data_ret, ret.value, size);
751 if (ret.value) free(ret.value);
755 if (_ecore_xcb_mb_textlist_to_textproperty(&str, 1, style, &ret))
759 size = (strlen((char *)ret.value) + 1);
760 *data_ret = malloc(size);
761 if (!*data_ret) return EINA_FALSE;
762 memcpy(*data_ret, ret.value, size);
764 if (ret.value) free(ret.value);
773 _ecore_xcb_selection_parser_text(const char *target __UNUSED__,
776 int format __UNUSED__)
778 Ecore_X_Selection_Data_Text *sel;
779 unsigned char *_data;
782 LOGFN(__FILE__, __LINE__, __FUNCTION__);
784 if (!(_data = data)) return NULL;
786 sel = calloc(1, sizeof(Ecore_X_Selection_Data_Text));
787 if (!sel) return NULL;
789 if (_data && _data[size - 1])
792 t = realloc(_data, size);
801 sel->text = (char *)_data;
802 ECORE_XCB_SELECTION_DATA(sel)->length = size;
803 ECORE_XCB_SELECTION_DATA(sel)->content = ECORE_X_SELECTION_CONTENT_TEXT;
804 ECORE_XCB_SELECTION_DATA(sel)->data = _data;
805 ECORE_XCB_SELECTION_DATA(sel)->free = _ecore_xcb_selection_data_text_free;
810 _ecore_xcb_selection_parser_files(const char *target,
813 int format __UNUSED__)
815 Ecore_X_Selection_Data_Files *sel;
816 char *_data, *tmp, *t, **t2;
819 LOGFN(__FILE__, __LINE__, __FUNCTION__);
821 if ((strcmp(target, "text/uri-list")) &&
822 (strcmp(target, "_NETSCAPE_URL"))) return NULL;
824 if (!(_data = data)) return NULL;
826 sel = calloc(1, sizeof(Ecore_X_Selection_Data_Files));
827 if (!sel) return NULL;
829 ECORE_XCB_SELECTION_DATA(sel)->free = _ecore_xcb_selection_data_files_free;
831 if (_data && _data[size - 1])
834 t = realloc(_data, size);
851 while ((is < size) && (_data[is]))
853 if ((i == 0) && (_data[is] == '#'))
855 for (; ((_data[is]) && (_data[is] != '\n')); is++) ;
859 if ((_data[is] != '\r') && (_data[is] != '\n'))
860 tmp[i++] = _data[is++];
863 while ((_data[is] == '\r') || (_data[is] == '\n'))
867 t2 = realloc(sel->files, sel->num_files * sizeof(char *));
871 sel->files[sel->num_files - 1] = strdup(tmp);
882 t2 = realloc(sel->files, sel->num_files * sizeof(char *));
886 sel->files[sel->num_files - 1] = strdup(tmp);
890 if (_data) free(_data);
892 ECORE_XCB_SELECTION_DATA(sel)->content = ECORE_X_SELECTION_CONTENT_FILES;
893 ECORE_XCB_SELECTION_DATA(sel)->length = sel->num_files;
895 return ECORE_XCB_SELECTION_DATA(sel);
899 _ecore_xcb_selection_parser_targets(const char *target __UNUSED__,
902 int format __UNUSED__)
904 Ecore_X_Selection_Data_Targets *sel;
908 LOGFN(__FILE__, __LINE__, __FUNCTION__);
911 if (!(targets = data)) return NULL;
913 sel = calloc(1, sizeof(Ecore_X_Selection_Data_Targets));
914 if (!sel) return NULL;
916 sel->num_targets = (size - 2);
917 sel->targets = malloc((size - 2) * sizeof(char *));
924 for (i = 2; i < size; i++)
926 xcb_get_atom_name_cookie_t cookie;
927 xcb_get_atom_name_reply_t *reply;
931 cookie = xcb_get_atom_name_unchecked(_ecore_xcb_conn, targets[i]);
932 reply = xcb_get_atom_name_reply(_ecore_xcb_conn, cookie, NULL);
935 len = xcb_get_atom_name_name_length(reply);
936 name = (char *)malloc(sizeof(char) * (len + 1));
939 memcpy(name, xcb_get_atom_name_name(reply), len);
941 sel->targets[i - 2] = name;
947 ECORE_XCB_SELECTION_DATA(sel)->free =
948 _ecore_xcb_selection_data_targets_free;
949 ECORE_XCB_SELECTION_DATA(sel)->content = ECORE_X_SELECTION_CONTENT_TARGETS;
950 ECORE_XCB_SELECTION_DATA(sel)->length = size;
951 ECORE_XCB_SELECTION_DATA(sel)->data = data;
958 _ecore_xcb_selection_data_free(void *data)
960 Ecore_X_Selection_Data *sel;
962 LOGFN(__FILE__, __LINE__, __FUNCTION__);
964 if (!(sel = data)) return 0;
965 if (sel->data) free(sel->data);
972 _ecore_xcb_selection_data_text_free(void *data)
974 Ecore_X_Selection_Data_Text *sel;
976 LOGFN(__FILE__, __LINE__, __FUNCTION__);
978 if (!(sel = data)) return 0;
979 if (sel->text) free(sel->text);
985 _ecore_xcb_selection_data_targets_free(void *data)
987 Ecore_X_Selection_Data_Targets *sel;
989 LOGFN(__FILE__, __LINE__, __FUNCTION__);
991 if (!(sel = data)) return 0;
992 if (sel->targets) free(sel->targets);
993 free(ECORE_XCB_SELECTION_DATA(sel)->data);
999 _ecore_xcb_selection_data_files_free(void *data)
1001 Ecore_X_Selection_Data_Files *sel;
1003 LOGFN(__FILE__, __LINE__, __FUNCTION__);
1005 if (!(sel = data)) return 0;
1010 for (i = 0; i < sel->num_files; i++)
1011 if (sel->files[i]) free(sel->files[i]);
1012 if (sel->files) free(sel->files);
1019 _ecore_xcb_selection_data_default_free(void *data)
1021 Ecore_X_Selection_Data *sel;
1023 if (!(sel = data)) return 1;
1030 _ecore_xcb_selection_target_atom_get(const char *target)
1032 Ecore_X_Atom x_target;
1034 if (!strcmp(target, ECORE_X_SELECTION_TARGET_TEXT))
1035 x_target = ECORE_X_ATOM_TEXT;
1036 else if (!strcmp(target, ECORE_X_SELECTION_TARGET_COMPOUND_TEXT))
1037 x_target = ECORE_X_ATOM_COMPOUND_TEXT;
1038 else if (!strcmp(target, ECORE_X_SELECTION_TARGET_STRING))
1039 x_target = ECORE_X_ATOM_STRING;
1040 else if (!strcmp(target, ECORE_X_SELECTION_TARGET_UTF8_STRING))
1041 x_target = ECORE_X_ATOM_UTF8_STRING;
1042 else if (!strcmp(target, ECORE_X_SELECTION_TARGET_FILENAME))
1043 x_target = ECORE_X_ATOM_FILE_NAME;
1045 x_target = ecore_x_atom_get(target);
1051 _ecore_xcb_selection_target_get(Ecore_X_Atom target)
1053 if (target == ECORE_X_ATOM_FILE_NAME)
1054 return strdup(ECORE_X_SELECTION_TARGET_FILENAME);
1055 else if (target == ECORE_X_ATOM_STRING)
1056 return strdup(ECORE_X_SELECTION_TARGET_STRING);
1057 else if (target == ECORE_X_ATOM_UTF8_STRING)
1058 return strdup(ECORE_X_SELECTION_TARGET_UTF8_STRING);
1059 else if (target == ECORE_X_ATOM_TEXT)
1060 return strdup(ECORE_X_SELECTION_TARGET_TEXT);
1062 return ecore_x_atom_name_get(target);