Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

drag and drop: support images, text, server-to-client, etc #1494

Open
totaam opened this issue Apr 10, 2017 · 4 comments
Open

drag and drop: support images, text, server-to-client, etc #1494

totaam opened this issue Apr 10, 2017 · 4 comments
Labels
enhancement New feature or request
Milestone

Comments

@totaam
Copy link
Collaborator

totaam commented Apr 10, 2017

Follow up from #1493.

  • we have the source window and target window, so we should be able to send the data to the specific application window that was pointed to (if it supports it... which we won't know about until it is too late?)
  • we should handle more data types and sanitize them: the "selection-data" structure can give us plain text, UTF8, images, etc.
  • this same code could be re-used for sanitizing clipboard data (ie: images)
  • on the server-side, we may be able to register the "world-window" as a drop target so that we can trigger drag-n-drop events from server to client
@totaam
Copy link
Collaborator Author

totaam commented Apr 10, 2017

Examples of targets with common applications:

  • browser URL:
'STRING', 'UTF8_STRING', 'text/plain', 'text/x-moz-url', 'TEXT', '_NETSCAPE_URL'
  • browser text data:
'text/x-moz-url', '_NETSCAPE_URL', 'application/x-moz-custom-clipdata', 'text/unicode', 'text/plain;charset=utf-8', 'text/plain', 'text/html'
  • browser image:
STRING, UTF8_STRING, XdndDirectSave0, text/plain, text/x-moz-url, TEXT, text/html, chromium/x-renderer-taint, application/octet-stream

Docs:

@totaam
Copy link
Collaborator Author

totaam commented Apr 1, 2018

Links:

Related to #812.

@totaam
Copy link
Collaborator Author

totaam commented Jun 1, 2019

Updates in #812 comment:27

@totaam totaam added the enhancement New feature or request label Jan 23, 2021
@totaam totaam added this to the 5.0 milestone Jan 23, 2021
@totaam
Copy link
Collaborator Author

totaam commented Dec 13, 2024

FWIW, it may be easier to start by supporting file transfers via the clipboard.
Using the default file manager on Linux, it offers the following types when copying a file to the clipboard:

SAVE_TARGETS, TIMESTAMP, TARGETS, x-special/gnome-copied-files, application/vnd.portal.filetransfer, 
application/vnd.portal.files, text/uri-list, UTF8_STRING, COMPOUND_TEXT, TEXT, STRING, text/plain;charset=utf-8

This could work more easily for X11:

  • expose the text/uri-list clipboard TARGET
  • when the remote application asks for this target:
    • transfer the files to a temporary directory
    • respond with a custom text/uri-list pointing to these files

This can only work if we have enough time to copy the files over before replying to the selection request, so only for small-ish files + small number of files.

The FileTransfer portal is another, more heavyweight solution.

Interestingly, the HTML drag and drop API also uses text/uri-list: HTML Drag and Drop API: Recommended drag types

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant