Skip to content

Commit

Permalink
Merge pull request #16719 from kambala-decapitator/ios-notch-fix
Browse files Browse the repository at this point in the history
[ios] fix overlapping drawing surface with the "safe area"
  • Loading branch information
kambala-decapitator committed Oct 6, 2019
2 parents d5daebb + 1662513 commit 3a1154e
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 3 deletions.
4 changes: 1 addition & 3 deletions xbmc/platform/darwin/ios-common/IOSKeyboard.mm
Expand Up @@ -38,9 +38,7 @@
return false;

// assume we are only drawn on the mainscreen ever!
UIScreen* pCurrentScreen = [UIScreen mainScreen];
CGRect keyboardFrame =
CGRectMake(0, 0, pCurrentScreen.bounds.size.width, pCurrentScreen.bounds.size.height);
auto keyboardFrame = [g_xbmcController fullscreenSubviewFrame];

//create the keyboardview
m_impl->g_pIosKeyboard = [[KeyboardView alloc] initWithFrame:keyboardFrame];
Expand Down
1 change: 1 addition & 0 deletions xbmc/platform/darwin/ios/XBMCController.h
Expand Up @@ -66,6 +66,7 @@ typedef enum
- (void) setIOSNowPlayingInfo:(NSDictionary *)info;
- (void) sendKey: (XBMCKey) key;
- (void) observeDefaultCenterStuff: (NSNotification *) notification;
- (CGRect)fullscreenSubviewFrame;
- (void) setFramebuffer;
- (bool) presentFramebuffer;
- (CGSize) getScreenSize;
Expand Down
15 changes: 15 additions & 0 deletions xbmc/platform/darwin/ios/XBMCController.mm
Expand Up @@ -577,6 +577,12 @@ - (void)viewWillAppear:(BOOL)animated
[super viewWillAppear:animated];
}
//--------------------------------------------------------------
- (void)viewSafeAreaInsetsDidChange NS_AVAILABLE_IOS(11_0)
{
[super viewSafeAreaInsetsDidChange];
m_glView.frame = [self fullscreenSubviewFrame];
}
//--------------------------------------------------------------
-(void) viewDidAppear:(BOOL)animated
{
[super viewDidAppear:animated];
Expand Down Expand Up @@ -633,6 +639,15 @@ - (void)viewDidUnload
[super viewDidUnload];
}
//--------------------------------------------------------------
- (CGRect)fullscreenSubviewFrame
{
auto rect = self.view.bounds;
if (@available(ios 11.0, *))
return UIEdgeInsetsInsetRect(rect, self.view.safeAreaInsets);
else
return rect;
}
//--------------------------------------------------------------
- (void) setFramebuffer
{
[m_glView setFramebuffer];
Expand Down

0 comments on commit 3a1154e

Please sign in to comment.