Drag-and-drop from pcmanfm into some applications (e.g. dragging a photo into frogr) doesn't work. Dragging into the same applications from rox does work.
N.B. I'm using the master version, on Arch.
We support dragging files as URI list and as plain text list. If frogr doesn't support any of those types then I don't know how to help it. I would like you to ask from frogr developers how they expect drag-and-drop to work. Thank you very much.
Hmmm. The frogr developer said this:
> Well, I haven't had time to give this much thought, so quick answer is that I
> have no idea yet on how to fix it in frogr (or whether it's fixable at all,
> fwiw), and that I was just planning on reproducing the issue and try to find a
> solution as soon as I have some free time for it.
> Not sure whether you're meaning there's nothing we can do from frogr side,
> though. In any case, any advice you can provide on the right direction would be
> highly appreciated.
This is way over my head, but this looks like the relevant code in frogr, and I get the impression it's using standard GTK features to receive URIs...:
_on_icon_view_drag_data_received (GtkWidget *widget,
gint x, gint y,
guint info, guint time,
FrogrMainView *self = NULL;
FrogrMainViewPrivate *priv = NULL;
GSList *fileuris_list = NULL;
const guchar *files_string = NULL;
gchar **fileuris_array = NULL;
self = FROGR_MAIN_VIEW (data);
priv = FROGR_MAIN_VIEW_GET_PRIVATE (data);
/* Do nothing when the application is busy doing something else */
if (FROGR_STATE_IS_BUSY(frogr_controller_get_state (priv->controller)))
target = gtk_selection_data_get_target (selection_data);
if (!gtk_targets_include_uri (&target, 1))
/* Get GSList with the list of files */
files_string = gtk_selection_data_get_data (selection_data);
fileuris_array = g_strsplit ((const gchar*)files_string, "\r\n", -1);
for (i = 0; fileuris_array[i]; i++)
if (fileuris_array[i] && fileuris_array[i] != '\0')
fileuris_list = g_slist_append (fileuris_list, g_strdup (fileuris_array[i]));
/* Load pictures */
if (fileuris_list != NULL)
_load_pictures (FROGR_MAIN_VIEW (self), fileuris_list);
/* Finish drag and drop */
gtk_drag_finish (context, TRUE, FALSE, time);
/* Free */
Oh, I believe I know what is incorrect in their code. They assume that primary target should be always URI but in some cases it might be not. Instead of using gtk_selection_data_get_target() followed by gtk_targets_include_uri() they shoul use gtk_selection_data_targets_include_uri(), and also use gtk_selection_data_get_uris() instead of gtk_selection_data_get_data() followed by g_strsplit(). That will not only simplify their code but also fix problem not only with pcmanfm but also allow drop from other programs which support URI but not as primary target. :)
It has been fixed in frogr and their developer says thanks for the help
If I remember which other applications were having problems I'll look into them further - I suspect they don't accept URIs, just image/jpeg or image/png targets (rox seems to provide targets specifically suitable for each file type).
FWIW, another example of programs which don't accept drag-and-drop from pcmanfm but do from rox is Microsoft Word, Excel, etc, running with Wine :)
Try master libfm GIT repo, please, and tell me if latest committed workaround fixed the issue. Thank you very much.
Oh, I think the issue with Wine applications is some sort of CRLF problem - it can be demonstrated just by trying to drag-and-drop a text file into the built-in Wine notepad. It gives an error message:
' could not be found.
And if you try to drag two files into it:
' could not be found.
Yes, that is what the problem is. A uri list is supposed to be \r\n delimited - see e.g. http://www.lephpfacile.com/manuel-php-gtk/tutorials.filednd.urilist.php
If I change this in fm-dnd-src.c:
g_string_append( uri_list, "\n" );
g_string_append( uri_list, "\r\n" );
then drag-and-drop works to all wine programs, as well as to normal linux programs.
Thank you very much! Applied to master source. :)
Sign up for the SourceForge newsletter:
You seem to have CSS turned off.
Please don't fill out this field.