replaced confusing ifdef with a more concise #if TARGET_OS_OSX
This commit is contained in:
parent
a2327be378
commit
3dc716299f
|
@ -23,7 +23,7 @@
|
|||
#else
|
||||
#include <ApplicationServices/ApplicationServices.h>
|
||||
#endif
|
||||
#if !defined(HAVE_COCOATOUCH) && (defined(HAVE_COCOA) || defined(HAVE_COCOA_METAL))
|
||||
#if TARGET_OS_OSX
|
||||
#include <OpenGL/CGLTypes.h>
|
||||
#include <OpenGL/OpenGL.h>
|
||||
#include <AppKit/NSScreen.h>
|
||||
|
@ -115,7 +115,7 @@ void nsview_set_ptr(CocoaView *p)
|
|||
g_instance = p;
|
||||
}
|
||||
|
||||
#if !defined(HAVE_COCOATOUCH) && (defined(HAVE_COCOA) || defined(HAVE_COCOA_METAL))
|
||||
#if TARGET_OS_OSX
|
||||
static NSOpenGLPixelFormat* g_format;
|
||||
|
||||
void *glcontext_get_ptr(void)
|
||||
|
@ -239,7 +239,7 @@ float get_backing_scale_factor(void)
|
|||
return backing_scale_def;
|
||||
|
||||
backing_scale_def = 1.0f;
|
||||
#if !defined(HAVE_COCOATOUCH) && (defined(HAVE_COCOA) || defined(HAVE_COCOA_METAL))
|
||||
#if TARGET_OS_OSX
|
||||
screen = (BRIDGE RAScreen*)get_chosen_screen();
|
||||
|
||||
if (screen)
|
||||
|
@ -268,7 +268,7 @@ void cocoagl_gfx_ctx_update(void)
|
|||
{
|
||||
case GFX_CTX_OPENGL_API:
|
||||
#if defined(HAVE_OPENGL) || defined(HAVE_OPENGLES) || defined(HAVE_OPENGL_CORE)
|
||||
#if !defined(HAVE_COCOATOUCH) && (defined(HAVE_COCOA) || defined(HAVE_COCOA_METAL))
|
||||
#if TARGET_OS_OSX
|
||||
#if MAC_OS_X_VERSION_10_7
|
||||
CGLUpdateContext(g_hw_ctx.CGLContextObj);
|
||||
CGLUpdateContext(g_context.CGLContextObj);
|
||||
|
@ -298,7 +298,7 @@ static void cocoagl_gfx_ctx_destroy(void *data)
|
|||
#if defined(HAVE_OPENGL) || defined(HAVE_OPENGLES) || defined(HAVE_OPENGL_CORE)
|
||||
[GLContextClass clearCurrentContext];
|
||||
|
||||
#if !defined(HAVE_COCOATOUCH) && (defined(HAVE_COCOA) || defined(HAVE_COCOA_METAL))
|
||||
#if TARGET_OS_OSX
|
||||
[g_context clearDrawable];
|
||||
RELEASE(g_context);
|
||||
RELEASE(g_format);
|
||||
|
@ -339,7 +339,7 @@ static void cocoagl_gfx_ctx_show_mouse(void *data, bool state)
|
|||
{
|
||||
(void)data;
|
||||
|
||||
#if !defined(HAVE_COCOATOUCH) && (defined(HAVE_COCOA) || defined(HAVE_COCOA_METAL))
|
||||
#if TARGET_OS_OSX
|
||||
if (state)
|
||||
[NSCursor unhide];
|
||||
else
|
||||
|
@ -368,7 +368,7 @@ float cocoagl_gfx_ctx_get_native_scale(void)
|
|||
return ret;
|
||||
}
|
||||
|
||||
#if !defined(HAVE_COCOATOUCH) && (defined(HAVE_COCOA) || defined(HAVE_COCOA_METAL))
|
||||
#if TARGET_OS_OSX
|
||||
static void cocoagl_gfx_ctx_update_title(void *data)
|
||||
{
|
||||
const ui_window_t *window = ui_companion_driver_get_window_ptr();
|
||||
|
@ -391,7 +391,7 @@ static bool cocoagl_gfx_ctx_get_metrics(void *data, enum display_metric_types ty
|
|||
float *value)
|
||||
{
|
||||
RAScreen *screen = (BRIDGE RAScreen*)get_chosen_screen();
|
||||
#if !defined(HAVE_COCOATOUCH) && (defined(HAVE_COCOA) || defined(HAVE_COCOA_METAL))
|
||||
#if TARGET_OS_OSX
|
||||
NSDictionary *description = [screen deviceDescription];
|
||||
NSSize display_pixel_size = [[description objectForKey:NSDeviceSize] sizeValue];
|
||||
CGSize display_physical_size = CGDisplayScreenSize(
|
||||
|
@ -481,7 +481,7 @@ static void cocoagl_gfx_ctx_input_driver(void *data,
|
|||
static void cocoagl_gfx_ctx_get_video_size(void *data, unsigned* width, unsigned* height)
|
||||
{
|
||||
float screenscale = cocoagl_gfx_ctx_get_native_scale();
|
||||
#if !defined(HAVE_COCOATOUCH) && (defined(HAVE_COCOA) || defined(HAVE_COCOA_METAL))
|
||||
#if TARGET_OS_OSX
|
||||
CGRect size, cgrect;
|
||||
GLsizei backingPixelWidth, backingPixelHeight;
|
||||
#if defined(HAVE_COCOA_METAL)
|
||||
|
@ -629,7 +629,7 @@ static void cocoagl_gfx_ctx_swap_buffers(void *data)
|
|||
if (!(--g_fast_forward_skips < 0))
|
||||
return;
|
||||
|
||||
#if !defined(HAVE_COCOATOUCH) && (defined(HAVE_COCOA) || defined(HAVE_COCOA_METAL))
|
||||
#if TARGET_OS_OSX
|
||||
[g_context flushBuffer];
|
||||
[g_hw_ctx flushBuffer];
|
||||
#elif defined(HAVE_COCOATOUCH)
|
||||
|
@ -696,7 +696,7 @@ static bool cocoagl_gfx_ctx_set_video_mode(void *data,
|
|||
#elif defined(HAVE_COCOA)
|
||||
CocoaView *g_view = (CocoaView*)nsview_get_ptr();
|
||||
#endif
|
||||
#if !defined(HAVE_COCOATOUCH) && (defined(HAVE_COCOA) || defined(HAVE_COCOA_METAL))
|
||||
#if TARGET_OS_OSX
|
||||
cocoa_ctx_data_t *cocoa_ctx = (cocoa_ctx_data_t*)data;
|
||||
cocoa_ctx->width = width;
|
||||
cocoa_ctx->height = height;
|
||||
|
@ -707,7 +707,7 @@ static bool cocoagl_gfx_ctx_set_video_mode(void *data,
|
|||
case GFX_CTX_OPENGL_API:
|
||||
case GFX_CTX_OPENGL_ES_API:
|
||||
{
|
||||
#if !defined(HAVE_COCOATOUCH) && (defined(HAVE_COCOA) || defined(HAVE_COCOA_METAL))
|
||||
#if TARGET_OS_OSX
|
||||
if ([g_view respondsToSelector: @selector(setWantsBestResolutionOpenGLSurface:)])
|
||||
[g_view setWantsBestResolutionOpenGLSurface:YES];
|
||||
|
||||
|
@ -783,7 +783,7 @@ static bool cocoagl_gfx_ctx_set_video_mode(void *data,
|
|||
break;
|
||||
}
|
||||
|
||||
#if !defined(HAVE_COCOATOUCH) && (defined(HAVE_COCOA) || defined(HAVE_COCOA_METAL))
|
||||
#if TARGET_OS_OSX
|
||||
static bool has_went_fullscreen = false;
|
||||
/* TODO: Screen mode support. */
|
||||
|
||||
|
@ -913,7 +913,7 @@ const gfx_ctx_driver_t gfx_ctx_cocoagl = {
|
|||
NULL, /* get_video_output_next */
|
||||
cocoagl_gfx_ctx_get_metrics,
|
||||
NULL, /* translate_aspect */
|
||||
#if !defined(HAVE_COCOATOUCH) && (defined(HAVE_COCOA) || defined(HAVE_COCOA_METAL))
|
||||
#if TARGET_OS_OSX
|
||||
cocoagl_gfx_ctx_update_title,
|
||||
#else
|
||||
NULL, /* update_title */
|
||||
|
|
Loading…
Reference in New Issue