Refactor function get_float_from_selector - obsolete

hardcoded ifdef
This commit is contained in:
twinaphex 2016-01-15 12:53:33 +01:00
parent 647438ae93
commit 1b2632e7fa
2 changed files with 11 additions and 8 deletions

View File

@ -310,7 +310,7 @@ static bool cocoagl_gfx_ctx_set_video_mode(void *data,
return true;
}
static float cocoagl_gfx_ctx_get_scale_from_selector(RAScreen *screen, SEL selector, float *ret)
void get_float_from_selector(RAScreen *screen, SEL selector, float *ret)
{
NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:
[[screen class] instanceMethodSignatureForSelector:selector]];
@ -318,7 +318,6 @@ static float cocoagl_gfx_ctx_get_scale_from_selector(RAScreen *screen, SEL selec
[invocation setTarget:screen];
[invocation invoke];
[invocation getReturnValue:ret];
return *ret;
}
float cocoagl_gfx_ctx_get_native_scale(void)
@ -337,7 +336,10 @@ float cocoagl_gfx_ctx_get_native_scale(void)
return 0.0f;
if ([screen respondsToSelector:selector])
return cocoagl_gfx_ctx_get_scale_from_selector(screen, selector, &ret);
{
get_float_from_selector(screen, selector, &ret);
return ret;
}
ret = 1.0f;
if ([screen respondsToSelector:@selector(scale)])

View File

@ -33,7 +33,8 @@
static id apple_platform;
void *get_chosen_screen(void);
extern void *get_chosen_screen(void);
extern void get_float_from_selector(RAScreen *screen, SEL selector, float *ret);
void apple_rarch_exited(void)
{
@ -107,13 +108,14 @@ void apple_rarch_exited(void)
{
NSPoint pos;
NSPoint mouse_pos;
CGFloat backing_scale_factor = 1.0f;
float backing_scale_factor = 1.0f;
#if __has_feature(objc_arc)
RAScreen *screen = (__bridge RAScreen*)get_chosen_screen();
#else
RAScreen *screen = (RAScreen*)get_chosen_screen();
#endif
SEL selector = NSSelectorFromString(BOXSTRING("backingScaleFactor"));
apple = (cocoa_input_data_t*)input_driver_get_data();
if (!apple)
@ -125,9 +127,8 @@ void apple_rarch_exited(void)
apple->mouse_rel_x = event.deltaX;
apple->mouse_rel_y = event.deltaY;
#if MAC_OS_X_VERSION_10_7
backing_scale_factor = screen.backingScaleFactor;
#endif
if ([screen respondsToSelector:selector])
get_float_from_selector(screen, selector, &backing_scale_factor);
/* Absolute */
pos = [[CocoaView get] convertPoint:[event locationInWindow] fromView:nil];