From 64aab7afc8e80e00cd678ff0b151222b8b2b5568 Mon Sep 17 00:00:00 2001 From: rich2014 Date: Tue, 1 Aug 2023 22:49:13 +0800 Subject: [PATCH] Cocoa: fix cursor calculation issue in TabControl In fact, it is related to the container control with LayoutDelta. currently, only TabControl in Cocoa is affected by this bug. --- lcl/interfaces/cocoa/cocoawscommon.pas | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lcl/interfaces/cocoa/cocoawscommon.pas b/lcl/interfaces/cocoa/cocoawscommon.pas index 92cbf1e0fc..bf4e90fedb 100644 --- a/lcl/interfaces/cocoa/cocoawscommon.pas +++ b/lcl/interfaces/cocoa/cocoawscommon.pas @@ -491,7 +491,12 @@ begin cr := NSView(Owner).lclClientFrame; PtInClient.x := Round({PtInBounds.x - }pt.x - cr.Left); PtInClient.y := Round({PtInBounds.y - }pt.y - cr.Top); + + // child ctrls need not LayoutDelta, + cr := NSView(Owner).lclGetFrameToLayoutDelta; PtForChildCtrls := PtInClient; + PtForChildCtrls.X := PtForChildCtrls.X + cr.Left; + PtForChildCtrls.Y := PtForChildCtrls.Y + cr.Top; es := NSView(Owner).enclosingScrollView; if Assigned(es) and (es.documentView = NSView(Owner)) then begin