From 2652e7d1c1051852e7f2ebf0e71396ac645c6713 Mon Sep 17 00:00:00 2001 From: Ray Date: Mon, 8 Oct 2018 18:08:39 +0200 Subject: [PATCH] Avoid multiple gl.h inclusions Expose native Cocoa Window again... --- src/core.c | 9 +++++---- src/external/glfw/include/GLFW/glfw3native.h | 5 ++++- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/core.c b/src/core.c index bd21c143..356e6821 100644 --- a/src/core.c +++ b/src/core.c @@ -141,7 +141,8 @@ #endif #if defined(PLATFORM_DESKTOP) - //#define GLFW_INCLUDE_NONE // Disable the standard OpenGL header inclusion on GLFW3 + #define GLFW_INCLUDE_NONE // Disable the standard OpenGL header inclusion on GLFW3 + // NOTE: Already provided by rlgl implementation (on glad.h) #include // GLFW3 library: Windows, OpenGL context and Input management // NOTE: GLFW3 already includes gl.h (OpenGL) headers @@ -166,7 +167,7 @@ #include // Required for: usleep() #include // Required for: objc_msgsend(), sel_registerName() - //#define GLFW_EXPOSE_NATIVE_COCOA // WARNING: typedef redefinition with different types ('void *' vs 'struct objc_object *') + #define GLFW_EXPOSE_NATIVE_COCOA #define GLFW_EXPOSE_NATIVE_NSGL #include // Required for: glfwGetCocoaWindow(), glfwGetNSGLContext() #endif @@ -821,8 +822,8 @@ void *GetWindowHandle(void) //unsigned long id = (unsigned long)glfwGetX11Window(window); return NULL; // TODO: Find a way to return value... cast to void *? #elif defined(__APPLE__) - // NOTE: Returned handle is: void *id - return NULL; //glfwGetCocoaWindow(window); // + // NOTE: Returned handle is: (objc_object *) + return (void *)glfwGetCocoaWindow(window); #else return NULL; #endif diff --git a/src/external/glfw/include/GLFW/glfw3native.h b/src/external/glfw/include/GLFW/glfw3native.h index 84bb3399..463a7a71 100644 --- a/src/external/glfw/include/GLFW/glfw3native.h +++ b/src/external/glfw/include/GLFW/glfw3native.h @@ -101,7 +101,10 @@ extern "C" { #if defined(__OBJC__) #import #else - typedef void* id; + // RAY: Added protection in case OBJC types defined + #if !defined(OBJC_TYPES_DEFINED) + typedef void* id; + #endif #endif #elif defined(GLFW_EXPOSE_NATIVE_X11) #include