Skip to content

Commit

Permalink
[atv2/ios5.1] - don't add our window to the BRWindow list as a BRCont…
Browse files Browse the repository at this point in the history
…rol - 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!)
  • Loading branch information
Memphiz committed Jun 25, 2012
1 parent cc49941 commit 0c20b73
Showing 1 changed file with 9 additions and 29 deletions.
38 changes: 9 additions & 29 deletions xbmc/osx/atv2/XBMCController.mm
Expand Up @@ -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;
Expand All @@ -192,7 +175,6 @@ -(int)sleepTimeout;
//--------------------------------------------------------------
//--------------------------------------------------------------
@interface XBMCController (PrivateMethods)
UIWindow *m_window;
XBMCEAGLView *m_glView;
int m_screensaverTimeout;
int m_systemsleepTimeout;
Expand Down Expand Up @@ -221,8 +203,6 @@ - (void) applicationDidExit
{
[m_glView stopAnimation];

[[[[BRWindow windowList] objectAtIndex:0] content] _removeControl: m_window];
[m_window resignKeyWindow];
[self enableScreenSaver];
[self enableSystemSleep];

Expand Down Expand Up @@ -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;

Expand All @@ -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
Expand All @@ -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];
}
Expand All @@ -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];

Expand Down

0 comments on commit 0c20b73

Please sign in to comment.