From 60a7c674dc29a8f6fdbca1e163618d456a53a8d9 Mon Sep 17 00:00:00 2001 From: Graeme Geldenhuys Date: Tue, 26 Oct 2010 17:24:42 +0200 Subject: 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. --- src/corelib/x11/fpg_x11.pas | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'src/corelib/x11') 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); -- cgit v1.2.3-70-g09d2