summaryrefslogtreecommitdiff
path: root/src/drivers
diff options
context:
space:
mode:
authorManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com>2022-11-08 07:22:16 +0100
committerManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com>2022-11-08 07:22:16 +0100
commit9c793a383f181ecb1a76db54b13705dbfa9255e5 (patch)
treeb56d2030379d98572877522c00fb5188f9d60bf6 /src/drivers
parentd68f927a1382d1603a03e5be77f79b7a51854360 (diff)
Wayland: cancel drag-n-drop after Fl::pushed(0) (#525)
Diffstat (limited to 'src/drivers')
-rw-r--r--src/drivers/Wayland/fl_wayland_clipboard_dnd.cxx7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/drivers/Wayland/fl_wayland_clipboard_dnd.cxx b/src/drivers/Wayland/fl_wayland_clipboard_dnd.cxx
index 38484f135..7ede42570 100644
--- a/src/drivers/Wayland/fl_wayland_clipboard_dnd.cxx
+++ b/src/drivers/Wayland/fl_wayland_clipboard_dnd.cxx
@@ -76,8 +76,7 @@ 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 (!Fl::pushed()) { close(fd); wl_data_source_destroy(source); }
- else 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) == 0 || strcmp(mime_type, "text/plain") == 0 || strcmp(mime_type, "image/bmp") == 0) {
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];
@@ -125,6 +124,10 @@ static void data_source_handle_cancelled(void *data, struct wl_data_source *sour
static void data_source_handle_target(void *data, struct wl_data_source *source, const char *mime_type) {
+ if (!Fl::pushed()) {
+ data_source_handle_cancelled(data, source);
+ return;
+ }
if (mime_type != NULL) {
//printf("Destination would accept MIME type if dropped: %s\n", mime_type);
} else {