From 0c20b73f0a070386a3688df6f314b9e4a4867ac4 Mon Sep 17 00:00:00 2001 From: Memphiz Date: Sat, 31 Mar 2012 16:39:15 +0200 Subject: [PATCH] [atv2/ios5.1] - don't add our window to the BRWindow list as a BRControl - iOS 5.1 doesn't like that. Instead get rid of the UIWindow and add the eagl layer as a sublayer of backrows root layer. This will also take care of the different resolutions which are possible with ios5 and above. (should work for all ios atv2 versions!) --- xbmc/osx/atv2/XBMCController.mm | 38 ++++++++------------------------- 1 file changed, 9 insertions(+), 29 deletions(-) diff --git a/xbmc/osx/atv2/XBMCController.mm b/xbmc/osx/atv2/XBMCController.mm index 1c1447a06363a..f268868365677 100644 --- a/xbmc/osx/atv2/XBMCController.mm +++ b/xbmc/osx/atv2/XBMCController.mm @@ -160,23 +160,6 @@ XBMCController *g_xbmcController; //-------------------------------------------------------------- -//-------------------------------------------------------------- -@implementation UIWindow (limneos) --(id)parent { return nil; } --(void)removeFromParent {} --(BOOL)active { return NO; } --(void)controlWasActivated {} --(void)controlWasDeactivated {} -@end - -@implementation UIView (limneos) --(id)parent { return nil; } --(BOOL)active { return NO; } --(void)removeFromParent {} --(void)controlWasActivated {} --(void)controlWasDeactivated {} -@end - // so we don't have to include AppleTV.frameworks/PrivateHeaders/ATVSettingsFacade.h @interface ATVSettingsFacade : BRSettingsFacade {} -(int)screenSaverTimeout; @@ -192,7 +175,6 @@ -(int)sleepTimeout; //-------------------------------------------------------------- //-------------------------------------------------------------- @interface XBMCController (PrivateMethods) -UIWindow *m_window; XBMCEAGLView *m_glView; int m_screensaverTimeout; int m_systemsleepTimeout; @@ -221,8 +203,6 @@ - (void) applicationDidExit { [m_glView stopAnimation]; - [[[[BRWindow windowList] objectAtIndex:0] content] _removeControl: m_window]; - [m_window resignKeyWindow]; [self enableScreenSaver]; [self enableSystemSleep]; @@ -278,10 +258,11 @@ - (id) init selector: @selector(observeDefaultCenterStuff:) name: nil object: nil]; - - m_window = [[UIWindow alloc] initWithFrame:[BRWindow interfaceFrame]]; - m_glView = [[XBMCEAGLView alloc] initWithFrame:m_window.bounds]; - [m_window addSubview:m_glView]; + + CGRect interfaceFrame = [BRWindow interfaceFrame]; + NSLog(@"XBMC: interfaceFrame: %f, %f, %f, %f", interfaceFrame.origin.x, interfaceFrame.origin.y, interfaceFrame.size.width, interfaceFrame.size.height); + //init glview with interfaceframe (might be more the resolution - ios scales for us) + m_glView = [[XBMCEAGLView alloc] initWithFrame:interfaceFrame]; g_xbmcController = self; @@ -293,7 +274,6 @@ - (void)dealloc //NSLog(@"%s", __PRETTY_FUNCTION__); [m_glView stopAnimation]; [m_glView release]; - [m_window release]; NSNotificationCenter *center; // take us off the default center for our app @@ -311,8 +291,9 @@ - (void)controlWasActivated [self disableSystemSleep]; [self disableScreenSaver]; - [m_window makeKeyAndVisible]; - [[[[BRWindow windowList] objectAtIndex:0] content] addControl: m_window]; + + //inject our gles layer into the backrow root layer + [[BRWindow rootLayer] addSublayer:m_glView.layer]; [m_glView startAnimation]; } @@ -322,9 +303,8 @@ - (void)controlWasDeactivated NSLog(@"XBMC was forced by FrontRow to exit via controlWasDeactivated"); [m_glView stopAnimation]; + [m_glView.layer removeFromSuperlayer]; - [[[[BRWindow windowList] objectAtIndex:0] content] _removeControl: m_window]; - [m_window resignKeyWindow]; [self enableScreenSaver]; [self enableSystemSleep];