lcl: don't call GetCursorPos() twice while initializing Drag/Dock operation. Use the first time retrieved value.

git-svn-id: trunk@42626 -
This commit is contained in:
paul 2013-09-06 02:08:15 +00:00
parent 9178ca6047
commit 0032f227a7

View File

@ -98,6 +98,8 @@ type
procedure DragStart(AControl: TControl; AImmediate: Boolean; AThreshold: Integer); override;
procedure DragMove(APosition: TPoint); override;
procedure DragStop(ADropped: Boolean); override;
property StartPosition: TPoint read FStartPosition;
end;
@ -129,17 +131,13 @@ end;
constructor TDragPerformer.Create(AManager: TDragManagerDefault; AControl: TControl);
//Start a drag operation, if not already running
var
p: TPoint;
begin
inherited Create(AManager, AControl);
AControl.DoStartDrag(FDragObject);
if FDragObject = nil then
FDragObject := TDragControlObject.AutoCreate(AControl);
GetCursorPos(p);
FDragObject.DragPos := p;
FDragObject.DragPos := AManager.StartPosition;
SetCaptureControl(AControl);
end;
@ -270,16 +268,13 @@ end;
constructor TDockPerformer.Create(AManager: TDragManagerDefault; AControl: TControl);
//Start a drag operation, if not already running
var
APoint: TPoint;
begin
inherited Create(AManager, AControl);
AControl.DoStartDock(TDragObject(FDockObject));
if FDockObject = nil then
FDockObject := TDragDockObject.AutoCreate(AControl);
GetCursorPos(APoint);
FDockObject.InitDock(APoint);
FDockObject.InitDock(AManager.StartPosition);
// we are tracking capture change to stop drag/dock is happen
SetCaptureControl(AControl);
end;