Xpra: Ticket #1493: initial network drag and drop

This is different from intra application drag-n-drop (#770), which was difficult enough to enable.

The html5 client already supports drag and drop of files since r15370.

We should support at least as much in the python client.

Mon, 10 Apr 2017 07:42:58 GMT - Antoine Martin: owner changed

Done in r15546.

Here's the "-d dragndrop" output from the client as I drop 2 files onto a client window:

drag_motion_cb(ClientWindow(1), <gtk.gdk.DragContext object at 0x7fa3f1f81d70 (GdkDragContext at 0x5632c2d8d1c0)>, 354, 123, 70261214)
drag_drop_cb(ClientWindow(1), <gtk.gdk.DragContext object at 0x7fa3f1f81d70 (GdkDragContext at 0x5632c2d8d1c0)>, 354, 122, 70261240) \
    targets=['x-special/gnome-icon-list', 'text/uri-list', 'UTF8_STRING', 'COMPOUND_TEXT', 'TEXT', 'STRING', 'text/plain;charset=utf-8', 'text/plain']
drag_got_data_cb(ClientWindow(1), <gtk.gdk.DragContext object at 0x7fa3f1f81a50 (GdkDragContext at 0x5632c2d8d1c0)>, 354, 122, <GtkSelectionData at 0x7fff184037e0>, 80, 70261240)
drag_got_data_cb context: source_window=0x3a98d79, dest_window=0x2a00098, suggested_action=<flags GDK_ACTION_COPY of type GdkDragAction>, \
    actions=<flags GDK_ACTION_COPY | GDK_ACTION_MOVE | GDK_ACTION_LINK | GDK_ACTION_ASK of type GdkDragAction>, \
    targets=['x-special/gnome-icon-list', 'text/uri-list', 'UTF8_STRING', 'COMPOUND_TEXT', 'TEXT', 'STRING', 'text/plain;charset=utf-8', 'text/plain']
drag_got_data_cb selection: data type=text/uri-list, format=8, length=110, target=text/uri-list, text=None, \
    uris=('file:///home/antoine/Fiber-Internet-201606-201607-2568THB.png', 'file:///home/antoine/thailand-weather-map.png')
drag_got_data_cb: will try to upload: ['/home/antoine/Fiber-Internet-201606-201607-2568THB.png', '/home/antoine/thailand-weather-map.png']
got_file_info(<__main__.GLocalFile at 0x7fa3f1f81e10: file:///home/antoine/Fiber-Internet-201606-201607-2568THB.png>, <__main__.GTask object at 0x7fa3f1f81d70 (GTask at 0x5632c2da7440)>)
file_info(/home/antoine/thailand-weather-map.png)=<gio.FileInfo object at 0x7fa3f1f81f00 (GFileInfo at 0x7fa3d4005210)> ctype=image/png, size=1152655
got_file_info(<__main__.GLocalFile at 0x7fa3f1f81d70: file:///home/antoine/thailand-weather-map.png>, <__main__.GTask object at 0x7fa3f1f81e10 (GTask at 0x5632c2da7100)>)
file_info(/home/antoine/thailand-weather-map.png)=<gio.FileInfo object at 0x7fa3f1f81fa0 (GFileInfo at 0x7fa3d4005800)> ctype=image/png, size=1463040
got_file_data(<__main__.GLocalFile at 0x7fcee4b79910: file:///home/antoine/Fiber-Internet-201606-201607-2568THB.png>, <__main__.GTask object at 0x7fcee4b79780 (GTask at 0x55a26eb0e440)>, ('/home/antoine/thailand-weather-map.png', True)) entity=1491198624:747710
sending file Fiber-Internet-201606-201607-2568THB.png (1152655 bytes)
got_file_data(<__main__.GLocalFile at 0x7fcee4b79910: file:///home/antoine/thailand-weather-map.png>, <__main__.GTask object at 0x7fcee4b799b0 (GTask at 0x55a26eb0e2a0)>, ('/home/antoine/thailand-weather-map.png', True)) entity=1483876226:373767
sending file thailand-weather-map.png (1463040 bytes)

The two files I had dropped immediately showed up in new windows as the server had been started with --open-files=yes.

@afarr: just a FYI, not sure you care about this feature. Will follow up in #1494

Tue, 20 Jun 2017 20:07:11 GMT - J. Max Mena:

Before I close this:

Is this meant to work with applications? As in, if I drag an image locally and send it remotely into a word processor, will the image show up? Same thing for uploading a photo to...somewhere.

Tue, 20 Jun 2017 20:56:26 GMT - Antoine Martin: owner changed

Is this meant to work with applications? As in, if I drag an image locally and send it remotely into a word processor, will the image show up? Same thing for uploading a photo to...somewhere.

No. To handle drag and drop interactively with the remote application, you want #1494.

What this allows you to do is to drop files onto an xpra window and have them uploaded and opened with the default system application for this type of file type - the application window you drop it onto is not used for anything.

Tue, 20 Jun 2017 20:57:43 GMT - J. Max Mena:

Okay, then noted. (seems to do exactly that) Closing.

Tue, 20 Jun 2017 20:57:55 GMT - J. Max Mena: status changed; resolution set

(okay actually doing the close)

Wed, 15 Nov 2017 12:04:00 GMT - Antoine Martin:

Wiki page: drag and drop

Sat, 23 Jan 2021 05:25:48 GMT - migration script:

this ticket has been moved to: https://github.com/Xpra-org/xpra/issues/1493