diff options
author | Graeme Geldenhuys <graeme@mastermaths.co.za> | 2010-10-26 17:24:42 +0200 |
---|---|---|
committer | Graeme Geldenhuys <graeme@mastermaths.co.za> | 2010-10-26 17:24:42 +0200 |
commit | 60a7c674dc29a8f6fdbca1e163618d456a53a8d9 (patch) | |
tree | fcfb9a222b2ab3401f29cfaebce943894cb88959 /src/corelib | |
parent | 5201c2c160951a540cee54b678304ff94149401a (diff) | |
download | fpGUI-60a7c674dc29a8f6fdbca1e163618d456a53a8d9.tar.xz |
X11: make sure that AcceptDrops are True before we fire OnDragDrop
There was a bug where if the component had a OnDragDrop event
handler and AcceptDrops was False, it still triggered the event.
Not any more.
Diffstat (limited to 'src/corelib')
-rw-r--r-- | src/corelib/x11/fpg_x11.pas | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/src/corelib/x11/fpg_x11.pas b/src/corelib/x11/fpg_x11.pas index 08d721b4..0209af14 100644 --- a/src/corelib/x11/fpg_x11.pas +++ b/src/corelib/x11/fpg_x11.pas @@ -1189,6 +1189,13 @@ begin {$IFDEF DNDDEBUG} writeln('TfpgX11Application.HandleDNDselection'); {$ENDIF} + if FLastDropTarget <> 0 then { 0 would be first time in, so there is no last window } + begin + wg := FindWindowByHandle(FLastDropTarget) as TfpgWidget; + if not wg.AcceptDrops then + Exit; + end; + { do not get data yet, just see how much there is } XGetWindowProperty(FDisplay, ev.xselection.requestor, ev.xselection._property, 0, 0, @@ -1221,8 +1228,11 @@ begin if FLastDropTarget <> 0 then { 0 would be first time in, so there is no last window } begin wg := FindWindowByHandle(FLastDropTarget) as TfpgWidget; - if Assigned(wg.OnDragDrop) then - wg.OnDragDrop(nil, nil, FDropPos.X, FDropPos.Y, s); + if wg.AcceptDrops then + begin + if Assigned(wg.OnDragDrop) then + wg.OnDragDrop(nil, nil, FDropPos.X, FDropPos.Y, s); + end; end; {$IFDEF DNDDEBUG} writeln(' s = ', s); @@ -1730,7 +1740,7 @@ begin { one use is for message blockings for modal windows, or XDND etc. } X.ClientMessage: begin - w := FindWindowByBackupHandle(ev.xclient.window); + w := FindWindowByHandle(ev.xclient.window); if not Assigned(w) then ReportLostWindow(ev); |