Browse Source

UIViewComponentPeer: Enable non-full-screen views

tags/2021-05-28
reuk 5 years ago
parent
commit
51170e6073
No known key found for this signature in database GPG Key ID: 9ADCD339CFC98A11
1 changed files with 16 additions and 1 deletions
  1. +16
    -1
      modules/juce_gui_basics/native/juce_ios_Windowing.mm

+ 16
- 1
modules/juce_gui_basics/native/juce_ios_Windowing.mm View File

@@ -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;


Loading…
Cancel
Save