customdrawn-android and x11: Implements proper targeting for MouseUp

git-svn-id: trunk@33883 -
This commit is contained in:
sekelsenmat 2011-12-01 09:24:36 +00:00
parent af910e4d3b
commit 7a4de2176d
4 changed files with 14 additions and 2 deletions

View File

@ -21,6 +21,8 @@ type
Window: X.TWindow;
LCLControl: TWinControl;
Children: TFPList; // of TCDWinControl;
//
LastMouseDownControl: TWinControl; // Stores the control which should receive the next MouseUp
// Used and valid only during event processing
XEvent: PXEvent;
// X11 extra objects

View File

@ -54,9 +54,14 @@ begin
lEventPos := FormPosToControlPos(lTarget, Round(X), Round(Y));
case action of
ACTION_DOWN: LCLSendMouseDownMsg(lTarget, lEventPos.X, lEventPos.Y, mbLeft, []);
ACTION_DOWN:
begin
lCurForm.LastMouseDownControl := lTarget;
LCLSendMouseDownMsg(lTarget, lEventPos.X, lEventPos.Y, mbLeft, []);
end;
ACTION_UP:
begin
if lCurForm.LastMouseDownControl <> nil then lTarget := lCurForm.LastMouseDownControl;
LCLSendMouseUpMsg(lTarget, lEventPos.X, lEventPos.Y, mbLeft, []);
LCLSendClickedMsg(lTarget);
end;

View File

@ -32,6 +32,8 @@ type
public
LCLForm: TCustomForm;
Children: TFPList; // of TCDWinControl;
//
LastMouseDownControl: TWinControl; // Stores the control which should receive the next MouseUp
// painting objects
Image: TLazIntfImage;
Canvas: TLazCanvas;

View File

@ -527,6 +527,7 @@ var
lTarget: TWinControl;
begin
lTarget := FindControlWhichReceivedEvent(TCustomForm(AWinControl), AWindowInfo.Children, Event.x, Event.y);
AWindowInfo.LastMouseDownControl := lTarget;
if XButtonToMouseButton(Event.button, MouseButton) then
begin
@ -562,6 +563,8 @@ var
lTarget: TWinControl;
lEventPos: TPoint;
begin
lTarget := AWindowInfo.LastMouseDownControl;
if lTarget = nil then
lTarget := FindControlWhichReceivedEvent(TCustomForm(AWinControl), AWindowInfo.Children, Event.x, Event.y);
lEventPos := FormPosToControlPos(lTarget, Event.x, Event.y);