mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-11 23:54:18 +00:00
UIViewComponentPeer: Enable non-full-screen views
This commit is contained in:
parent
04f2ca61e2
commit
51170e6073
1 changed files with 16 additions and 1 deletions
|
|
@ -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…
Add table
Add a link
Reference in a new issue