Wayland: improve DnD of filenames to allow space-containing names
This commit is contained in:
parent
5ae92f034a
commit
a52811567e
@ -271,7 +271,7 @@ 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, files are received as a URL-encoded UTF-8 string,
|
||||
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
|
||||
|
@ -761,9 +761,10 @@ operations:
|
||||
|
||||
FLTK can copy or paste plain UTF-8 text or image data to/from the clipboard. Images are copied to the
|
||||
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 as a string with ' ' between
|
||||
successive filenames.
|
||||
clipboard can be pasted to FLTK apps.
|
||||
|
||||
Files dropped are received one per line with URL-encoded UTF-8 names prepended by
|
||||
<tt>file://</tt> (see \ref events_dnd).
|
||||
|
||||
|
||||
\section wayland-egl EGL as support for OpenGL
|
||||
|
@ -270,8 +270,12 @@ static void data_offer_handle_offer(void *data, struct wl_data_offer *offer, con
|
||||
} else if (strcmp(mime_type, "image/bmp") == 0 && (!fl_selection_offer_type || strcmp(fl_selection_offer_type, "image/png"))) {
|
||||
fl_selection_type[1] = Fl::clipboard_image;
|
||||
fl_selection_offer_type = "image/bmp";
|
||||
} else if (strcmp(mime_type, "text/uri-list") == 0 && !fl_selection_type[1]) {
|
||||
fl_selection_type[1] = Fl::clipboard_plain_text;
|
||||
fl_selection_offer_type = "text/uri-list";
|
||||
} else if (strcmp(mime_type, wld_plain_text_clipboard) == 0 && !fl_selection_type[1]) {
|
||||
fl_selection_type[1] = Fl::clipboard_plain_text;
|
||||
fl_selection_offer_type = wld_plain_text_clipboard;
|
||||
}
|
||||
}
|
||||
|
||||
@ -325,7 +329,7 @@ static void data_device_handle_selection(void *data, struct wl_data_device *data
|
||||
static void get_clipboard_or_dragged_text(struct wl_data_offer *offer) {
|
||||
int fds[2];
|
||||
if (pipe(fds)) return;
|
||||
wl_data_offer_receive(offer, wld_plain_text_clipboard, fds[1]);
|
||||
wl_data_offer_receive(offer, fl_selection_offer_type, fds[1]);
|
||||
close(fds[1]);
|
||||
wl_display_flush(Fl_Wayland_Screen_Driver::wl_display);
|
||||
// read in fl_selection_buffer
|
||||
@ -357,7 +361,7 @@ static void get_clipboard_or_dragged_text(struct wl_data_offer *offer) {
|
||||
//fprintf(stderr, "get_clipboard_or_dragged_text: size=%ld\n", rest);
|
||||
// read full clipboard data
|
||||
if (pipe(fds)) return;
|
||||
wl_data_offer_receive(offer, wld_plain_text_clipboard, fds[1]);
|
||||
wl_data_offer_receive(offer, fl_selection_offer_type, fds[1]);
|
||||
close(fds[1]);
|
||||
wl_display_flush(Fl_Wayland_Screen_Driver::wl_display);
|
||||
if (rest+1 > fl_selection_buffer_length[1]) {
|
||||
|
Loading…
Reference in New Issue
Block a user