GNOME Bugzilla – Bug 55117
Add handling for text/plain for DND from standard widgets
Last modified: 2011-02-04 16:17:18 UTC
Currently GtkTextView and GtkEntry advertise text/plain as a supported type, but it doesn't actually work because gtk_selection_data_set_text() doesn't support it. text/plain itself is simply a synonym for STRING (more or less - line ending handling is not clear), but as a added complication, the XDND spec says you should handle: text-plain;charset=ISO-8859-1 and so forth as well. (http://www.newplanetsoftware.com/xdnd/)
*** Bug 58400 has been marked as a duplicate of this bug. ***
For now, removing text/plain handling; UTF8_STRING should provide better interoperability. Mon Feb 18 17:34:43 2002 Owen Taylor <otaylor@redhat.com> * gtk/gtkentry.c gtk/gtktextview.c: Remove support for the poorly defined text/plain type for now. (#55117) In the future, a possibly reasonable interpretation of text/plain would be: - offer and receive the three formats: text/plain;charset=utf-8 text/plain;charset=LOCALE_CHARSET text/plain - For text/plain send only ASCII, but accept 8-bit text and treat it as ISO-8859-1 as specified by the Xdnd spec. - Always send CRLF terminators. Accept either and convert into the native terminator for the platform.
*** Bug 130758 has been marked as a duplicate of this bug. ***
*** Bug 144385 has been marked as a duplicate of this bug. ***
Created attachment 29434 [details] [review] handle text/plain Here is an attempt to implement text/plain handling as Owen described it.
I don't think the init_target_table() stuff is acceptable. What if we added: gtk_drag_dest_add_text_targets() gtk_drag_source_add_text_targets() gtk_target_list_add_text_targets() Synchronized with the targets supported by gtk_selection_data_set/get_text()? normalize_to_crlf will read off the end of the string for the case of a \r right at the end of the string, right? normalize_to_lf also seems to have a problem with \r at the end of the string. Other than that, the patch looks good.