From 02768c459a81592abaa50c6095b3a60b1049b4fc Mon Sep 17 00:00:00 2001 From: Jonathan Moore Liles Date: Wed, 29 May 2013 19:38:00 -0700 Subject: [PATCH] XDND: Inform the source widget when DND operation has ended. --- src/fl_dnd_x.cxx | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/fl_dnd_x.cxx b/src/fl_dnd_x.cxx index 1e3b055..12aacf9 100644 --- a/src/fl_dnd_x.cxx +++ b/src/fl_dnd_x.cxx @@ -99,6 +99,8 @@ int Fl::dnd() { XSetSelectionOwner(fl_display, fl_XdndSelection, fl_message_window, fl_event_time); + Fl_Widget *pushed = Fl::pushed(); + while (Fl::pushed()) { // figure out what window we are pointing at: @@ -178,8 +180,10 @@ int Fl::dnd() { fl_i_own_selection[0] = 1; if (local_handle(FL_DND_RELEASE, local_window)) paste(*belowmouse(), 0); } else if (dndversion) { - fl_sendClientMessage(target_window, fl_XdndDrop, source_window, + + fl_sendClientMessage(target_window, fl_XdndDrop, source_window, 0, fl_event_time); + } else if (target_window) { // fake a drop by clicking the middle mouse button: XButtonEvent msg; @@ -201,6 +205,13 @@ int Fl::dnd() { XSendEvent(fl_display, target_window, False, 0L, (XEvent*)&msg); } + if ( !local_window ) + { + /* let the source widget know that DND is over */ + pushed->handle( FL_DND_RELEASE ); + pushed->handle( FL_RELEASE ); + } + fl_local_grab = 0; source_fl_win->cursor(FL_CURSOR_DEFAULT); return 1;