From f89a9f9efcdcecb5a5789ec930425e32ac9cb9ee Mon Sep 17 00:00:00 2001 From: ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com> Date: Mon, 6 Mar 2023 11:08:04 +0100 Subject: DnD of filenames: make Wayland behave as Windows and macOS and also add more detailed documentation of platform-specific behaviors. --- documentation/src/events.dox | 25 +++++++++++++++---------- documentation/src/wayland.dox | 3 +-- 2 files changed, 16 insertions(+), 12 deletions(-) (limited to 'documentation') diff --git a/documentation/src/events.dox b/documentation/src/events.dox index 26a3cda83..2dc1c7b25 100644 --- a/documentation/src/events.dox +++ b/documentation/src/events.dox @@ -268,16 +268,7 @@ selection indication. Most modern programs ignore this. FLTK supports drag and drop of text and files from any application on the desktop to an FLTK widget. Text is transferred -using UTF-8 encoding. Files are received as a list of full path -and file names, separated by newline. - -On some X11 platforms and with Wayland, files are received as a URL-encoded UTF-8 string, -that is, non-ASCII bytes (and a few others such as space and %) are -replaced by the 3 bytes "%XY" where XY are the byte's hexadecimal value. -The \ref fl_decode_uri() function can be used to transform in-place -the received string into a proper UTF-8 string. On these platforms, -strings corresponding to dropped files are further prepended -by file:// (or other prefixes such as computer://). +using UTF-8 encoding. See Fl::dnd() for drag and drop from an FLTK widget. @@ -290,6 +281,20 @@ depends on the protocol used on each platform. \p FL_DND_* events cannot be used in widgets derived from Fl_Group or Fl_Window. +\subsection events_fl_dnd_files Dropped filenames +Files are received as a list of full path and file names. +- On some X11 platforms, files are received as a URL-encoded UTF-8 string, +that is, non-ASCII bytes (and a few others such as space and %) are +replaced by the 3 bytes "%XY" where XY are the byte's hexadecimal value. +The \ref fl_decode_uri() function can be used to transform in-place +the received string into a proper UTF-8 string. On these platforms, +strings corresponding to dropped files are further prepended +by file:// (or other prefixes such as computer://). +- Other X11 situations put all dropped filenames in a single line, separated by +spaces. +- On non-X11 platforms, including Wayland, files dropped are received one +pathname per line, with no '\\n' after the last pathname. + \subsection events_fl_dnd_enter FL_DND_ENTER The mouse has been moved to point at this widget. A widget that is diff --git a/documentation/src/wayland.dox b/documentation/src/wayland.dox index 3dfa4d733..0b6b9aca0 100644 --- a/documentation/src/wayland.dox +++ b/documentation/src/wayland.dox @@ -763,8 +763,7 @@ FLTK can copy or paste plain UTF-8 text or image data to/from the clipboard. Ima clipboard as \c image/bmp mime type. Images in \c image/bmp or \c image/png mime types from the clipboard can be pasted to FLTK apps. -Files dropped are received one per line with URL-encoded UTF-8 names prepended by -file:// (see \ref events_dnd). +Files dropped are received one pathname per line, with no '\n' after the last pathname. \section wayland-egl EGL as support for OpenGL -- cgit v1.2.3