(OSX/iOS) get_chosen_screen buildfixes

This commit is contained in:
Twinaphex 2015-11-14 22:25:48 +01:00
parent d3037ed839
commit 5fc267d24a
3 changed files with 10 additions and 8 deletions

View File

@ -120,7 +120,7 @@ void cocoagl_bind_game_view_fbo(void)
}
#endif
static RAScreen* get_chosen_screen(void)
void *get_chosen_screen(void)
{
#if defined(HAVE_COCOA) && !defined(MAC_OS_X_VERSION_10_6)
return [RAScreen mainScreen];
@ -129,11 +129,11 @@ static RAScreen* get_chosen_screen(void)
if (settings->video.monitor_index >= RAScreen.screens.count)
{
RARCH_WARN("video_monitor_index is greater than the number of connected monitors; using main screen instead.\n");
return RAScreen.mainScreen;
return (__bridge void*)RAScreen.mainScreen;
}
NSArray *screens = [RAScreen screens];
return (RAScreen*)[screens objectAtIndex:settings->video.monitor_index];
return ((__bridge void*)[screens objectAtIndex:settings->video.monitor_index]);
#endif
}
@ -319,7 +319,7 @@ float cocoagl_gfx_ctx_get_native_scale(void)
{
static float ret = 0.0f;
SEL selector = NSSelectorFromString(BOXSTRING("nativeScale"));
RAScreen *screen = (RAScreen*)get_chosen_screen();
RAScreen *screen = (__bridge RAScreen*)get_chosen_screen();
if (ret != 0.0f)
return ret;
@ -337,7 +337,7 @@ float cocoagl_gfx_ctx_get_native_scale(void)
static void cocoagl_gfx_ctx_get_video_size(void *data, unsigned* width, unsigned* height)
{
RAScreen *screen = (RAScreen*)get_chosen_screen();
RAScreen *screen = (__bridge RAScreen*)get_chosen_screen();
CGRect size = screen.bounds;
float screenscale = cocoagl_gfx_ctx_get_native_scale();
@ -383,7 +383,7 @@ static void cocoagl_gfx_ctx_update_window_title(void *data)
static bool cocoagl_gfx_ctx_get_metrics(void *data, enum display_metric_types type,
float *value)
{
RAScreen *screen = (RAScreen*)get_chosen_screen();
RAScreen *screen = (__bridge RAScreen*)get_chosen_screen();
#if defined(HAVE_COCOA)
NSDictionary *description = [screen deviceDescription];
NSSize display_pixel_size = [[description objectForKey:NSDeviceSize] sizeValue];

View File

@ -110,7 +110,7 @@ void *glkitview_init(void);
- (void)viewWillLayoutSubviews
{
float width = 0.0f, height = 0.0f, tenpctw, tenpcth;
RAScreen *screen = (RAScreen*)get_chosen_screen();
RAScreen *screen = (__bridge RAScreen*)get_chosen_screen();
UIInterfaceOrientation orientation = self.interfaceOrientation;
CGRect screenSize = [screen bounds];
SEL selector = NSSelectorFromString(BOXSTRING("coordinateSpace"));

View File

@ -31,6 +31,8 @@
static id apple_platform;
void *get_chosen_screen(void);
void apple_rarch_exited(void)
{
[[NSApplication sharedApplication] terminate:nil];
@ -115,7 +117,7 @@ void apple_rarch_exited(void)
apple->mouse_rel_y = event.deltaY;
#if MAC_OS_X_VERSION_10_7
RAScreen *screen = [RAScreen mainScreen];
NSScreen *screen = (NSScreen*)get_chosen_screen();
CGFloat backing_scale_factor = screen.backingScaleFactor;
#else
CGFloat backing_scale_factor = 1.0f;