From 2caae76ebb4133564eb760f9627b3ea97793225d Mon Sep 17 00:00:00 2001 From: rich2014 Date: Wed, 13 Sep 2023 22:17:04 +0800 Subject: [PATCH] Fix #40505: Merge branch 'lhelp/iphtml' --- components/turbopower_ipro/iphtml.pas | 16 ++++++++++++++-- lcl/interfaces/cocoa/cocoawscommon.pas | 3 +++ 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/components/turbopower_ipro/iphtml.pas b/components/turbopower_ipro/iphtml.pas index 7a8dac5326..3e42e4c91f 100644 --- a/components/turbopower_ipro/iphtml.pas +++ b/components/turbopower_ipro/iphtml.pas @@ -5502,15 +5502,21 @@ begin end; function TIpHtmlInternalPanel.DoMouseWheel(Shift: TShiftState; WheelDelta: Integer; MousePos: TPoint): Boolean; +const + WHEEL_DELTA = 120; var i: Integer; begin - Result:=inherited DoMouseWheel(Shift, WheelDelta, MousePos); - for i := 0 to Mouse.WheelScrollLines-1 do + inherited DoMouseWheel(Shift, WheelDelta, MousePos); + for i := abs(Mouse.WheelScrollLines * WheelDelta div WHEEL_DELTA) downto 0 do if WheelDelta < 0 then Perform(LM_VSCROLL, MAKELONG(SB_LINEDOWN, 0), 0) else Perform(LM_VSCROLL, MAKELONG(SB_LINEUP, 0), 0); + + // should always return true to confirm that + // the MouseWheel Event is handled by TIpHtmlInternalPanel + Result:= true; end; procedure TIpHtmlInternalPanel.Paint; @@ -5899,13 +5905,19 @@ end; procedure TIpHtmlInternalPanel.WMHScroll(var Message: TLMHScroll); begin if HScroll.Visible then + begin HScroll.ScrollMessage(Message); + Message.Result := 1; + end; end; procedure TIpHtmlInternalPanel.WMVScroll(var Message: TLMVScroll); begin if VScroll.Visible then + begin VScroll.ScrollMessage(Message); + Message.Result := 1; + end; end; procedure TIpHtmlInternalPanel.AsyncHotInvoke(data: ptrint); diff --git a/lcl/interfaces/cocoa/cocoawscommon.pas b/lcl/interfaces/cocoa/cocoawscommon.pas index 1bcb3689f3..ad0df68c6c 100644 --- a/lcl/interfaces/cocoa/cocoawscommon.pas +++ b/lcl/interfaces/cocoa/cocoawscommon.pas @@ -1355,8 +1355,11 @@ begin wheelDelta := round(-event.scrollingDeltaX * 120); end else + begin // Filter out empty events - See bug 28491 + Result := true; Exit; + end; // Filter scrolls that affect both X and Y towards whatever the last scroll was FLastWheelWasHorz := (Msg.Msg = LM_MOUSEHWHEEL);