From 5dc39f028a750a1e059b8c45d2f8c09fc40e7f57 Mon Sep 17 00:00:00 2001 From: wp_xxyyzz Date: Wed, 23 Jun 2021 20:25:47 +0000 Subject: [PATCH] SpkToolbar: Fix scaling of toolbar height in cocoa. Patch by ChristianH, forum https://forum.lazarus.freepascal.org/index.php/topic,55123.msg409712/topicseen.html git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@8056 8e941d3f-bd1b-0410-a28a-d453659cc2b4 --- components/spktoolbar/SpkToolbar/SpkToolbar.pas | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/components/spktoolbar/SpkToolbar/SpkToolbar.pas b/components/spktoolbar/SpkToolbar/SpkToolbar.pas index 6437d8865..91c880dbc 100644 --- a/components/spktoolbar/SpkToolbar/SpkToolbar.pas +++ b/components/spktoolbar/SpkToolbar/SpkToolbar.pas @@ -2197,6 +2197,7 @@ var MenuButtonWidth: Integer; AdditionalPadding: Boolean; MenuButtonTextWidth: Integer; + ToolbarHeight: Integer; {$IFDEF LCLCocoa} scalefactor: Double; {$ENDIF} @@ -2208,14 +2209,15 @@ begin FBuffer.Free; FBuffer := TBitmap.Create; + ToolbarHeight := CalcToolbarHeight; {$IFDEF LCLCocoa} scalefactor := GetCanvasScaleFactor; - FBuffer.SetSize(round(scaleFactor*Width), round(scaleFactor*CalcToolbarHeight)); + FBuffer.SetSize(round(scaleFactor*Width), round(scaleFactor*ToolbarHeight)); CGContextScaleCTM(TCocoaBitmapContext(FBuffer.Canvas.Handle).CGContext, scaleFactor, scaleFactor); {$ELSE} - FBuffer.SetSize(Width, CalcToolbarHeight); + FBuffer.SetSize(Width, ToolbarHeight); {$ENDIF} - SetBounds(Left, Top, FBuffer.Width, FBuffer.Height); + SetBounds(Left, Top, FBuffer.Width, ToolbarHeight); // *** Tabs ***