Wayland Fl_Copy_Surface and Fl::copy() issues (#707) - cont'd

This commit is contained in:
ManoloFLTK 2023-03-24 16:56:25 +01:00
parent e918d94b67
commit 9f9e584919
2 changed files with 10 additions and 2 deletions

View File

@ -96,6 +96,12 @@ a minimized window has no effect.
it's currently not possible for an app to be notified of changes to the content of
the system clipboard, that is, Fl::add_clipboard_notify() has no effect.
* Copying data to the clipboard is best done when the app has focus. Any copy operation
performed when the app not yet got the focus does not change the clipboard. A copy operation
performed when the app has lost the focus is successful only if the type of the copied
data, that is text or image, is the same as the last data type copied when the app had
the focus.
* Narrow windows with a titlebar are silently forced to be wide enough
for the titlebar to display window buttons and a few letters of the title.

View File

@ -77,13 +77,15 @@ void write_data_source_cb(FL_SOCKET fd, data_source_write_struct *data) {
static void data_source_handle_send(void *data, struct wl_data_source *source, const char *mime_type, int fd) {
fl_intptr_t rank = (fl_intptr_t)data;
//fprintf(stderr, "data_source_handle_send: %s fd=%d l=%d\n", mime_type, fd, fl_selection_length[1]);
if (strcmp(mime_type, wld_plain_text_clipboard) == 0 || strcmp(mime_type, "text/plain") == 0 || strcmp(mime_type, "image/bmp") == 0) {
if (((!strcmp(mime_type, wld_plain_text_clipboard) || !strcmp(mime_type, "text/plain")) && fl_selection_type[rank] == Fl::clipboard_plain_text)
||
(!strcmp(mime_type, "image/bmp") && fl_selection_type[rank] == Fl::clipboard_image) ) {
data_source_write_struct *write_data = new data_source_write_struct;
write_data->rest = fl_selection_length[rank];
write_data->from = fl_selection_buffer[rank];
Fl::add_fd(fd, FL_WRITE, (Fl_FD_Handler)write_data_source_cb, write_data);
} else {
Fl::error("Destination client requested unsupported MIME type: %s\n", mime_type);
//Fl::error("Destination client requested unsupported MIME type: %s\n", mime_type);
close(fd);
}
}