|
|
|
@@ -661,6 +661,20 @@ Desktop::DisplayOrientation Desktop::getCurrentOrientation() const |
|
|
|
return Orientations::convertToJuce (orientation);
|
|
|
|
}
|
|
|
|
|
|
|
|
static Rectangle<int> getRecommendedWindowBounds()
|
|
|
|
{
|
|
|
|
// The most straightforward way of retrieving the screen area available to an iOS app
|
|
|
|
// seems to be to create a new window (which will take up all available space) and to
|
|
|
|
// query its frame.
|
|
|
|
struct TemporaryWindow
|
|
|
|
{
|
|
|
|
UIWindow* window = [[UIWindow alloc] init];
|
|
|
|
~TemporaryWindow() noexcept { [window release]; }
|
|
|
|
};
|
|
|
|
|
|
|
|
return convertToRectInt (TemporaryWindow{}.window.frame);
|
|
|
|
}
|
|
|
|
|
|
|
|
void Displays::findDisplays (float masterScale)
|
|
|
|
{
|
|
|
|
JUCE_AUTORELEASEPOOL
|
|
|
|
@@ -668,7 +682,8 @@ void Displays::findDisplays (float masterScale) |
|
|
|
UIScreen* s = [UIScreen mainScreen];
|
|
|
|
|
|
|
|
Display d;
|
|
|
|
d.userArea = d.totalArea = convertToRectInt ([s bounds]) / masterScale;
|
|
|
|
d.totalArea = convertToRectInt ([s bounds]) / masterScale;
|
|
|
|
d.userArea = getRecommendedWindowBounds() / masterScale;
|
|
|
|
d.isMain = true;
|
|
|
|
d.scale = masterScale * s.scale;
|
|
|
|
d.dpi = 160 * d.scale;
|
|
|
|
|