carbon: use ssDouble, ssTriple and ssQuad in MouseUp handlers

git-svn-id: trunk@51575 -
This commit is contained in:
ondrej 2016-02-10 16:30:31 +00:00
parent 14cd12d46f
commit 9ff17efea7
3 changed files with 29 additions and 17 deletions

View File

@ -273,7 +273,12 @@ begin
Msg.XPos := P.X;
Msg.YPos := P.Y;
Msg.Keys := GetCarbonMsgKeyState;
case GetCarbonMouseClickCount(AEvent) of
2: Msg.Keys := msg.Keys or MK_DOUBLECLICK;
3: Msg.Keys := msg.Keys or MK_TRIPLECLICK;
4: Msg.Keys := msg.Keys or MK_QUADCLICK;
end;
LastMousePos := P;
if (AWidget is TCarbonControl) and

View File

@ -80,21 +80,6 @@ const
//
// helper functions used commonly
//
function GetClickCount: Integer;
var
ClickCount: UInt32;
begin
Result := 1;
if OSError(
GetEventParameter(AEvent, kEventParamClickCount, typeUInt32, nil,
SizeOf(ClickCount), nil, @ClickCount),
SName, SGetEvent, 'kEventParamClickCount') then Exit;
Result := Integer(ClickCount);
{debugln('GetClickCount ClickCount=',dbgs(ClickCount));}
end;
function GetMousePoint: TPoint;
var
MousePoint: HIPoint;
@ -167,7 +152,7 @@ const
{$ENDIF}
Msg := @AMsg;
ClickCount := GetClickCount;
ClickCount := GetCarbonMouseClickCount(AEvent);
MouseButton := GetCarbonMouseButton(AEvent);
MousePoint := GetMousePoint;

View File

@ -66,6 +66,7 @@ function VirtualKeyCodeToMac(AKey: Word): Word;
function GetBorderWindowAttrs(const ABorderStyle: TFormBorderStyle;
const ABorderIcons: TBorderIcons): WindowAttributes;
function GetCarbonMouseClickCount(AEvent: EventRef): Integer;
function GetCarbonMouseButton(AEvent: EventRef): Integer;
function GetCarbonMsgKeyState: PtrInt;
function GetCarbonShiftState: TShiftState;
@ -377,6 +378,27 @@ begin
kWindowCollapseBoxAttribute or kWindowFullZoomAttribute);
end;
{------------------------------------------------------------------------------
Name: GetCarbonMouseClickCount
Returns: The click count of mouse
------------------------------------------------------------------------------}
function GetCarbonMouseClickCount(AEvent: EventRef): Integer;
var
ClickCount: UInt32;
const
SName = 'CarbonWindow_MouseProc';
begin
Result := 1;
if OSError(
GetEventParameter(AEvent, kEventParamClickCount, typeUInt32, nil,
SizeOf(ClickCount), nil, @ClickCount),
SName, SGetEvent, 'kEventParamClickCount') then Exit;
Result := Integer(ClickCount);
{debugln('GetClickCount ClickCount=',dbgs(ClickCount));}
end;
{------------------------------------------------------------------------------
Name: GetCarbonMouseButton
Returns: The event state of mouse