1 /* GTK - The GIMP Toolkit
2 * Copyright (C) 2000 Red Hat, Inc.
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the
16 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17 * Boston, MA 02111-1307, USA.
19 * Global clipboard abstraction.
24 #include "gtkclipboard.h"
25 #include "gtkinvisible.h"
27 #include "gtksignal.h"
29 #ifdef GDK_WINDOWING_X11
33 #ifdef GDK_WINDOWING_WIN32
34 #include "win32/gdkwin32.h"
37 typedef struct _RequestContentsInfo RequestContentsInfo;
38 typedef struct _RequestTextInfo RequestTextInfo;
44 GtkClipboardGetFunc get_func;
45 GtkClipboardClearFunc clear_func;
51 gboolean have_selection;
55 struct _RequestContentsInfo
57 GtkClipboardReceivedFunc callback;
61 struct _RequestTextInfo
63 GtkClipboardTextReceivedFunc callback;
67 static void clipboard_unset (GtkClipboard *clipboard);
68 static void selection_received (GtkWidget *widget,
69 GtkSelectionData *selection_data,
79 static const gchar *request_contents_key = "gtk-request-contents";
80 static GQuark request_contents_key_id = 0;
82 static const gchar *clipboards_owned_key = "gtk-clipboards-owned";
83 static GQuark clipboards_owned_key_id = 0;
86 * gtk_clipboard_get_for_display:
87 * @display: the display for which the clipboard is to be retrieved or created
88 * @selection: a #GdkAtom which identifies the clipboard
91 * Returns the clipboard object for the given selection.
92 * Cut/copy/paste menu items and keyboard shortcuts should use
93 * the default clipboard, returned by passing %GDK_SELECTION_CLIPBOARD for @selection.
94 * (%GDK_NONE is supported as a synonym for GDK_SELECTION_CLIPBOARD
95 * for backwards compatibility reasons.)
96 * The currently-selected object or text should be provided on the clipboard
97 * identified by #GDK_SELECTION_PRIMARY. Cut/copy/paste menu items
98 * conceptually copy the contents of the #GDK_SELECTION_PRIMARY clipboard
99 * to the default clipboard, i.e. they copy the selection to what the
100 * user sees as the clipboard.
102 * (Passing #GDK_NONE is the same as using <literal>gdk_atom_intern
103 * ("CLIPBOARD", FALSE)</literal>. See
104 * <ulink url="http://www.freedesktop.org/standards/clipboards.txt">
105 * http://www.freedesktop.org/standards/clipboards.txt</ulink>
106 * for a detailed discussion of the "CLIPBOARD" vs. "PRIMARY" selections
107 * under the X window system. On Win32 the #GDK_SELECTION_PRIMARY
108 * clipboard is essentially ignored.)
110 * It's possible to have arbitrary named clipboards; if you do invent
111 * new clipboards, you should prefix the selection name with an
112 * underscore (because the ICCCM requires that nonstandard atoms are
113 * underscore-prefixed), and namespace it as well. For example,
114 * if your application called "Foo" has a special-purpose
115 * clipboard, you might call it "_FOO_SPECIAL_CLIPBOARD".
117 * Return value: the appropriate clipboard object. If no
118 * clipboard already exists, a new one will
119 * be created. Once a clipboard object has
120 * been created, it is persistent for all time and
124 gtk_clipboard_get_for_display (GdkDisplay *display, GdkAtom selection)
126 GtkClipboard *clipboard = NULL;
130 g_return_val_if_fail (GDK_IS_DISPLAY (display), NULL);
132 if (selection == GDK_NONE)
133 selection = GDK_SELECTION_CLIPBOARD;
135 clipboards = g_object_get_data (G_OBJECT (display), "gtk-clipboard-list");
137 tmp_list = clipboards;
140 clipboard = tmp_list->data;
141 if (clipboard->selection == selection)
144 tmp_list = tmp_list->next;
149 clipboard = g_new0 (GtkClipboard, 1);
150 clipboard->selection = selection;
151 clipboard->display = display;
152 clipboards = g_slist_prepend (clipboards, clipboard);
153 g_object_set_data (G_OBJECT (display), "gtk-clipboard-list", clipboards);
160 * gtk_clipboard_get():
161 * @selection: a #GdkAtom which identifies the clipboard
164 * Returns the clipboard object for the given selection.
165 * See gtk_clipboard_get_for_display() for complete details.
167 * Return value: the appropriate clipboard object. If no
168 * clipboard already exists, a new one will
169 * be created. Once a clipboard object has
170 * been created, it is persistent for all time and
174 gtk_clipboard_get (GdkAtom selection)
176 return gtk_clipboard_get_for_display (gdk_display_get_default (), selection);
180 selection_get_cb (GtkWidget *widget,
181 GtkSelectionData *selection_data,
185 GtkClipboard *clipboard = gtk_widget_get_clipboard (widget, selection_data->selection);
187 if (clipboard && clipboard->get_func)
188 clipboard->get_func (clipboard, selection_data, info, clipboard->user_data);
192 selection_clear_event_cb (GtkWidget *widget,
193 GdkEventSelection *event)
195 GtkClipboard *clipboard = gtk_widget_get_clipboard (widget, event->selection);
199 clipboard_unset (clipboard);
207 make_clipboard_widget (GdkDisplay *display,
210 GtkWidget *widget = gtk_invisible_new_for_screen (gdk_display_get_default_screen (display));
212 gtk_signal_connect (GTK_OBJECT (widget), "selection_received",
213 GTK_SIGNAL_FUNC (selection_received), NULL);
217 /* We need this for gdk_x11_get_server_time() */
218 gtk_widget_add_events (widget, GDK_PROPERTY_CHANGE_MASK);
220 gtk_signal_connect (GTK_OBJECT (widget), "selection_get",
221 GTK_SIGNAL_FUNC (selection_get_cb), NULL);
222 gtk_signal_connect (GTK_OBJECT (widget), "selection_clear_event",
223 GTK_SIGNAL_FUNC (selection_clear_event_cb), NULL);
230 get_clipboard_widget (GdkDisplay *display)
232 GtkWidget *clip_widget = g_object_get_data (G_OBJECT (display), "gtk-clipboard-widget");
235 clip_widget = make_clipboard_widget (display, TRUE);
236 g_object_set_data (G_OBJECT (display), "gtk-clipboard-widget", clip_widget);
242 /* This function makes a very good guess at what the correct
243 * timestamp for a selection request should be. If there is
244 * a currently processed event, it uses the timestamp for that
245 * event, otherwise it uses the current server time. However,
246 * if the time resulting from that is older than the time used
247 * last time, it uses the time used last time instead.
249 * In order implement this correctly, we never use CurrentTime,
250 * but actually retrieve the actual timestamp from the server.
251 * This is a little slower but allows us to make the guarantee
252 * that the times used by this application will always ascend
253 * and we won't get selections being rejected just because
254 * we are using a correct timestamp from an event, but used
255 * CurrentTime previously.
258 clipboard_get_timestamp (GtkClipboard *clipboard)
260 GtkWidget *clipboard_widget = get_clipboard_widget (clipboard->display);
261 guint32 timestamp = gtk_get_current_event_time ();
263 if (timestamp == GDK_CURRENT_TIME)
265 #ifdef GDK_WINDOWING_X11
266 timestamp = gdk_x11_get_server_time (clipboard_widget->window);
267 #elif defined GDK_WINDOWING_WIN32
268 timestamp = GetMessageTime ();
273 if (clipboard->timestamp != GDK_CURRENT_TIME)
275 /* Check to see if clipboard->timestamp is newer than
276 * timestamp, accounting for wraparound.
279 guint32 max = timestamp + 0x80000000;
281 if ((max > timestamp &&
282 (clipboard->timestamp > timestamp &&
283 clipboard->timestamp <= max)) ||
285 (clipboard->timestamp > timestamp ||
286 clipboard->timestamp <= max)))
288 timestamp = clipboard->timestamp;
293 clipboard->timestamp = timestamp;
299 clipboard_owner_destroyed (gpointer data)
301 GSList *clipboards = data;
304 tmp_list = clipboards;
307 GtkClipboard *clipboard = tmp_list->data;
309 clipboard->get_func = NULL;
310 clipboard->clear_func = NULL;
311 clipboard->user_data = NULL;
312 clipboard->have_owner = FALSE;
314 gtk_clipboard_clear (clipboard);
316 tmp_list = tmp_list->next;
319 g_slist_free (clipboards);
323 clipboard_add_owner_notify (GtkClipboard *clipboard)
325 if (!clipboards_owned_key_id)
326 clipboards_owned_key_id = g_quark_from_static_string (clipboards_owned_key);
328 if (clipboard->have_owner)
329 g_object_set_qdata_full (clipboard->user_data, clipboards_owned_key_id,
330 g_slist_prepend (g_object_steal_qdata (clipboard->user_data,
331 clipboards_owned_key_id),
333 clipboard_owner_destroyed);
337 clipboard_remove_owner_notify (GtkClipboard *clipboard)
339 if (clipboard->have_owner)
340 g_object_set_qdata_full (clipboard->user_data, clipboards_owned_key_id,
341 g_slist_remove (g_object_steal_qdata (clipboard->user_data,
342 clipboards_owned_key_id),
344 clipboard_owner_destroyed);
348 gtk_clipboard_set_contents (GtkClipboard *clipboard,
349 const GtkTargetEntry *targets,
351 GtkClipboardGetFunc get_func,
352 GtkClipboardClearFunc clear_func,
356 GtkWidget *clipboard_widget = get_clipboard_widget (clipboard->display);
358 if (gtk_selection_owner_set_for_display (clipboard->display,
360 clipboard->selection,
361 clipboard_get_timestamp (clipboard)))
363 clipboard->have_selection = TRUE;
365 if (!(clipboard->have_owner && have_owner) ||
366 clipboard->user_data != user_data)
368 clipboard_unset (clipboard);
370 if (clipboard->get_func)
372 /* Calling unset() caused the clipboard contents to be reset!
373 * Avoid leaking and return
375 if (!(clipboard->have_owner && have_owner) ||
376 clipboard->user_data != user_data)
378 (*clear_func) (clipboard, user_data);
386 clipboard->user_data = user_data;
387 clipboard->have_owner = have_owner;
389 clipboard_add_owner_notify (clipboard);
394 clipboard->get_func = get_func;
395 clipboard->clear_func = clear_func;
397 gtk_selection_clear_targets (clipboard_widget, clipboard->selection);
398 gtk_selection_add_targets (clipboard_widget, clipboard->selection,
408 * gtk_clipboard_set_with_data:
409 * @clipboard: a #GtkClipboard
410 * @targets: array containing information about the available forms for the
412 * @n_targets: number of elements in @targets
413 * @get_func: function to call to get the actual clipboard data
414 * @clear_func: when the clipboard contents are set again, this function will
415 * be called, and @get_func will not be subsequently called.
416 * @user_data: user data to pass to @get_func and @clear_func.
418 * Virtually sets the contents of the specified clipboard by providing
419 * a list of supported formats for the clipboard data and a function
420 * to call to get the actual data when it is requested.
422 * Return value: %TRUE if setting the clipboard data succeeded. If setting
423 * the clipboard data failed the provided callback functions
427 gtk_clipboard_set_with_data (GtkClipboard *clipboard,
428 const GtkTargetEntry *targets,
430 GtkClipboardGetFunc get_func,
431 GtkClipboardClearFunc clear_func,
434 g_return_val_if_fail (clipboard != NULL, FALSE);
435 g_return_val_if_fail (targets != NULL, FALSE);
436 g_return_val_if_fail (get_func != NULL, FALSE);
438 return gtk_clipboard_set_contents (clipboard, targets, n_targets,
439 get_func, clear_func, user_data,
444 * gtk_clipboard_set_with_owner:
445 * @clipboard: a #GtkClipboard
446 * @targets: array containing information about the available forms for the
448 * @n_targets: number of elements in @targets
449 * @get_func: function to call to get the actual clipboard data
450 * @clear_func: when the clipboard contents are set again, this function will
451 * be called, and @get_func will not be subsequently called.
452 * @owner: an object that "owns" the data. This object will be passed
453 * to the callbacks when called.
455 * Virtually sets the contents of the specified clipboard by providing
456 * a list of supported formats for the clipboard data and a function
457 * to call to get the actual data when it is requested.
459 * The difference between this function and gtk_clipboard_set_with_data()
460 * is that instead of an generic @user_data pointer, a #GObject is passed
463 * Return value: %TRUE if setting the clipboard data succeeded. If setting
464 * the clipboard data failed the provided callback functions
468 gtk_clipboard_set_with_owner (GtkClipboard *clipboard,
469 const GtkTargetEntry *targets,
471 GtkClipboardGetFunc get_func,
472 GtkClipboardClearFunc clear_func,
475 g_return_val_if_fail (clipboard != NULL, FALSE);
476 g_return_val_if_fail (targets != NULL, FALSE);
477 g_return_val_if_fail (get_func != NULL, FALSE);
478 g_return_val_if_fail (G_IS_OBJECT (owner), FALSE);
480 return gtk_clipboard_set_contents (clipboard, targets, n_targets,
481 get_func, clear_func, owner,
486 * gtk_clipboard_get_owner:
487 * @clipboard: a #GtkClipboard
489 * If the clipboard contents callbacks were set with
490 * gtk_clipboard_set_with_owner(), and the gtk_clipboard_set_with_data() or
491 * gtk_clipboard_clear() has not subsequently called, returns the owner set
492 * by gtk_clipboard_set_with_owner().
494 * Return value: the owner of the clipboard, if any; otherwise %NULL.
497 gtk_clipboard_get_owner (GtkClipboard *clipboard)
499 g_return_val_if_fail (clipboard != NULL, NULL);
501 if (clipboard->have_owner)
502 return clipboard->user_data;
508 clipboard_unset (GtkClipboard *clipboard)
510 GtkClipboardClearFunc old_clear_func;
513 old_clear_func = clipboard->clear_func;
514 old_data = clipboard->user_data;
516 if (clipboard->have_owner)
518 clipboard_remove_owner_notify (clipboard);
519 clipboard->have_owner = FALSE;
522 clipboard->get_func = NULL;
523 clipboard->clear_func = NULL;
524 clipboard->user_data = NULL;
527 old_clear_func (clipboard, old_data);
531 * gtk_clipboard_clear:
532 * @clipboard: a #GtkClipboard
534 * Clears the contents of the clipboard. Generally this should only
535 * be called between the time you call gtk_clipboard_set_with_owner()
536 * or gtk_clipboard_set_with_data(),
537 * and when the @clear_func you supplied is called. Otherwise, the
538 * clipboard may be owned by someone else.
541 gtk_clipboard_clear (GtkClipboard *clipboard)
543 g_return_if_fail (clipboard != NULL);
545 if (clipboard->have_selection)
546 gtk_selection_owner_set_for_display (clipboard->display,
548 clipboard->selection,
549 clipboard_get_timestamp (clipboard));
553 text_get_func (GtkClipboard *clipboard,
554 GtkSelectionData *selection_data,
558 gtk_selection_data_set_text (selection_data, data, -1);
562 text_clear_func (GtkClipboard *clipboard,
569 * gtk_clipboard_set_text:
570 * @clipboard: a #GtkClipboard object
571 * @text: a UTF-8 string.
572 * @len: length of @text, in bytes, or -1, in which case
573 * the length will be determined with <function>strlen()</function>.
575 * Sets the contents of the clipboard to the given UTF-8 string. GTK+ will
576 * make a copy of the text and take responsibility for responding
577 * for requests for the text, and for converting the text into
578 * the requested format.
581 gtk_clipboard_set_text (GtkClipboard *clipboard,
585 static const GtkTargetEntry targets[] = {
586 { "STRING", 0, TARGET_STRING },
587 { "TEXT", 0, TARGET_TEXT },
588 { "COMPOUND_TEXT", 0, TARGET_COMPOUND_TEXT },
589 { "UTF8_STRING", 0, TARGET_UTF8_STRING }
592 g_return_if_fail (clipboard != NULL);
593 g_return_if_fail (text != NULL);
598 gtk_clipboard_set_with_data (clipboard,
599 targets, G_N_ELEMENTS (targets),
600 text_get_func, text_clear_func,
601 g_strndup (text, len));
605 set_request_contents_info (GtkWidget *widget,
606 RequestContentsInfo *info)
608 if (!request_contents_key_id)
609 request_contents_key_id = g_quark_from_static_string (request_contents_key);
611 gtk_object_set_data_by_id (GTK_OBJECT (widget),
612 request_contents_key_id,
616 static RequestContentsInfo *
617 get_request_contents_info (GtkWidget *widget)
619 if (!request_contents_key_id)
622 return gtk_object_get_data_by_id (GTK_OBJECT (widget),
623 request_contents_key_id);
627 selection_received (GtkWidget *widget,
628 GtkSelectionData *selection_data,
631 RequestContentsInfo *request_info = get_request_contents_info (widget);
632 set_request_contents_info (widget, NULL);
634 request_info->callback (gtk_widget_get_clipboard (widget, selection_data->selection),
636 request_info->user_data);
638 g_free (request_info);
640 if (widget != get_clipboard_widget (gtk_widget_get_display (widget)))
641 gtk_widget_destroy (widget);
645 * gtk_clipboard_request_contents:
646 * @clipboard: a #GtkClipboard
647 * @target: an atom representing the form into which the clipboard
648 * owner should convert the selection.
649 * @callback: A function to call when the results are received
650 * (or the retrieval fails). If the retrieval fails
651 * the length field of @selection_data will be
653 * @user_data: user data to pass to @callback
655 * Requests the contents of clipboard as the given target.
656 * When the results of the result are later received the supplied callback
660 gtk_clipboard_request_contents (GtkClipboard *clipboard,
662 GtkClipboardReceivedFunc callback,
665 RequestContentsInfo *info;
667 GtkWidget *clipboard_widget;
669 g_return_if_fail (clipboard != NULL);
670 g_return_if_fail (target != GDK_NONE);
671 g_return_if_fail (callback != NULL);
673 clipboard_widget = get_clipboard_widget (clipboard->display);
675 if (get_request_contents_info (clipboard_widget))
676 widget = make_clipboard_widget (clipboard->display, FALSE);
678 widget = clipboard_widget;
680 info = g_new (RequestContentsInfo, 1);
681 info->callback = callback;
682 info->user_data = user_data;
684 set_request_contents_info (widget, info);
686 gtk_selection_convert (widget, clipboard->selection, target,
687 clipboard_get_timestamp (clipboard));
691 request_text_received_func (GtkClipboard *clipboard,
692 GtkSelectionData *selection_data,
695 RequestTextInfo *info = data;
696 gchar *result = NULL;
698 result = gtk_selection_data_get_text (selection_data);
702 /* If we asked for UTF8 and didn't get it, try compound_text;
703 * if we asked for compound_text and didn't get it, try string;
704 * If we asked for anything else and didn't get it, give up.
706 if (selection_data->target == gdk_atom_intern ("UTF8_STRING", FALSE))
708 gtk_clipboard_request_contents (clipboard,
709 gdk_atom_intern ("COMPOUND_TEXT", FALSE),
710 request_text_received_func, info);
713 else if (selection_data->target == gdk_atom_intern ("COMPOUND_TEXT", FALSE))
715 gtk_clipboard_request_contents (clipboard,
717 request_text_received_func, info);
722 info->callback (clipboard, result, info->user_data);
728 * gtk_clipboard_request_text:
729 * @clipboard: a #GtkClipboard
730 * @callback: a function to call when the text is received,
731 * or the retrieval fails. (It will always be called
732 * one way or the other.)
733 * @user_data: user data to pass to @callback.
735 * Requests the contents of the clipboard as text. When the text is
736 * later received, it will be converted to UTF-8 if necessary, and
737 * @callback will be called.
739 * The @text parameter to @callback will contain the resulting text if
740 * the request succeeded, or %NULL if it failed. This could happen for
741 * various reasons, in particular if the clipboard was empty or if the
742 * contents of the clipboard could not be converted into text form.
745 gtk_clipboard_request_text (GtkClipboard *clipboard,
746 GtkClipboardTextReceivedFunc callback,
749 RequestTextInfo *info;
751 g_return_if_fail (clipboard != NULL);
752 g_return_if_fail (callback != NULL);
754 info = g_new (RequestTextInfo, 1);
755 info->callback = callback;
756 info->user_data = user_data;
758 gtk_clipboard_request_contents (clipboard, gdk_atom_intern ("UTF8_STRING", FALSE),
759 request_text_received_func,
771 clipboard_received_func (GtkClipboard *clipboard,
772 GtkSelectionData *selection_data,
775 WaitResults *results = data;
777 if (selection_data->length >= 0)
778 results->data = gtk_selection_data_copy (selection_data);
780 g_main_quit (results->loop);
784 * gtk_clipboard_wait_for_contents:
785 * @clipboard: a #GtkClipboard
786 * @target: an atom representing the form into which the clipboard
787 * owner should convert the selection.
789 * Requests the contents of the clipboard using the given target.
790 * This function waits for the data to be received using the main
791 * loop, so events, timeouts, etc, may be dispatched during the wait.
793 * Return value: a newly-allocated #GtkSelectionData object or %NULL
794 * if retrieving the given target failed. If non-%NULL,
795 * this value must be freed with gtk_selection_data_free()
796 * when you are finished with it.
799 gtk_clipboard_wait_for_contents (GtkClipboard *clipboard,
804 g_return_val_if_fail (clipboard != NULL, NULL);
805 g_return_val_if_fail (target != GDK_NONE, NULL);
808 results.loop = g_main_new (TRUE);
810 gtk_clipboard_request_contents (clipboard, target,
811 clipboard_received_func,
814 if (g_main_is_running (results.loop))
816 GDK_THREADS_LEAVE ();
817 g_main_run (results.loop);
818 GDK_THREADS_ENTER ();
821 g_main_destroy (results.loop);
827 clipboard_text_received_func (GtkClipboard *clipboard,
831 WaitResults *results = data;
833 results->data = g_strdup (text);
834 g_main_quit (results->loop);
839 * gtk_clipboard_wait_for_text:
840 * @clipboard: a #GtkClipboard
842 * Requests the contents of the clipboard as text and converts
843 * the result to UTF-8 if necessary. This function waits for
844 * the data to be received using the main loop, so events,
845 * timeouts, etc, may be dispatched during the wait.
847 * Return value: a newly-allocated UTF-8 string which must
848 * be freed with g_free(), or %NULL if retrieving
849 * the selection data failed. (This could happen
850 * for various reasons, in particular if the
851 * clipboard was empty or if the contents of the
852 * clipboard could not be converted into text form.)
855 gtk_clipboard_wait_for_text (GtkClipboard *clipboard)
859 g_return_val_if_fail (clipboard != NULL, NULL);
860 g_return_val_if_fail (clipboard != NULL, NULL);
863 results.loop = g_main_new (TRUE);
865 gtk_clipboard_request_text (clipboard,
866 clipboard_text_received_func,
869 if (g_main_is_running (results.loop))
871 GDK_THREADS_LEAVE ();
872 g_main_run (results.loop);
873 GDK_THREADS_ENTER ();
876 g_main_destroy (results.loop);
881 * gtk_clipboard_get_display:
882 * @clipboard: a #GtkClipboard
884 * Gets the #GdkDisplay associated with @clipboard
886 * Return value: the #GdkDisplay associated with @clipboard
889 gtk_clipboard_get_display (GtkClipboard *clipboard)
891 g_return_val_if_fail (clipboard != NULL, NULL);
893 return clipboard->display;
897 * gtk_clipboard_wait_is_text_available:
898 * @clipboard: a #GtkClipboard
900 * Test to see if there is text available to be pasted
901 * This is done by requesting the TARGETS atom and checking
902 * if it contains any of the names: STRING, TEXT, COMPOUND_TEXT,
903 * UTF8_STRING. This function waits for the data to be received
904 * using the main loop, so events, timeouts, etc, may be dispatched
907 * This function is a little faster than calling
908 * gtk_clipboard_wait_for_text() since it doesn't need to retrieve
911 * Return value: %TRUE is there is text available, %FALSE otherwise.
914 gtk_clipboard_wait_is_text_available (GtkClipboard *clipboard)
916 GtkSelectionData *data;
917 gboolean result = FALSE;
919 data = gtk_clipboard_wait_for_contents (clipboard, gdk_atom_intern ("TARGETS", FALSE));
922 result = gtk_selection_data_targets_include_text (data);
923 gtk_selection_data_free (data);