From 9ff17efea785041b8d2c8de0355c53f98e3f8561 Mon Sep 17 00:00:00 2001 From: ondrej Date: Wed, 10 Feb 2016 16:30:31 +0000 Subject: [PATCH] carbon: use ssDouble, ssTriple and ssQuad in MouseUp handlers git-svn-id: trunk@51575 - --- lcl/interfaces/carbon/carbonprivatecommon.inc | 7 +++++- lcl/interfaces/carbon/carbonprivatewindow.inc | 17 +------------- lcl/interfaces/carbon/carbonproc.pp | 22 +++++++++++++++++++ 3 files changed, 29 insertions(+), 17 deletions(-) diff --git a/lcl/interfaces/carbon/carbonprivatecommon.inc b/lcl/interfaces/carbon/carbonprivatecommon.inc index ed0dc91bd7..1aaaa3984b 100644 --- a/lcl/interfaces/carbon/carbonprivatecommon.inc +++ b/lcl/interfaces/carbon/carbonprivatecommon.inc @@ -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 diff --git a/lcl/interfaces/carbon/carbonprivatewindow.inc b/lcl/interfaces/carbon/carbonprivatewindow.inc index 685b2464d5..ea148c4d1c 100644 --- a/lcl/interfaces/carbon/carbonprivatewindow.inc +++ b/lcl/interfaces/carbon/carbonprivatewindow.inc @@ -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; diff --git a/lcl/interfaces/carbon/carbonproc.pp b/lcl/interfaces/carbon/carbonproc.pp index 5342880f47..bc6607eccb 100644 --- a/lcl/interfaces/carbon/carbonproc.pp +++ b/lcl/interfaces/carbon/carbonproc.pp @@ -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