From 1313284b26d8f651cb0e7bde11983ceefd1f1879 Mon Sep 17 00:00:00 2001 From: Graeme Geldenhuys Date: Thu, 28 Oct 2010 00:37:56 +0200 Subject: bugfix: TfpgX11Drag.SendDNDDrop did not always process correctly. Even though this method was called, it should have checked the FDropAccepted variable which did didn't. Now it correctly conforms to the XDND spec. Due to the new behaviour we also have to make sure we free the TfpgDrag instance when the drop is not accepted. --- src/corelib/x11/fpg_x11.pas | 36 ++++++++++++++++++++++-------------- 1 file changed, 22 insertions(+), 14 deletions(-) (limited to 'src/corelib/x11') diff --git a/src/corelib/x11/fpg_x11.pas b/src/corelib/x11/fpg_x11.pas index e6594529..55530285 100644 --- a/src/corelib/x11/fpg_x11.pas +++ b/src/corelib/x11/fpg_x11.pas @@ -1656,7 +1656,10 @@ begin Drag.SendDNDDrop; { TODO: Start timeout in case XdndFinished is not received, so we can free Drag } // writeln('Freeing Drag Object'); -// FreeAndNil(FDrag); + if not Drag.FDropAccepted then + begin + FreeAndNil(FDrag); + end; end; end; @@ -3376,19 +3379,24 @@ procedure TfpgX11Drag.SendDNDDrop; var xev: TXEvent; begin - xev.xany._type := X.ClientMessage; - xev.xany.display := xapplication.Display; - xev.xclient.window := FLastTarget; - xev.xclient.message_type := xapplication.XdndDrop; - xev.xclient.format := 32; - - xev.xclient.data.l[0] := FSource.WinHandle; // from; - xev.xclient.data.l[1] := 0; // reserved - xev.xclient.data.l[2] := CurrentTime; // timestamp - xev.xclient.data.l[3] := 0; - xev.xclient.data.l[4] := 0; - - XSendEvent(xapplication.Display, FLastTarget, False, NoEventMask, @xev); + if FDropAccepted then + begin + xev.xany._type := X.ClientMessage; + xev.xany.display := xapplication.Display; + xev.xclient.window := FLastTarget; + xev.xclient.message_type := xapplication.XdndDrop; + xev.xclient.format := 32; + + xev.xclient.data.l[0] := FSource.WinHandle; // from; + xev.xclient.data.l[1] := 0; // reserved + xev.xclient.data.l[2] := CurrentTime; // timestamp + xev.xclient.data.l[3] := 0; + xev.xclient.data.l[4] := 0; + + XSendEvent(xapplication.Display, FLastTarget, False, NoEventMask, @xev); + end + else + SendDNDLeave(FLastTarget); FSource.MouseCursor := mcDefault; end; -- cgit v1.2.3-70-g09d2