1 #include "ecore_xcb_private.h"
2 //#include "Ecore_X_Atoms.h"
4 #define ECORE_XCB_SELECTION_DATA(x) ((Ecore_X_Selection_Data *)(x))
6 /* local function prototypes */
7 static Eina_Bool _ecore_xcb_selection_converter_text(char *target,
14 static void *_ecore_xcb_selection_parser_text(const char *target __UNUSED__,
17 int format __UNUSED__);
18 static void *_ecore_xcb_selection_parser_files(const char *target,
21 int format __UNUSED__);
22 static void *_ecore_xcb_selection_parser_targets(const char *target __UNUSED__,
25 int format __UNUSED__);
27 //static int _ecore_xcb_selection_data_free(void *data);
28 static int _ecore_xcb_selection_data_text_free(void *data);
29 static int _ecore_xcb_selection_data_targets_free(void *data);
30 static int _ecore_xcb_selection_data_files_free(void *data);
31 static int _ecore_xcb_selection_data_default_free(void *data);
32 static Eina_Bool _ecore_xcb_selection_set(Ecore_X_Window win,
35 Ecore_X_Atom selection);
36 static void _ecore_xcb_selection_request(Ecore_X_Window win,
37 Ecore_X_Atom selection,
39 static Ecore_X_Atom _ecore_xcb_selection_target_atom_get(const char *target);
42 static Ecore_X_Selection_Intern _selections[4];
43 static Ecore_X_Selection_Converter *_converters = NULL;
44 static Ecore_X_Selection_Parser *_parsers = NULL;
48 _ecore_xcb_selection_init(void)
50 LOGFN(__FILE__, __LINE__, __FUNCTION__);
52 memset(_selections, 0, sizeof(_selections));
55 ecore_x_selection_converter_atom_add(ECORE_X_ATOM_TEXT,
56 _ecore_xcb_selection_converter_text);
57 ecore_x_selection_converter_atom_add(ECORE_X_ATOM_UTF8_STRING,
58 _ecore_xcb_selection_converter_text);
59 ecore_x_selection_converter_atom_add(ECORE_X_ATOM_COMPOUND_TEXT,
60 _ecore_xcb_selection_converter_text);
61 ecore_x_selection_converter_atom_add(ECORE_X_ATOM_STRING,
62 _ecore_xcb_selection_converter_text);
65 ecore_x_selection_parser_add("text/plain",
66 _ecore_xcb_selection_parser_text);
67 ecore_x_selection_parser_add(ECORE_X_SELECTION_TARGET_UTF8_STRING,
68 _ecore_xcb_selection_parser_text);
69 ecore_x_selection_parser_add("text/uri-list",
70 _ecore_xcb_selection_parser_files);
71 ecore_x_selection_parser_add("_NETSCAPE_URL",
72 _ecore_xcb_selection_parser_files);
73 ecore_x_selection_parser_add(ECORE_X_SELECTION_TARGET_TARGETS,
74 _ecore_xcb_selection_parser_targets);
78 _ecore_xcb_selection_shutdown(void)
80 Ecore_X_Selection_Converter *cnv;
81 Ecore_X_Selection_Parser *prs;
83 LOGFN(__FILE__, __LINE__, __FUNCTION__);
85 /* free selection converters */
89 Ecore_X_Selection_Converter *tmp;
101 Ecore_X_Selection_Parser *tmp;
111 /* public functions */
113 ecore_x_selection_converter_atom_add(Ecore_X_Atom target,
114 Eina_Bool (*func)(char *target,
122 Ecore_X_Selection_Converter *cnv;
124 LOGFN(__FILE__, __LINE__, __FUNCTION__);
131 if (cnv->target == target)
141 cnv->next = calloc(1, sizeof(Ecore_X_Selection_Converter));
142 if (!cnv->next) return;
147 _converters = calloc(1, sizeof(Ecore_X_Selection_Converter));
148 if (!_converters) return;
151 cnv->target = target;
156 ecore_x_selection_converter_add(char *target,
157 Eina_Bool (*func)(char *target,
162 Ecore_X_Atom *atom_ret,
165 Ecore_X_Atom atarget;
167 LOGFN(__FILE__, __LINE__, __FUNCTION__);
169 if ((!func) || (!target)) return;
170 atarget = _ecore_xcb_selection_target_atom_get(target);
171 ecore_x_selection_converter_atom_add(atarget, func);
175 ecore_x_selection_converter_del(char *target)
177 Ecore_X_Atom atarget;
179 LOGFN(__FILE__, __LINE__, __FUNCTION__);
182 atarget = _ecore_xcb_selection_target_atom_get(target);
183 ecore_x_selection_converter_atom_del(atarget);
187 ecore_x_selection_converter_atom_del(Ecore_X_Atom target)
189 Ecore_X_Selection_Converter *conv, *pconv = NULL;
191 LOGFN(__FILE__, __LINE__, __FUNCTION__);
196 if (conv->target == target)
199 pconv->next = conv->next;
201 _converters = conv->next;
211 ecore_x_selection_parser_add(const char *target,
212 void *(*func)(const char *target, void *data, int size, int format))
214 Ecore_X_Selection_Parser *prs;
216 LOGFN(__FILE__, __LINE__, __FUNCTION__);
224 if (!strcmp(prs->target, target))
231 prs->next = calloc(1, sizeof(Ecore_X_Selection_Parser));
236 _parsers = calloc(1, sizeof(Ecore_X_Selection_Parser));
239 prs->target = strdup(target);
244 ecore_x_selection_parser_del(const char *target)
246 Ecore_X_Selection_Parser *prs, *pprs = NULL;
248 LOGFN(__FILE__, __LINE__, __FUNCTION__);
255 if (!strcmp(prs->target, target))
258 pprs->next = prs->next;
260 _parsers = prs->next;
271 * Claim ownership of the PRIMARY selection and set its data.
272 * @param w The window to which this selection belongs
273 * @param data The data associated with the selection
274 * @param size The size of the data buffer in bytes
275 * @return Returns 1 if the ownership of the selection was successfully
276 * claimed, or 0 if unsuccessful.
279 ecore_x_selection_primary_set(Ecore_X_Window win,
283 LOGFN(__FILE__, __LINE__, __FUNCTION__);
285 return _ecore_xcb_selection_set(win, data, size,
286 ECORE_X_ATOM_SELECTION_PRIMARY);
290 * Release ownership of the primary selection
291 * @return Returns 1 if the selection was successfully cleared,
292 * or 0 if unsuccessful.
295 ecore_x_selection_primary_clear(void)
297 LOGFN(__FILE__, __LINE__, __FUNCTION__);
299 return _ecore_xcb_selection_set(XCB_NONE, NULL, 0,
300 ECORE_X_ATOM_SELECTION_PRIMARY);
304 ecore_x_selection_primary_request(Ecore_X_Window win,
307 LOGFN(__FILE__, __LINE__, __FUNCTION__);
309 _ecore_xcb_selection_request(win, ECORE_X_ATOM_SELECTION_PRIMARY, target);
313 * Claim ownership of the SECONDARY selection and set its data.
314 * @param w The window to which this selection belongs
315 * @param data The data associated with the selection
316 * @param size The size of the data buffer in bytes
317 * @return Returns 1 if the ownership of the selection was successfully
318 * claimed, or 0 if unsuccessful.
321 ecore_x_selection_secondary_set(Ecore_X_Window win,
325 LOGFN(__FILE__, __LINE__, __FUNCTION__);
327 return _ecore_xcb_selection_set(win, data, size,
328 ECORE_X_ATOM_SELECTION_SECONDARY);
332 * Release ownership of the secondary selection
333 * @return Returns 1 if the selection was successfully cleared,
334 * or 0 if unsuccessful.
337 ecore_x_selection_secondary_clear(void)
339 LOGFN(__FILE__, __LINE__, __FUNCTION__);
341 return _ecore_xcb_selection_set(XCB_NONE, NULL, 0,
342 ECORE_X_ATOM_SELECTION_SECONDARY);
346 ecore_x_selection_secondary_request(Ecore_X_Window win,
349 LOGFN(__FILE__, __LINE__, __FUNCTION__);
351 _ecore_xcb_selection_request(win, ECORE_X_ATOM_SELECTION_SECONDARY, target);
355 * Claim ownership of the XDND selection and set its data.
356 * @param w The window to which this selection belongs
357 * @param data The data associated with the selection
358 * @param size The size of the data buffer in bytes
359 * @return Returns 1 if the ownership of the selection was successfully
360 * claimed, or 0 if unsuccessful.
363 ecore_x_selection_xdnd_set(Ecore_X_Window win,
367 LOGFN(__FILE__, __LINE__, __FUNCTION__);
369 return _ecore_xcb_selection_set(win, data, size,
370 ECORE_X_ATOM_SELECTION_XDND);
374 * Release ownership of the XDND selection
375 * @return Returns 1 if the selection was successfully cleared,
376 * or 0 if unsuccessful.
379 ecore_x_selection_xdnd_clear(void)
381 LOGFN(__FILE__, __LINE__, __FUNCTION__);
383 return _ecore_xcb_selection_set(XCB_NONE, NULL, 0,
384 ECORE_X_ATOM_SELECTION_XDND);
388 ecore_x_selection_xdnd_request(Ecore_X_Window win,
392 Ecore_X_DND_Target *_target;
394 LOGFN(__FILE__, __LINE__, __FUNCTION__);
397 _target = _ecore_xcb_dnd_target_get();
398 atom = _ecore_xcb_selection_target_atom_get(target);
400 xcb_convert_selection(_ecore_xcb_conn, win, ECORE_X_ATOM_SELECTION_XDND,
401 atom, ECORE_X_ATOM_SELECTION_PROP_XDND, _target->time);
405 * Claim ownership of the CLIPBOARD selection and set its data.
406 * @param w The window to which this selection belongs
407 * @param data The data associated with the selection
408 * @param size The size of the data buffer in bytes
409 * @return Returns 1 if the ownership of the selection was successfully
410 * claimed, or 0 if unsuccessful.
412 * Get the converted data from a previous CLIPBOARD selection
413 * request. The buffer must be freed when done with.
416 ecore_x_selection_clipboard_set(Ecore_X_Window win,
420 LOGFN(__FILE__, __LINE__, __FUNCTION__);
422 return _ecore_xcb_selection_set(win, data, size,
423 ECORE_X_ATOM_SELECTION_CLIPBOARD);
427 * Release ownership of the clipboard selection
428 * @return Returns 1 if the selection was successfully cleared,
429 * or 0 if unsuccessful.
432 ecore_x_selection_clipboard_clear(void)
434 LOGFN(__FILE__, __LINE__, __FUNCTION__);
436 return _ecore_xcb_selection_set(XCB_NONE, NULL, 0,
437 ECORE_X_ATOM_SELECTION_CLIPBOARD);
441 ecore_x_selection_clipboard_request(Ecore_X_Window win,
444 LOGFN(__FILE__, __LINE__, __FUNCTION__);
446 _ecore_xcb_selection_request(win, ECORE_X_ATOM_SELECTION_CLIPBOARD, target);
450 ecore_x_selection_convert(Ecore_X_Atom selection,
454 Ecore_X_Atom *targtype,
457 Ecore_X_Selection_Intern *sel;
458 Ecore_X_Selection_Converter *cnv;
462 LOGFN(__FILE__, __LINE__, __FUNCTION__);
464 sel = _ecore_xcb_selection_get(selection);
465 tgt_str = _ecore_xcb_selection_target_get(target);
467 for (cnv = _converters; cnv; cnv = cnv->next)
469 if (cnv->target == target)
473 r = cnv->convert(tgt_str, sel->data, sel->length, &data, size,
478 if (data_ret) *data_ret = data;
490 ecore_x_selection_notify_send(Ecore_X_Window requestor,
491 Ecore_X_Atom selection,
493 Ecore_X_Atom property,
496 xcb_selection_notify_event_t ev;
498 LOGFN(__FILE__, __LINE__, __FUNCTION__);
501 memset(&ev, 0, sizeof(xcb_selection_notify_event_t));
503 ev.response_type = XCB_SELECTION_NOTIFY;
504 ev.requestor = requestor;
505 ev.selection = selection;
507 ev.property = property;
510 xcb_send_event(_ecore_xcb_conn, 0, requestor,
511 XCB_EVENT_MASK_NO_EVENT, (const char *)&ev);
518 ecore_x_selection_owner_set(Ecore_X_Window win,
522 LOGFN(__FILE__, __LINE__, __FUNCTION__);
525 xcb_set_selection_owner(_ecore_xcb_conn, win, atom, tim);
529 ecore_x_selection_owner_get(Ecore_X_Atom atom)
531 xcb_get_selection_owner_cookie_t cookie;
532 xcb_get_selection_owner_reply_t *reply;
535 LOGFN(__FILE__, __LINE__, __FUNCTION__);
538 cookie = xcb_get_selection_owner(_ecore_xcb_conn, atom);
539 reply = xcb_get_selection_owner_reply(_ecore_xcb_conn, cookie, NULL);
540 if (!reply) return 0;
547 _ecore_xcb_selection_parse(const char *target,
552 Ecore_X_Selection_Parser *prs;
553 Ecore_X_Selection_Data *sel;
555 for (prs = _parsers; prs; prs = prs->next)
557 if (!strcmp(prs->target, target))
559 sel = prs->parse(target, data, size, format);
564 sel = calloc(1, sizeof(Ecore_X_Selection_Data));
565 if (!sel) return NULL;
566 sel->free = _ecore_xcb_selection_data_default_free;
568 sel->format = format;
574 Ecore_X_Selection_Intern *
575 _ecore_xcb_selection_get(Ecore_X_Atom selection)
577 if (selection == ECORE_X_ATOM_SELECTION_PRIMARY)
578 return &_selections[0];
579 else if (selection == ECORE_X_ATOM_SELECTION_SECONDARY)
580 return &_selections[1];
581 else if (selection == ECORE_X_ATOM_SELECTION_XDND)
582 return &_selections[2];
583 else if (selection == ECORE_X_ATOM_SELECTION_CLIPBOARD)
584 return &_selections[3];
589 /* local functions */
591 _ecore_xcb_selection_set(Ecore_X_Window win,
594 Ecore_X_Atom selection)
596 xcb_get_selection_owner_cookie_t cookie;
597 xcb_get_selection_owner_reply_t *reply;
600 LOGFN(__FILE__, __LINE__, __FUNCTION__);
603 xcb_set_selection_owner(_ecore_xcb_conn, win, selection, XCB_CURRENT_TIME);
605 cookie = xcb_get_selection_owner(_ecore_xcb_conn, selection);
606 reply = xcb_get_selection_owner_reply(_ecore_xcb_conn, cookie, NULL);
607 if (!reply) return EINA_FALSE;
609 if (reply->owner != win)
616 if (selection == ECORE_X_ATOM_SELECTION_PRIMARY)
618 else if (selection == ECORE_X_ATOM_SELECTION_SECONDARY)
620 else if (selection == ECORE_X_ATOM_SELECTION_XDND)
622 else if (selection == ECORE_X_ATOM_SELECTION_CLIPBOARD)
629 unsigned char *buff = NULL;
631 _selections[in].win = win;
632 _selections[in].selection = selection;
633 _selections[in].length = size;
634 _selections[in].time = _ecore_xcb_events_last_time_get();
637 if (!buff) return EINA_FALSE;
638 memcpy(buff, data, size);
639 _selections[in].data = buff;
641 else if (_selections[in].data)
643 free(_selections[in].data);
644 memset(&_selections[in], 0, sizeof(Ecore_X_Selection_Data));
651 _ecore_xcb_selection_request(Ecore_X_Window win,
652 Ecore_X_Atom selection,
655 Ecore_X_Atom atarget, prop;
657 LOGFN(__FILE__, __LINE__, __FUNCTION__);
660 if (selection == ECORE_X_ATOM_SELECTION_PRIMARY)
661 prop = ECORE_X_ATOM_SELECTION_PROP_PRIMARY;
662 else if (selection == ECORE_X_ATOM_SELECTION_SECONDARY)
663 prop = ECORE_X_ATOM_SELECTION_PROP_SECONDARY;
664 else if (selection == ECORE_X_ATOM_SELECTION_CLIPBOARD)
665 prop = ECORE_X_ATOM_SELECTION_PROP_CLIPBOARD;
669 atarget = _ecore_xcb_selection_target_atom_get(target);
671 xcb_convert_selection(_ecore_xcb_conn, win, selection, atarget, prop,
676 _ecore_xcb_selection_converter_text(char *target,
681 Ecore_X_Atom *type __UNUSED__,
682 int *size_type __UNUSED__)
684 Ecore_Xcb_Encoding_Style style;
685 Ecore_Xcb_Textproperty ret;
688 LOGFN(__FILE__, __LINE__, __FUNCTION__);
691 if ((!data) || (!size)) return EINA_FALSE;
693 if (!strcmp(target, ECORE_X_SELECTION_TARGET_TEXT))
694 style = XcbTextStyle;
695 else if (!strcmp(target, ECORE_X_SELECTION_TARGET_COMPOUND_TEXT))
696 style = XcbCompoundTextStyle;
697 else if (!strcmp(target, ECORE_X_SELECTION_TARGET_STRING))
698 style = XcbStringStyle;
700 else if (!strcmp(target, ECORE_X_SELECTION_TARGET_UTF8_STRING))
701 style = XcbUTF8StringStyle;
706 str = alloca(size + 1);
707 memcpy(str, data, size);
711 if (_ecore_xcb_utf8_textlist_to_textproperty(&str, 1, style, &ret))
715 size = (strlen((char *)ret.value) + 1);
716 *data_ret = malloc(size);
717 if (!*data_ret) return EINA_FALSE;
718 memcpy(*data_ret, ret.value, size);
720 if (ret.value) free(ret.value);
724 if (_ecore_xcb_mb_textlist_to_textproperty(&str, 1, style, &ret))
728 size = (strlen((char *)ret.value) + 1);
729 *data_ret = malloc(size);
730 if (!*data_ret) return EINA_FALSE;
731 memcpy(*data_ret, ret.value, size);
733 if (ret.value) free(ret.value);
742 _ecore_xcb_selection_parser_text(const char *target __UNUSED__,
745 int format __UNUSED__)
747 Ecore_X_Selection_Data_Text *sel;
748 unsigned char *_data;
751 LOGFN(__FILE__, __LINE__, __FUNCTION__);
753 if (!(_data = data)) return NULL;
755 sel = calloc(1, sizeof(Ecore_X_Selection_Data_Text));
756 if (!sel) return NULL;
761 t = realloc(_data, size);
770 sel->text = (char *)_data;
771 ECORE_XCB_SELECTION_DATA(sel)->length = size;
772 ECORE_XCB_SELECTION_DATA(sel)->content = ECORE_X_SELECTION_CONTENT_TEXT;
773 ECORE_XCB_SELECTION_DATA(sel)->data = _data;
774 ECORE_XCB_SELECTION_DATA(sel)->free = _ecore_xcb_selection_data_text_free;
779 _ecore_xcb_selection_parser_files(const char *target,
782 int format __UNUSED__)
784 Ecore_X_Selection_Data_Files *sel;
785 char *_data, *tmp, *t, **t2;
788 LOGFN(__FILE__, __LINE__, __FUNCTION__);
790 if ((strcmp(target, "text/uri-list")) &&
791 (strcmp(target, "_NETSCAPE_URL"))) return NULL;
793 if (!(_data = data)) return NULL;
795 sel = calloc(1, sizeof(Ecore_X_Selection_Data_Files));
796 if (!sel) return NULL;
798 ECORE_XCB_SELECTION_DATA(sel)->free = _ecore_xcb_selection_data_files_free;
803 t = realloc(_data, size);
820 while ((is < size) && (_data[is]))
822 if ((i == 0) && (_data[is] == '#'))
824 for (; ((_data[is]) && (_data[is] != '\n')); is++) ;
828 if ((_data[is] != '\r') && (_data[is] != '\n'))
829 tmp[i++] = _data[is++];
832 while ((_data[is] == '\r') || (_data[is] == '\n'))
836 t2 = realloc(sel->files, sel->num_files * sizeof(char *));
840 sel->files[sel->num_files - 1] = strdup(tmp);
851 t2 = realloc(sel->files, sel->num_files * sizeof(char *));
855 sel->files[sel->num_files - 1] = strdup(tmp);
859 if (_data) free(_data);
861 ECORE_XCB_SELECTION_DATA(sel)->content = ECORE_X_SELECTION_CONTENT_FILES;
862 ECORE_XCB_SELECTION_DATA(sel)->length = sel->num_files;
864 return ECORE_XCB_SELECTION_DATA(sel);
868 _ecore_xcb_selection_parser_targets(const char *target __UNUSED__,
871 int format __UNUSED__)
873 Ecore_X_Selection_Data_Targets *sel;
874 unsigned long *targets;
877 LOGFN(__FILE__, __LINE__, __FUNCTION__);
880 if (!(targets = (unsigned long *)data)) return NULL;
882 sel = calloc(1, sizeof(Ecore_X_Selection_Data_Targets));
883 if (!sel) return NULL;
885 sel->num_targets = (size - 2);
886 sel->targets = malloc((size - 2) * sizeof(char *));
893 for (i = 2; i < size; i++)
895 xcb_get_atom_name_cookie_t cookie;
896 xcb_get_atom_name_reply_t *reply;
900 cookie = xcb_get_atom_name_unchecked(_ecore_xcb_conn, targets[i]);
901 reply = xcb_get_atom_name_reply(_ecore_xcb_conn, cookie, NULL);
904 len = xcb_get_atom_name_name_length(reply);
905 name = (char *)malloc(sizeof(char) * (len + 1));
908 memcpy(name, xcb_get_atom_name_name(reply), len);
910 sel->targets[i - 2] = name;
916 ECORE_XCB_SELECTION_DATA(sel)->free =
917 _ecore_xcb_selection_data_targets_free;
918 ECORE_XCB_SELECTION_DATA(sel)->content = ECORE_X_SELECTION_CONTENT_TARGETS;
919 ECORE_XCB_SELECTION_DATA(sel)->length = size;
920 ECORE_XCB_SELECTION_DATA(sel)->data = data;
927 _ecore_xcb_selection_data_free(void *data)
929 Ecore_X_Selection_Data *sel;
931 LOGFN(__FILE__, __LINE__, __FUNCTION__);
933 if (!(sel = data)) return 0;
934 if (sel->data) free(sel->data);
941 _ecore_xcb_selection_data_text_free(void *data)
943 Ecore_X_Selection_Data_Text *sel;
945 LOGFN(__FILE__, __LINE__, __FUNCTION__);
947 if (!(sel = data)) return 0;
948 if (sel->text) free(sel->text);
954 _ecore_xcb_selection_data_targets_free(void *data)
956 Ecore_X_Selection_Data_Targets *sel;
958 LOGFN(__FILE__, __LINE__, __FUNCTION__);
960 if (!(sel = data)) return 0;
961 if (sel->targets) free(sel->targets);
962 free(ECORE_XCB_SELECTION_DATA(sel)->data);
968 _ecore_xcb_selection_data_files_free(void *data)
970 Ecore_X_Selection_Data_Files *sel;
972 LOGFN(__FILE__, __LINE__, __FUNCTION__);
974 if (!(sel = data)) return 0;
979 for (i = 0; i < sel->num_files; i++)
980 if (sel->files[i]) free(sel->files[i]);
981 if (sel->files) free(sel->files);
988 _ecore_xcb_selection_data_default_free(void *data)
990 Ecore_X_Selection_Data *sel;
992 if (!(sel = data)) return 1;
999 _ecore_xcb_selection_target_atom_get(const char *target)
1001 Ecore_X_Atom x_target;
1003 if (!strcmp(target, ECORE_X_SELECTION_TARGET_TEXT))
1004 x_target = ECORE_X_ATOM_TEXT;
1005 else if (!strcmp(target, ECORE_X_SELECTION_TARGET_COMPOUND_TEXT))
1006 x_target = ECORE_X_ATOM_COMPOUND_TEXT;
1007 else if (!strcmp(target, ECORE_X_SELECTION_TARGET_STRING))
1008 x_target = ECORE_X_ATOM_STRING;
1009 else if (!strcmp(target, ECORE_X_SELECTION_TARGET_UTF8_STRING))
1010 x_target = ECORE_X_ATOM_UTF8_STRING;
1011 else if (!strcmp(target, ECORE_X_SELECTION_TARGET_FILENAME))
1012 x_target = ECORE_X_ATOM_FILE_NAME;
1014 x_target = ecore_x_atom_get(target);
1020 _ecore_xcb_selection_target_get(Ecore_X_Atom target)
1022 if (target == ECORE_X_ATOM_FILE_NAME)
1023 return strdup(ECORE_X_SELECTION_TARGET_FILENAME);
1024 else if (target == ECORE_X_ATOM_STRING)
1025 return strdup(ECORE_X_SELECTION_TARGET_STRING);
1026 else if (target == ECORE_X_ATOM_UTF8_STRING)
1027 return strdup(ECORE_X_SELECTION_TARGET_UTF8_STRING);
1028 else if (target == ECORE_X_ATOM_TEXT)
1029 return strdup(ECORE_X_SELECTION_TARGET_TEXT);
1031 return ecore_x_atom_name_get(target);