summaryrefslogtreecommitdiff
path: root/src/corelib/x11
diff options
context:
space:
mode:
authorGraeme Geldenhuys <graemeg@gmail.com>2010-10-28 00:37:56 +0200
committerGraeme Geldenhuys <graemeg@gmail.com>2010-10-28 00:37:56 +0200
commit1313284b26d8f651cb0e7bde11983ceefd1f1879 (patch)
treec36ebb199c361452db6b276da18ea799cb77b265 /src/corelib/x11
parent8d6b714570798fadc3f15bbc67b3a53900540069 (diff)
downloadfpGUI-1313284b26d8f651cb0e7bde11983ceefd1f1879.tar.xz
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.
Diffstat (limited to 'src/corelib/x11')
-rw-r--r--src/corelib/x11/fpg_x11.pas36
1 files changed, 22 insertions, 14 deletions
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;