diff options
author | Graeme Geldenhuys <graeme@mastermaths.co.za> | 2011-01-14 12:26:48 +0200 |
---|---|---|
committer | Graeme Geldenhuys <graeme@mastermaths.co.za> | 2011-01-14 12:26:48 +0200 |
commit | dbe37a31752bfe0d166715297944908cf11f385a (patch) | |
tree | d111d8a6505c773e8f3b385a1cb5251bd7d78299 /src | |
parent | 66b2641d24d48a706fece8f36937323ca263ce05 (diff) | |
download | fpGUI-dbe37a31752bfe0d166715297944908cf11f385a.tar.xz |
X11: OnDragEnter now has Sender and Source parameters populated
Sender: = the widget the mouse entered and that triggered the event
Source: = if whole DND occurs in same app, then Source is the
Widget the DND action started from.
Diffstat (limited to 'src')
-rw-r--r-- | src/corelib/x11/fpg_x11.pas | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/corelib/x11/fpg_x11.pas b/src/corelib/x11/fpg_x11.pas index ab41dc6b..4ccdd24e 100644 --- a/src/corelib/x11/fpg_x11.pas +++ b/src/corelib/x11/fpg_x11.pas @@ -412,6 +412,7 @@ type var xapplication: TfpgApplication; + uDragSource: TfpgWidget; { points to the Source widget of the DND when drop is inside the same app } const FPG_XDND_VERSION: culong = 4; // our supported XDND version @@ -1037,6 +1038,7 @@ var w: TfpgX11Window; wg: TfpgWidget; wg2: TfpgWidget; + swg: TfpgWidget; msgp: TfpgMessageParams; lDragEnterEvent: TfpgDragEnterEvent; lDropAction: TfpgDropAction; @@ -1127,7 +1129,11 @@ begin raise Exception.Create('fpGUI/X11: no mime types available for DND operation'); { TODO: We need to populate the Source parameter. } - wg.OnDragEnter(self, nil, lMimeList, lMimeChoice, lDropAction, lAccept); + if Assigned(Drag) then + swg := TfpgDrag(Drag).Source as TfpgWidget + else + swg := nil; + wg.OnDragEnter(wg, swg, lMimeList, lMimeChoice, lDropAction, lAccept); lMimeList.Free; FActionType := GetAtomFromDropAction(lDropAction); end; @@ -3424,9 +3430,14 @@ begin xev.xclient.data.l[4] := 0; XSendEvent(xapplication.Display, FLastTarget, False, NoEventMask, @xev); + + uDragSource := FSource as TfpgWidget; end else + begin SendDNDLeave(FLastTarget); + uDragSource := nil; + end; FSource.MouseCursor := mcDefault; end; |