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 void *_ecore_xcb_selection_parser_text(const char *target __UNUSED__,
10 int format __UNUSED__);
11 static void *_ecore_xcb_selection_parser_files(const char *target,
14 int format __UNUSED__);
15 static void *_ecore_xcb_selection_parser_targets(const char *target __UNUSED__,
18 int format __UNUSED__);
20 //static int _ecore_xcb_selection_data_free(void *data);
21 static int _ecore_xcb_selection_data_text_free(void *data);
22 static int _ecore_xcb_selection_data_targets_free(void *data);
23 static int _ecore_xcb_selection_data_files_free(void *data);
24 static int _ecore_xcb_selection_data_default_free(void *data);
25 static Eina_Bool _ecore_xcb_selection_set(Ecore_X_Window win,
28 Ecore_X_Atom selection);
29 static void _ecore_xcb_selection_request(Ecore_X_Window win,
30 Ecore_X_Atom selection,
32 static Ecore_X_Atom _ecore_xcb_selection_target_atom_get(const char *target);
35 static Ecore_X_Selection_Intern _selections[4];
36 static Ecore_X_Selection_Converter *_converters = NULL;
37 static Ecore_X_Selection_Parser *_parsers = NULL;
41 _ecore_xcb_selection_init(void)
43 LOGFN(__FILE__, __LINE__, __FUNCTION__);
45 memset(_selections, 0, sizeof(_selections));
48 ecore_x_selection_converter_atom_add(ECORE_X_ATOM_TEXT,
49 ecore_x_selection_converter_text);
50 ecore_x_selection_converter_atom_add(ECORE_X_ATOM_UTF8_STRING,
51 ecore_x_selection_converter_text);
52 ecore_x_selection_converter_atom_add(ECORE_X_ATOM_COMPOUND_TEXT,
53 ecore_x_selection_converter_text);
54 ecore_x_selection_converter_atom_add(ECORE_X_ATOM_STRING,
55 ecore_x_selection_converter_text);
58 ecore_x_selection_parser_add("text/plain",
59 _ecore_xcb_selection_parser_text);
60 ecore_x_selection_parser_add(ECORE_X_SELECTION_TARGET_UTF8_STRING,
61 _ecore_xcb_selection_parser_text);
62 ecore_x_selection_parser_add("text/uri-list",
63 _ecore_xcb_selection_parser_files);
64 ecore_x_selection_parser_add("_NETSCAPE_URL",
65 _ecore_xcb_selection_parser_files);
66 ecore_x_selection_parser_add(ECORE_X_SELECTION_TARGET_TARGETS,
67 _ecore_xcb_selection_parser_targets);
71 _ecore_xcb_selection_shutdown(void)
73 Ecore_X_Selection_Converter *cnv;
74 Ecore_X_Selection_Parser *prs;
76 LOGFN(__FILE__, __LINE__, __FUNCTION__);
78 /* free selection converters */
82 Ecore_X_Selection_Converter *tmp;
94 Ecore_X_Selection_Parser *tmp;
104 /* public functions */
106 ecore_x_selection_converter_atom_add(Ecore_X_Atom target,
107 Eina_Bool (*func)(char *target,
115 Ecore_X_Selection_Converter *cnv;
117 LOGFN(__FILE__, __LINE__, __FUNCTION__);
124 if (cnv->target == target)
134 cnv->next = calloc(1, sizeof(Ecore_X_Selection_Converter));
135 if (!cnv->next) return;
140 _converters = calloc(1, sizeof(Ecore_X_Selection_Converter));
141 if (!_converters) return;
144 cnv->target = target;
149 ecore_x_selection_converter_add(char *target,
150 Eina_Bool (*func)(char *target,
155 Ecore_X_Atom *atom_ret,
158 Ecore_X_Atom atarget;
160 LOGFN(__FILE__, __LINE__, __FUNCTION__);
162 if ((!func) || (!target)) return;
163 atarget = _ecore_xcb_selection_target_atom_get(target);
164 ecore_x_selection_converter_atom_add(atarget, func);
168 ecore_x_selection_converter_del(char *target)
170 Ecore_X_Atom atarget;
172 LOGFN(__FILE__, __LINE__, __FUNCTION__);
175 atarget = _ecore_xcb_selection_target_atom_get(target);
176 ecore_x_selection_converter_atom_del(atarget);
180 ecore_x_selection_converter_atom_del(Ecore_X_Atom target)
182 Ecore_X_Selection_Converter *conv, *pconv = NULL;
184 LOGFN(__FILE__, __LINE__, __FUNCTION__);
189 if (conv->target == target)
192 pconv->next = conv->next;
194 _converters = conv->next;
204 ecore_x_selection_parser_add(const char *target,
205 void *(*func)(const char *target, void *data, int size, int format))
207 Ecore_X_Selection_Parser *prs;
209 LOGFN(__FILE__, __LINE__, __FUNCTION__);
217 if (!strcmp(prs->target, target))
224 prs->next = calloc(1, sizeof(Ecore_X_Selection_Parser));
229 _parsers = calloc(1, sizeof(Ecore_X_Selection_Parser));
232 prs->target = strdup(target);
237 ecore_x_selection_parser_del(const char *target)
239 Ecore_X_Selection_Parser *prs, *pprs = NULL;
241 LOGFN(__FILE__, __LINE__, __FUNCTION__);
248 if (!strcmp(prs->target, target))
251 pprs->next = prs->next;
253 _parsers = prs->next;
264 * Claim ownership of the PRIMARY selection and set its data.
265 * @param w The window to which this selection belongs
266 * @param data The data associated with the selection
267 * @param size The size of the data buffer in bytes
268 * @return Returns 1 if the ownership of the selection was successfully
269 * claimed, or 0 if unsuccessful.
272 ecore_x_selection_primary_set(Ecore_X_Window win,
276 LOGFN(__FILE__, __LINE__, __FUNCTION__);
278 return _ecore_xcb_selection_set(win, data, size,
279 ECORE_X_ATOM_SELECTION_PRIMARY);
283 * Release ownership of the primary selection
284 * @return Returns 1 if the selection was successfully cleared,
285 * or 0 if unsuccessful.
288 ecore_x_selection_primary_clear(void)
290 LOGFN(__FILE__, __LINE__, __FUNCTION__);
292 return _ecore_xcb_selection_set(XCB_NONE, NULL, 0,
293 ECORE_X_ATOM_SELECTION_PRIMARY);
297 ecore_x_selection_primary_request(Ecore_X_Window win,
300 LOGFN(__FILE__, __LINE__, __FUNCTION__);
302 _ecore_xcb_selection_request(win, ECORE_X_ATOM_SELECTION_PRIMARY, target);
306 * Claim ownership of the SECONDARY selection and set its data.
307 * @param w The window to which this selection belongs
308 * @param data The data associated with the selection
309 * @param size The size of the data buffer in bytes
310 * @return Returns 1 if the ownership of the selection was successfully
311 * claimed, or 0 if unsuccessful.
314 ecore_x_selection_secondary_set(Ecore_X_Window win,
318 LOGFN(__FILE__, __LINE__, __FUNCTION__);
320 return _ecore_xcb_selection_set(win, data, size,
321 ECORE_X_ATOM_SELECTION_SECONDARY);
325 * Release ownership of the secondary selection
326 * @return Returns 1 if the selection was successfully cleared,
327 * or 0 if unsuccessful.
330 ecore_x_selection_secondary_clear(void)
332 LOGFN(__FILE__, __LINE__, __FUNCTION__);
334 return _ecore_xcb_selection_set(XCB_NONE, NULL, 0,
335 ECORE_X_ATOM_SELECTION_SECONDARY);
339 ecore_x_selection_secondary_request(Ecore_X_Window win,
342 LOGFN(__FILE__, __LINE__, __FUNCTION__);
344 _ecore_xcb_selection_request(win, ECORE_X_ATOM_SELECTION_SECONDARY, target);
348 * Claim ownership of the XDND selection and set its data.
349 * @param w The window to which this selection belongs
350 * @param data The data associated with the selection
351 * @param size The size of the data buffer in bytes
352 * @return Returns 1 if the ownership of the selection was successfully
353 * claimed, or 0 if unsuccessful.
356 ecore_x_selection_xdnd_set(Ecore_X_Window win,
360 LOGFN(__FILE__, __LINE__, __FUNCTION__);
362 return _ecore_xcb_selection_set(win, data, size,
363 ECORE_X_ATOM_SELECTION_XDND);
367 * Release ownership of the XDND selection
368 * @return Returns 1 if the selection was successfully cleared,
369 * or 0 if unsuccessful.
372 ecore_x_selection_xdnd_clear(void)
374 LOGFN(__FILE__, __LINE__, __FUNCTION__);
376 return _ecore_xcb_selection_set(XCB_NONE, NULL, 0,
377 ECORE_X_ATOM_SELECTION_XDND);
381 ecore_x_selection_xdnd_request(Ecore_X_Window win,
385 Ecore_X_DND_Target *_target;
387 LOGFN(__FILE__, __LINE__, __FUNCTION__);
390 _target = _ecore_xcb_dnd_target_get();
391 atom = _ecore_xcb_selection_target_atom_get(target);
393 xcb_convert_selection(_ecore_xcb_conn, win, ECORE_X_ATOM_SELECTION_XDND,
394 atom, ECORE_X_ATOM_SELECTION_PROP_XDND, _target->time);
398 * Claim ownership of the CLIPBOARD selection and set its data.
399 * @param w The window to which this selection belongs
400 * @param data The data associated with the selection
401 * @param size The size of the data buffer in bytes
402 * @return Returns 1 if the ownership of the selection was successfully
403 * claimed, or 0 if unsuccessful.
405 * Get the converted data from a previous CLIPBOARD selection
406 * request. The buffer must be freed when done with.
409 ecore_x_selection_clipboard_set(Ecore_X_Window win,
413 LOGFN(__FILE__, __LINE__, __FUNCTION__);
415 return _ecore_xcb_selection_set(win, data, size,
416 ECORE_X_ATOM_SELECTION_CLIPBOARD);
420 * Release ownership of the clipboard selection
421 * @return Returns 1 if the selection was successfully cleared,
422 * or 0 if unsuccessful.
425 ecore_x_selection_clipboard_clear(void)
427 LOGFN(__FILE__, __LINE__, __FUNCTION__);
429 return _ecore_xcb_selection_set(XCB_NONE, NULL, 0,
430 ECORE_X_ATOM_SELECTION_CLIPBOARD);
434 ecore_x_selection_clipboard_request(Ecore_X_Window win,
437 LOGFN(__FILE__, __LINE__, __FUNCTION__);
439 _ecore_xcb_selection_request(win, ECORE_X_ATOM_SELECTION_CLIPBOARD, target);
443 ecore_x_selection_convert(Ecore_X_Atom selection,
447 Ecore_X_Atom *targtype,
450 Ecore_X_Selection_Intern *sel;
451 Ecore_X_Selection_Converter *cnv;
455 LOGFN(__FILE__, __LINE__, __FUNCTION__);
457 sel = _ecore_xcb_selection_get(selection);
458 tgt_str = _ecore_xcb_selection_target_get(target);
460 for (cnv = _converters; cnv; cnv = cnv->next)
462 if (cnv->target == target)
466 r = cnv->convert(tgt_str, sel->data, sel->length, &data, size,
471 if (data_ret) *data_ret = data;
483 ecore_x_selection_notify_send(Ecore_X_Window requestor,
484 Ecore_X_Atom selection,
486 Ecore_X_Atom property,
489 xcb_selection_notify_event_t ev;
491 LOGFN(__FILE__, __LINE__, __FUNCTION__);
494 memset(&ev, 0, sizeof(xcb_selection_notify_event_t));
496 ev.response_type = XCB_SELECTION_NOTIFY;
497 ev.requestor = requestor;
498 ev.selection = selection;
500 ev.property = property;
503 xcb_send_event(_ecore_xcb_conn, 0, requestor,
504 XCB_EVENT_MASK_NO_EVENT, (const char *)&ev);
511 ecore_x_selection_owner_set(Ecore_X_Window win,
515 LOGFN(__FILE__, __LINE__, __FUNCTION__);
518 xcb_set_selection_owner(_ecore_xcb_conn, win, atom, tim);
522 ecore_x_selection_owner_get(Ecore_X_Atom atom)
524 xcb_get_selection_owner_cookie_t cookie;
525 xcb_get_selection_owner_reply_t *reply;
528 LOGFN(__FILE__, __LINE__, __FUNCTION__);
531 cookie = xcb_get_selection_owner(_ecore_xcb_conn, atom);
532 reply = xcb_get_selection_owner_reply(_ecore_xcb_conn, cookie, NULL);
533 if (!reply) return 0;
540 _ecore_xcb_selection_parse(const char *target,
545 Ecore_X_Selection_Parser *prs;
546 Ecore_X_Selection_Data *sel;
548 for (prs = _parsers; prs; prs = prs->next)
550 if (!strcmp(prs->target, target))
552 sel = prs->parse(target, data, size, format);
557 sel = calloc(1, sizeof(Ecore_X_Selection_Data));
558 if (!sel) return NULL;
559 sel->free = _ecore_xcb_selection_data_default_free;
561 sel->format = format;
567 Ecore_X_Selection_Intern *
568 _ecore_xcb_selection_get(Ecore_X_Atom selection)
570 if (selection == ECORE_X_ATOM_SELECTION_PRIMARY)
571 return &_selections[0];
572 else if (selection == ECORE_X_ATOM_SELECTION_SECONDARY)
573 return &_selections[1];
574 else if (selection == ECORE_X_ATOM_SELECTION_XDND)
575 return &_selections[2];
576 else if (selection == ECORE_X_ATOM_SELECTION_CLIPBOARD)
577 return &_selections[3];
582 /* local functions */
584 _ecore_xcb_selection_set(Ecore_X_Window win,
587 Ecore_X_Atom selection)
589 xcb_get_selection_owner_cookie_t cookie;
590 xcb_get_selection_owner_reply_t *reply;
593 LOGFN(__FILE__, __LINE__, __FUNCTION__);
596 xcb_set_selection_owner(_ecore_xcb_conn, win, selection, XCB_CURRENT_TIME);
598 cookie = xcb_get_selection_owner(_ecore_xcb_conn, selection);
599 reply = xcb_get_selection_owner_reply(_ecore_xcb_conn, cookie, NULL);
600 if (!reply) return EINA_FALSE;
602 if (reply->owner != win)
609 if (selection == ECORE_X_ATOM_SELECTION_PRIMARY)
611 else if (selection == ECORE_X_ATOM_SELECTION_SECONDARY)
613 else if (selection == ECORE_X_ATOM_SELECTION_XDND)
615 else if (selection == ECORE_X_ATOM_SELECTION_CLIPBOARD)
622 unsigned char *buff = NULL;
624 _selections[in].win = win;
625 _selections[in].selection = selection;
626 _selections[in].length = size;
627 _selections[in].time = _ecore_xcb_events_last_time_get();
630 if (!buff) return EINA_FALSE;
631 memcpy(buff, data, size);
632 _selections[in].data = buff;
634 else if (_selections[in].data)
636 free(_selections[in].data);
637 memset(&_selections[in], 0, sizeof(Ecore_X_Selection_Data));
644 _ecore_xcb_selection_request(Ecore_X_Window win,
645 Ecore_X_Atom selection,
648 Ecore_X_Atom atarget, prop;
650 LOGFN(__FILE__, __LINE__, __FUNCTION__);
653 if (selection == ECORE_X_ATOM_SELECTION_PRIMARY)
654 prop = ECORE_X_ATOM_SELECTION_PROP_PRIMARY;
655 else if (selection == ECORE_X_ATOM_SELECTION_SECONDARY)
656 prop = ECORE_X_ATOM_SELECTION_PROP_SECONDARY;
657 else if (selection == ECORE_X_ATOM_SELECTION_CLIPBOARD)
658 prop = ECORE_X_ATOM_SELECTION_PROP_CLIPBOARD;
662 atarget = _ecore_xcb_selection_target_atom_get(target);
664 xcb_convert_selection(_ecore_xcb_conn, win, selection, atarget, prop,
669 ecore_x_selection_converter_text(char *target,
674 Ecore_X_Atom *type __UNUSED__,
675 int *size_type __UNUSED__)
677 Ecore_Xcb_Encoding_Style style;
678 Ecore_Xcb_Textproperty ret;
681 LOGFN(__FILE__, __LINE__, __FUNCTION__);
684 if ((!data) || (!size)) return EINA_FALSE;
686 if (!strcmp(target, ECORE_X_SELECTION_TARGET_TEXT))
687 style = XcbTextStyle;
688 else if (!strcmp(target, ECORE_X_SELECTION_TARGET_COMPOUND_TEXT))
689 style = XcbCompoundTextStyle;
690 else if (!strcmp(target, ECORE_X_SELECTION_TARGET_STRING))
691 style = XcbStringStyle;
693 else if (!strcmp(target, ECORE_X_SELECTION_TARGET_UTF8_STRING))
694 style = XcbUTF8StringStyle;
699 str = alloca(size + 1);
700 memcpy(str, data, size);
704 if (_ecore_xcb_utf8_textlist_to_textproperty(&str, 1, style, &ret))
708 size = (strlen((char *)ret.value) + 1);
709 *data_ret = malloc(size);
710 if (!*data_ret) return EINA_FALSE;
711 memcpy(*data_ret, ret.value, size);
713 if (ret.value) free(ret.value);
717 if (_ecore_xcb_mb_textlist_to_textproperty(&str, 1, style, &ret))
721 size = (strlen((char *)ret.value) + 1);
722 *data_ret = malloc(size);
723 if (!*data_ret) return EINA_FALSE;
724 memcpy(*data_ret, ret.value, size);
726 if (ret.value) free(ret.value);
735 _ecore_xcb_selection_parser_text(const char *target __UNUSED__,
738 int format __UNUSED__)
740 Ecore_X_Selection_Data_Text *sel;
741 unsigned char *_data;
744 LOGFN(__FILE__, __LINE__, __FUNCTION__);
746 if (!(_data = data)) return NULL;
748 sel = calloc(1, sizeof(Ecore_X_Selection_Data_Text));
749 if (!sel) return NULL;
754 t = realloc(_data, size);
763 sel->text = (char *)_data;
764 ECORE_XCB_SELECTION_DATA(sel)->length = size;
765 ECORE_XCB_SELECTION_DATA(sel)->content = ECORE_X_SELECTION_CONTENT_TEXT;
766 ECORE_XCB_SELECTION_DATA(sel)->data = _data;
767 ECORE_XCB_SELECTION_DATA(sel)->free = _ecore_xcb_selection_data_text_free;
772 _ecore_xcb_selection_parser_files(const char *target,
775 int format __UNUSED__)
777 Ecore_X_Selection_Data_Files *sel;
778 char *_data, *tmp, *t, **t2;
781 LOGFN(__FILE__, __LINE__, __FUNCTION__);
783 if ((strcmp(target, "text/uri-list")) &&
784 (strcmp(target, "_NETSCAPE_URL"))) return NULL;
786 if (!(_data = data)) return NULL;
788 sel = calloc(1, sizeof(Ecore_X_Selection_Data_Files));
789 if (!sel) return NULL;
791 ECORE_XCB_SELECTION_DATA(sel)->free = _ecore_xcb_selection_data_files_free;
796 t = realloc(_data, size);
813 while ((is < size) && (_data[is]))
815 if ((i == 0) && (_data[is] == '#'))
817 for (; ((_data[is]) && (_data[is] != '\n')); is++) ;
821 if ((_data[is] != '\r') && (_data[is] != '\n'))
822 tmp[i++] = _data[is++];
825 while ((_data[is] == '\r') || (_data[is] == '\n'))
829 t2 = realloc(sel->files, sel->num_files * sizeof(char *));
833 sel->files[sel->num_files - 1] = strdup(tmp);
844 t2 = realloc(sel->files, sel->num_files * sizeof(char *));
848 sel->files[sel->num_files - 1] = strdup(tmp);
852 if (_data) free(_data);
854 ECORE_XCB_SELECTION_DATA(sel)->content = ECORE_X_SELECTION_CONTENT_FILES;
855 ECORE_XCB_SELECTION_DATA(sel)->length = sel->num_files;
857 return ECORE_XCB_SELECTION_DATA(sel);
861 _ecore_xcb_selection_parser_targets(const char *target __UNUSED__,
864 int format __UNUSED__)
866 Ecore_X_Selection_Data_Targets *sel;
867 unsigned long *targets;
870 LOGFN(__FILE__, __LINE__, __FUNCTION__);
873 if (!(targets = (unsigned long *)data)) return NULL;
875 sel = calloc(1, sizeof(Ecore_X_Selection_Data_Targets));
876 if (!sel) return NULL;
878 sel->num_targets = (size - 2);
879 sel->targets = malloc((size - 2) * sizeof(char *));
886 for (i = 2; i < size; i++)
888 xcb_get_atom_name_cookie_t cookie;
889 xcb_get_atom_name_reply_t *reply;
893 cookie = xcb_get_atom_name_unchecked(_ecore_xcb_conn, targets[i]);
894 reply = xcb_get_atom_name_reply(_ecore_xcb_conn, cookie, NULL);
897 len = xcb_get_atom_name_name_length(reply);
898 name = (char *)malloc(sizeof(char) * (len + 1));
901 memcpy(name, xcb_get_atom_name_name(reply), len);
903 sel->targets[i - 2] = name;
909 ECORE_XCB_SELECTION_DATA(sel)->free =
910 _ecore_xcb_selection_data_targets_free;
911 ECORE_XCB_SELECTION_DATA(sel)->content = ECORE_X_SELECTION_CONTENT_TARGETS;
912 ECORE_XCB_SELECTION_DATA(sel)->length = size;
913 ECORE_XCB_SELECTION_DATA(sel)->data = data;
920 _ecore_xcb_selection_data_free(void *data)
922 Ecore_X_Selection_Data *sel;
924 LOGFN(__FILE__, __LINE__, __FUNCTION__);
926 if (!(sel = data)) return 0;
927 if (sel->data) free(sel->data);
934 _ecore_xcb_selection_data_text_free(void *data)
936 Ecore_X_Selection_Data_Text *sel;
938 LOGFN(__FILE__, __LINE__, __FUNCTION__);
940 if (!(sel = data)) return 0;
941 if (sel->text) free(sel->text);
947 _ecore_xcb_selection_data_targets_free(void *data)
949 Ecore_X_Selection_Data_Targets *sel;
951 LOGFN(__FILE__, __LINE__, __FUNCTION__);
953 if (!(sel = data)) return 0;
954 if (sel->targets) free(sel->targets);
955 free(ECORE_XCB_SELECTION_DATA(sel)->data);
961 _ecore_xcb_selection_data_files_free(void *data)
963 Ecore_X_Selection_Data_Files *sel;
965 LOGFN(__FILE__, __LINE__, __FUNCTION__);
967 if (!(sel = data)) return 0;
972 for (i = 0; i < sel->num_files; i++)
973 if (sel->files[i]) free(sel->files[i]);
974 if (sel->files) free(sel->files);
981 _ecore_xcb_selection_data_default_free(void *data)
983 Ecore_X_Selection_Data *sel;
985 if (!(sel = data)) return 1;
992 _ecore_xcb_selection_target_atom_get(const char *target)
994 Ecore_X_Atom x_target;
996 if (!strcmp(target, ECORE_X_SELECTION_TARGET_TEXT))
997 x_target = ECORE_X_ATOM_TEXT;
998 else if (!strcmp(target, ECORE_X_SELECTION_TARGET_COMPOUND_TEXT))
999 x_target = ECORE_X_ATOM_COMPOUND_TEXT;
1000 else if (!strcmp(target, ECORE_X_SELECTION_TARGET_STRING))
1001 x_target = ECORE_X_ATOM_STRING;
1002 else if (!strcmp(target, ECORE_X_SELECTION_TARGET_UTF8_STRING))
1003 x_target = ECORE_X_ATOM_UTF8_STRING;
1004 else if (!strcmp(target, ECORE_X_SELECTION_TARGET_FILENAME))
1005 x_target = ECORE_X_ATOM_FILE_NAME;
1007 x_target = ecore_x_atom_get(target);
1013 _ecore_xcb_selection_target_get(Ecore_X_Atom target)
1015 if (target == ECORE_X_ATOM_FILE_NAME)
1016 return strdup(ECORE_X_SELECTION_TARGET_FILENAME);
1017 else if (target == ECORE_X_ATOM_STRING)
1018 return strdup(ECORE_X_SELECTION_TARGET_STRING);
1019 else if (target == ECORE_X_ATOM_UTF8_STRING)
1020 return strdup(ECORE_X_SELECTION_TARGET_UTF8_STRING);
1021 else if (target == ECORE_X_ATOM_TEXT)
1022 return strdup(ECORE_X_SELECTION_TARGET_TEXT);
1024 return ecore_x_atom_name_get(target);