diff options
Diffstat (limited to 'src/plugins/platforms/ios')
-rw-r--r-- | src/plugins/platforms/ios/qiosviewcontroller.mm | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/src/plugins/platforms/ios/qiosviewcontroller.mm b/src/plugins/platforms/ios/qiosviewcontroller.mm index 782c98f66e..7079cd73eb 100644 --- a/src/plugins/platforms/ios/qiosviewcontroller.mm +++ b/src/plugins/platforms/ios/qiosviewcontroller.mm @@ -80,6 +80,41 @@ window->handle()->setWindowState(window->windowState()); } +// Even if the root view controller has both wantsFullScreenLayout and +// extendedLayoutIncludesOpaqueBars enabled, iOS will still push the root +// view down 20 pixels (and shrink the view accordingly) when the in-call +// statusbar is active (instead of updating the topLayoutGuide). Since +// we treat the root view controller as our screen, we want to reflect +// the in-call statusbar as a change in available geometry, not in screen +// geometry. To simplify the screen geometry mapping code we reset the +// view modifications that iOS does and take the statusbar height +// explicitly into account in QIOSScreen::updateProperties(). + +- (void)setFrame:(CGRect)newFrame +{ + [super setFrame:CGRectMake(0, 0, CGRectGetWidth(newFrame), CGRectGetHeight(self.window.bounds))]; +} + +- (void)setBounds:(CGRect)newBounds +{ + CGRect transformedWindowBounds = [self convertRect:self.window.bounds fromView:self.window]; + [super setBounds:CGRectMake(0, 0, CGRectGetWidth(newBounds), CGRectGetHeight(transformedWindowBounds))]; +} + +- (void)setCenter:(CGPoint)newCenter +{ + Q_UNUSED(newCenter); + [super setCenter:self.window.center]; +} + +- (void)didMoveToWindow +{ + // The initial frame computed during startup may happen before the view has + // a window, meaning our calculations above will be wrong. We ensure that the + // frame is set correctly once we have a window to base our calulations on. + [self setFrame:self.window.bounds]; +} + @end // ------------------------------------------------------------------------- |