Enumerate screens and calculate maximum screen scaling.

This commit is contained in:
bubnikv 2019-05-17 18:40:13 +02:00 committed by Vojtech Kral
parent 8c862ade29
commit 5161dc43d6
2 changed files with 12 additions and 0 deletions

View file

@ -6,6 +6,7 @@ namespace GUI {
#if __APPLE__
extern bool mac_dark_mode();
extern double mac_max_scaling_factor();
#endif

View file

@ -15,6 +15,17 @@ bool mac_dark_mode()
}
double mac_max_scaling_factor()
{
double scaling = 1.;
if ([NSScreen screens] == nil) {
scalign = [[NSScreen mainScreen] backingScaleFactor];
} else {
for (int i = 0; i < [[NSScreen screens] count]; ++ i)
scaling = std::max<double>(scaling, [[[NSScreen screens] objectAtIndex:0] backingScaleFactor]);
}
return scalign;
}
}
}