From fc4c35c78e307e9a62a813190c2604ddb2857a2e Mon Sep 17 00:00:00 2001 From: dmitry Date: Mon, 26 Jul 2010 21:40:56 +0000 Subject: [PATCH] carbon: fix incorrect mouseup emulation. (mouseup was reported even if mousebutton was not released) git-svn-id: trunk@26842 - --- lcl/interfaces/carbon/carbonprivatecommon.inc | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lcl/interfaces/carbon/carbonprivatecommon.inc b/lcl/interfaces/carbon/carbonprivatecommon.inc index 0e1b71bcfc..b8bcb4eeb1 100644 --- a/lcl/interfaces/carbon/carbonprivatecommon.inc +++ b/lcl/interfaces/carbon/carbonprivatecommon.inc @@ -227,6 +227,7 @@ begin ActionUPP := NewControlActionUPP(@CarbonCommon_TrackProgress); try + if OSError( SetEventParameter(AEvent, kEventParamControlAction, typeControlActionUPP, SizeOf(ActionUPP), @ActionUPP), SName, SSetEvent, SControlAction) then Exit; @@ -234,14 +235,17 @@ begin // this does not return until the mouse is released LastMousePos := AWidget.GetMousePos; Result := CallNextEventHandler(ANextHandler, AEvent); - if OSError( SetEventParameter(AEvent, kEventParamControlAction, typeControlActionUPP, SizeOf(OldActionUPP), @OldActionUPP), SName, SSetEvent, SControlAction) then Exit; finally DisposeControlActionUPP(ActionUPP); end; - + + // if button state has not changed, then there's no need to emulate mouse up + // because the button has not yet been released! + if MouseButton=GetCurrentEventButtonState then Exit; + FillChar(Msg, SizeOf(Msg), 0); if (MouseButton >= Low(MSGKIND)) and (MouseButton <= High(MSGKIND)) then