mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-22 11:59:18 +02:00
win32: fix r51573 #c57f581e7c: use ssDouble, ssTriple and ssQuad in MouseUp handlers. Solves issue #29738
git-svn-id: trunk@51717 -
This commit is contained in:
parent
7072474850
commit
4861906d3c
@ -370,9 +370,6 @@ type
|
|||||||
procedure DoMsgEnable;
|
procedure DoMsgEnable;
|
||||||
function DoMsgEraseBkgnd(var WinResult: LResult): Boolean;
|
function DoMsgEraseBkgnd(var WinResult: LResult): Boolean;
|
||||||
procedure DoMsgKeyDownUp(aMsg: Cardinal; var WinResult: LResult);
|
procedure DoMsgKeyDownUp(aMsg: Cardinal; var WinResult: LResult);
|
||||||
procedure DoMsgLButtonCommon;
|
|
||||||
procedure DoMsgLButtonDoubleClick;
|
|
||||||
procedure DoMsgLButtonDown;
|
|
||||||
procedure DoMsgMeasureItem;
|
procedure DoMsgMeasureItem;
|
||||||
procedure DoMsgMouseMove;
|
procedure DoMsgMouseMove;
|
||||||
procedure DoMsgMouseUpDownClick(aMsg: Cardinal);
|
procedure DoMsgMouseUpDownClick(aMsg: Cardinal);
|
||||||
@ -1494,56 +1491,69 @@ begin
|
|||||||
WinProcess := false;
|
WinProcess := false;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TWindowProcHelper.DoMsgLButtonCommon;
|
procedure TWindowProcHelper.DoMsgMouseUpDownClick(aMsg: Cardinal);
|
||||||
|
const
|
||||||
|
MouseDownToMessage: array[1..4{l, r, m, x}, 1..4{single..quad}] of LongWord =
|
||||||
|
((LM_LBUTTONDOWN, LM_LBUTTONDBLCLK, LM_LBUTTONTRIPLECLK, LM_LBUTTONQUADCLK),
|
||||||
|
(LM_RBUTTONDOWN, LM_RBUTTONDBLCLK, LM_RBUTTONTRIPLECLK, LM_RBUTTONQUADCLK),
|
||||||
|
(LM_MBUTTONDOWN, LM_MBUTTONDBLCLK, LM_MBUTTONTRIPLECLK, LM_MBUTTONQUADCLK),
|
||||||
|
(LM_XBUTTONDOWN, LM_XBUTTONDBLCLK, LM_XBUTTONTRIPLECLK, LM_XBUTTONQUADCLK));
|
||||||
|
var
|
||||||
|
CurButton: Integer;
|
||||||
|
IsMouseUp: Boolean;
|
||||||
begin
|
begin
|
||||||
MouseDownTime := GetTickCount64;
|
case aMsg of
|
||||||
NotifyUserInput := True;
|
LM_LBUTTONDOWN, LM_LBUTTONUP, LM_LBUTTONDBLCLK: CurButton := 1;
|
||||||
PLMsg := @LMMouse;
|
LM_RBUTTONDOWN, LM_RBUTTONUP, LM_RBUTTONDBLCLK: CurButton := 2;
|
||||||
with LMMouse Do
|
LM_MBUTTONDOWN, LM_MBUTTONUP, LM_MBUTTONDBLCLK: CurButton := 3;
|
||||||
|
LM_XBUTTONDOWN, LM_XBUTTONUP, LM_XBUTTONDBLCLK: CurButton := 4;
|
||||||
|
end;
|
||||||
|
|
||||||
|
if (MouseDownCount>=4) and (CurButton>0) then
|
||||||
|
MouseDownCount := MouseDownCount;
|
||||||
|
|
||||||
|
IsMouseUp := False;
|
||||||
|
case aMsg of
|
||||||
|
LM_LBUTTONDOWN, LM_RBUTTONDOWN, LM_MBUTTONDOWN, LM_XBUTTONDOWN:
|
||||||
begin
|
begin
|
||||||
case MouseDownCount of
|
|
||||||
2: Msg := LM_LBUTTONDBLCLK;
|
|
||||||
3: Msg := LM_LBUTTONTRIPLECLK;
|
|
||||||
4: Msg := LM_LBUTTONQUADCLK;
|
|
||||||
else Msg := LM_LBUTTONDOWN;
|
|
||||||
end;
|
|
||||||
XPos := GET_X_LPARAM(LParam);
|
|
||||||
YPos := GET_Y_LPARAM(LParam);
|
|
||||||
Keys := WParam;
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure TWindowProcHelper.DoMsgLButtonDoubleClick;
|
|
||||||
begin
|
|
||||||
// always within the time-window
|
|
||||||
if (MouseDownCount < 1) or (MouseDownCount > 4) then
|
|
||||||
MouseDownCount := 1;
|
|
||||||
inc(MouseDownCount);
|
|
||||||
DoMsgLButtonCommon;
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure TWindowProcHelper.DoMsgLButtonDown;
|
|
||||||
begin
|
|
||||||
if (MouseDownCount < 1) or (MouseDownCount > 4) then
|
|
||||||
MouseDownCount := 1;
|
|
||||||
if (MouseDownWindow = Window)
|
if (MouseDownWindow = Window)
|
||||||
|
and (MouseDownCountButton = CurButton)
|
||||||
and (GetTickCount64 - MouseDownTime <= GetDoubleClickTime)
|
and (GetTickCount64 - MouseDownTime <= GetDoubleClickTime)
|
||||||
and CheckMouseMovement then
|
and CheckMouseMovement then
|
||||||
inc(MouseDownCount)
|
inc(MouseDownCount)
|
||||||
else
|
else
|
||||||
MouseDownCount := 1;
|
MouseDownCount := 1;
|
||||||
|
MouseDownCountButton := CurButton;
|
||||||
MouseDownWindow := Window;
|
MouseDownWindow := Window;
|
||||||
GetCursorPos(MouseDownPos);
|
GetCursorPos(MouseDownPos);
|
||||||
DoMsgLButtonCommon;
|
end;
|
||||||
end;
|
LM_LBUTTONUP, LM_RBUTTONUP, LM_MBUTTONUP, LM_XBUTTONUP:
|
||||||
|
begin
|
||||||
|
IsMouseUp := True;
|
||||||
|
if (MouseDownCountButton <> CurButton) then
|
||||||
|
MouseDownCount := 1;
|
||||||
|
end;
|
||||||
|
LM_LBUTTONDBLCLK, LM_RBUTTONDBLCLK, LM_MBUTTONDBLCLK, LM_XBUTTONDBLCLK:
|
||||||
|
begin
|
||||||
|
// always within the time-window
|
||||||
|
if (MouseDownCount < 1) then
|
||||||
|
MouseDownCount := 1;
|
||||||
|
inc(MouseDownCount);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TWindowProcHelper.DoMsgMouseUpDownClick(aMsg: Cardinal);
|
if (MouseDownCount < 1) or (MouseDownCount > 4) then
|
||||||
begin
|
MouseDownCount := 1;
|
||||||
|
MouseDownTime := GetTickCount64;
|
||||||
NotifyUserInput := True;
|
NotifyUserInput := True;
|
||||||
PLMsg := @LMMouse;
|
PLMsg := @LMMouse;
|
||||||
with LMMouse Do
|
with LMMouse do
|
||||||
begin
|
begin
|
||||||
Msg := aMsg;
|
if IsMouseUp then
|
||||||
|
Msg := aMsg
|
||||||
|
else
|
||||||
|
Msg := MouseDownToMessage[MouseDownCountButton, MouseDownCount];
|
||||||
|
|
||||||
XPos := GET_X_LPARAM(LParam);
|
XPos := GET_X_LPARAM(LParam);
|
||||||
YPos := GET_Y_LPARAM(LParam);
|
YPos := GET_Y_LPARAM(LParam);
|
||||||
Keys := WParam;
|
Keys := WParam;
|
||||||
@ -2155,8 +2165,8 @@ begin
|
|||||||
LMessage.WParam := WParam;
|
LMessage.WParam := WParam;
|
||||||
end;
|
end;
|
||||||
//TODO:LM_KILLCHAR,LM_KILLWORD,LM_KILLLINE
|
//TODO:LM_KILLCHAR,LM_KILLWORD,LM_KILLLINE
|
||||||
WM_LBUTTONDBLCLK: DoMsgLButtonDoubleClick;
|
WM_LBUTTONDBLCLK: DoMsgMouseUpDownClick(LM_LBUTTONDBLCLK);
|
||||||
WM_LBUTTONDOWN: DoMsgLButtonDown;
|
WM_LBUTTONDOWN: DoMsgMouseUpDownClick(LM_LBUTTONDOWN);
|
||||||
WM_LBUTTONUP: DoMsgMouseUpDownClick(LM_LBUTTONUP);
|
WM_LBUTTONUP: DoMsgMouseUpDownClick(LM_LBUTTONUP);
|
||||||
WM_MBUTTONDBLCLK: DoMsgMouseUpDownClick(LM_MBUTTONDBLCLK);
|
WM_MBUTTONDBLCLK: DoMsgMouseUpDownClick(LM_MBUTTONDBLCLK);
|
||||||
WM_MBUTTONDOWN: DoMsgMouseUpDownClick(LM_MBUTTONDOWN);
|
WM_MBUTTONDOWN: DoMsgMouseUpDownClick(LM_MBUTTONDOWN);
|
||||||
|
@ -266,6 +266,7 @@ type
|
|||||||
|
|
||||||
var
|
var
|
||||||
MouseDownCount: Integer;
|
MouseDownCount: Integer;
|
||||||
|
MouseDownCountButton: Byte; // 1 left, 2 right, 3 middle, 4 x
|
||||||
MouseDownTime: QWord;
|
MouseDownTime: QWord;
|
||||||
MouseDownPos: TPoint;
|
MouseDownPos: TPoint;
|
||||||
MouseDownWindow: HWND = 0;
|
MouseDownWindow: HWND = 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user