You've already forked CEF4Delphi
mirror of
https://github.com/salvadordf/CEF4Delphi.git
synced 2025-11-23 21:34:53 +02:00
Improved functions to read the screen scale in FMX
Fixed FMXExternalPumpBrowser2 initialization issue in Linux
This commit is contained in:
@@ -2369,7 +2369,8 @@ var
|
||||
{$ELSE}
|
||||
{$IFDEF FMX}
|
||||
var
|
||||
TempService: IFMXScreenService;
|
||||
TempService : IFMXScreenService;
|
||||
TempWidth, TempWidthMM : integer;
|
||||
{$ENDIF}
|
||||
{$ENDIF}
|
||||
begin
|
||||
@@ -2396,13 +2397,24 @@ begin
|
||||
else
|
||||
Result := USER_DEFAULT_SCREEN_DPI;
|
||||
{$ELSE}
|
||||
Result := -1;
|
||||
if TPlatformServices.Current.SupportsPlatformService(IFMXScreenService, TempService) then
|
||||
Result := round(TempService.GetScreenScale * USER_DEFAULT_SCREEN_DPI)
|
||||
else
|
||||
Result := round(TempService.GetScreenScale * USER_DEFAULT_SCREEN_DPI);
|
||||
|
||||
if (Result < 0) then
|
||||
begin
|
||||
Result := round(gdk_screen_get_resolution(gdk_screen_get_default));
|
||||
|
||||
if (Result < 0) then
|
||||
Result := round(gdk_screen_width / (gdk_screen_width_mm / 25.4));
|
||||
begin
|
||||
TempWidthMM := gdk_screen_width_mm;
|
||||
TempWidth := gdk_screen_width;
|
||||
|
||||
if (TempWidthMM > 0) and (TempWidth > 0) then
|
||||
Result := round(TempWidth / (TempWidthMM / 25.4))
|
||||
else
|
||||
Result := USER_DEFAULT_SCREEN_DPI;
|
||||
end;
|
||||
end;
|
||||
{$ENDIF}
|
||||
{$ENDIF}
|
||||
|
||||
Reference in New Issue
Block a user