GNOME Bugzilla – Bug 51614
DnD problem in gnome-terminal (fix supplied)
Last modified: 2004-12-22 21:47:04 UTC
The gnome-terminal manual claims that files and URIs can be dragged onto a terminal. However, this doesn't work and looking at the source code, it seems that it doesn't accept 'text/uri-list' as a valid target (this seems to be the obvious target name). The solution is to add: { "text/uri-list", 0, TARGET_STRING }, to the list of drop targets, which shouldn't break anything. Thanks,
The XDND spec for dragging files is here: http://www.newplanetsoftware.com/xdnd/dragging_files.html From the spec: "Note that, in general, the source should not provide any types other than text/uri-list. This is because anything on the file system can be dragged: plain text, HTML, images, binary executables, or even directories. The only type that encompasses all these is text/uri-list. All of these can even be dragged at the same time. It is the target's responsibility to sort out what was dropped and do something reasonable." Therefore, a conforming filer cannot provide targets text/plain or STRING, which you rely on. Thank you for your time.
This has been fixed in a later release, no? It works just fine here.
>gnome-terminal --version Gnome Terminal 1.4.0.4 Dragging a text file inserts its contents; if any other type of file is dragged, the drop is refused. Also, grepping the CVS sources for the target text/uri-list, it doesn't seem to be present at all! Adding the line in the first message should fix the problem. Thank you.
Forwarding.
Created attachment 6423 [details] [review] Attaching a patch (against 1.4.0) in the hope this can finally be closed!
The above patch does two things: - It allows a file or directory to be dragged from a filer window into gnome-terminal and have the name of the file inserted. Note that this already worked for gmc, by not for all filers. In particular, it didn't work with filers that follow the XDND spec. - It strips extra leading '/' characters from the name, so that 'file:///path/file' is inserted as '/path/file'. The patch doesn't break compatibility with gmc. Please let me know if you have any questions about the XDND protocol or this patch. Thanks,
What programs did you drag from? I can do it from mozilla and konqueror without this patch. Maybe the text/uri-list target is handled by zvt rather than gnome-terminal itself?
I'm dragging from ROX-Filer: http://rox.sf.net/rox_filer.php3 I realize that several programs have followed gmc's lead in allowing a program to request either a file list or plain text and get the file list either way, but it is not correct to do this! Thanks,
I tested this against xterm and was unable to drop anything from rox filer to xterm. Are you sure that rox is doing the right thing here? I think one of the main points with gnome-terminal is bein compatible with xterm.
I don't understand... xterm doesn't support drag-and-drop at all. You can't drag into it from gmc either, or from nautilus. Here is a quote from John Lindal (author of the XDND protocol) on the subject: >>> Is anybody actually claiming that text/plain is the correct thing to >>> request?? >> >> gmc and nautilus at least support this, so most of the GNOME apps think >> it's the right thing to do :-( >They provide text/plain when dragging files? That's nuts. Refer them to >my updated dragging_files.html and they'll understand why. (see further up this bug report for the link) On a vaguely related note, it is possible to copy the filename into xterm by selecting the file in ROX-Filer and doing a middle-button paste into it; this has recently stopped working in gnome-terminal, but I don't know why. Thanks,
The selection problem above turned out to be unrelated (zvt has stopped accepting the STRING target and wanted COMPOUND_TEXT instead). This doesn't affect the original DnD problem, though - the patch still needs to be applied.
I applied it. Thanks for your patience :)