mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-15 17:29:40 +02:00
LCL, Darwin (MacOSX): fix DPI values on LCL-level. Keep WidgetSet-DPI value original. Issue #31037
git-svn-id: trunk@54453 -
This commit is contained in:
parent
431b58c609
commit
20a9ecf1d5
@ -437,6 +437,14 @@ begin
|
||||
raise Exception.Create(rsNoWidgetSet);
|
||||
end;
|
||||
WidgetSet.AppInit(ScreenInfo);
|
||||
{$IFDEF DARWIN}
|
||||
// Mac OSX (all WS) return 72 PPI for 100% scaling.
|
||||
// The LCL needs 96 PPI for correct
|
||||
// a) font size scaling (Height/Size ratio)
|
||||
// b) High-DPI scaling (Application.Scaled)
|
||||
ScreenInfo.PixelsPerInchX := MulDiv(ScreenInfo.PixelsPerInchX, 96, 72);
|
||||
ScreenInfo.PixelsPerInchY := MulDiv(ScreenInfo.PixelsPerInchY, 96, 72);
|
||||
{$ENDIF}
|
||||
ScreenInfo.Initialized := True;
|
||||
Screen.UpdateScreen;
|
||||
// set that we are initialized => all exceptions will be handled by our HandleException
|
||||
|
@ -1455,8 +1455,8 @@ begin
|
||||
case Index of
|
||||
LOGPIXELSX,
|
||||
LOGPIXELSY:
|
||||
// logical is always 96 dpi (to correspond with 100% scaling on Windows), although physical can differ
|
||||
Result := 96;
|
||||
// logical is allways 72 dpi, although physical can differ
|
||||
Result := 72; // TODO: test scaling and magnification
|
||||
BITSPIXEL: Result := CGDisplayBitsPerPixel(CGMainDisplayID);
|
||||
else
|
||||
DebugLn('TCarbonWidgetSet.GetDeviceCaps TODO Index: ' + DbgS(Index));
|
||||
|
@ -1875,9 +1875,9 @@ begin
|
||||
// todo: change implementation for printers
|
||||
case Index of
|
||||
HORZSIZE:
|
||||
Result := Round(NSScreen.mainScreen.frame.size.width / 96 * 25.4);
|
||||
Result := Round(NSScreen.mainScreen.frame.size.width / 72 * 25.4);
|
||||
VERTSIZE:
|
||||
Result := Round(NSScreen.mainScreen.frame.size.height / 96 * 25.4);
|
||||
Result := Round(NSScreen.mainScreen.frame.size.height / 72 * 25.4);
|
||||
HORZRES:
|
||||
Result := Round(NSScreen.mainScreen.frame.size.width);
|
||||
BITSPIXEL:
|
||||
@ -1887,9 +1887,9 @@ begin
|
||||
SIZEPALETTE:
|
||||
Result := 0;
|
||||
LOGPIXELSX:
|
||||
Result := 96;
|
||||
Result := 72;
|
||||
LOGPIXELSY:
|
||||
Result := 96;
|
||||
Result := 72;
|
||||
VERTRES:
|
||||
Result := Round(NSScreen.mainScreen.frame.size.height);
|
||||
NUMRESERVED:
|
||||
|
Loading…
Reference in New Issue
Block a user