From 22cae6189cf9fbc3b145183338000d7bdd870c0e Mon Sep 17 00:00:00 2001 From: Twinaphex Date: Thu, 5 Nov 2015 22:11:46 +0100 Subject: [PATCH] More backwards compatible version of PR --- ui/drivers/cocoa/cocoa_common.m | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/ui/drivers/cocoa/cocoa_common.m b/ui/drivers/cocoa/cocoa_common.m index 7b4b9f9b94..4c4558ccfe 100644 --- a/ui/drivers/cocoa/cocoa_common.m +++ b/ui/drivers/cocoa/cocoa_common.m @@ -109,12 +109,26 @@ void *glkitview_init(void); - (void)viewWillLayoutSubviews { + float width = 0.0f, height = 0.0f, tenpctw, tenpcth; + RAScreen *screen = (RAScreen*)get_chosen_screen(); UIInterfaceOrientation orientation = self.interfaceOrientation; CGRect screenSize = [[UIScreen mainScreen] bounds]; - float width = ((int)orientation < 3) ? CGRectGetWidth(screenSize) : CGRectGetHeight(screenSize); - float height = ((int)orientation < 3) ? CGRectGetHeight(screenSize) : CGRectGetWidth(screenSize); - float tenpctw = width / 10.0f; - float tenpcth = height / 10.0f; + SEL selector = NSSelectorFromString(BOXSTRING("coordinateSpace")); + + if ([screen respondsToSelector:selector]) + { + screenSize = [[screen coordinateSpace] bounds]; + width = CGRectGetWidth(screenSize); + height = CGRectGetHeight(screenSize); + } + else + { + width = ((int)orientation < 3) ? CGRectGetWidth(screenSize) : CGRectGetHeight(screenSize); + height = ((int)orientation < 3) ? CGRectGetHeight(screenSize) : CGRectGetWidth(screenSize); + } + + tenpctw = width / 10.0f; + tenpcth = height / 10.0f; g_pause_indicator_view.frame = CGRectMake(tenpctw * 4.0f, 0.0f, tenpctw * 2.0f, tenpcth); [g_pause_indicator_view viewWithTag:1].frame = CGRectMake(0, 0, tenpctw * 2.0f, tenpcth);