Corrected issue with native window handler on OSX
Could not be retrieved for now...
This commit is contained in:
parent
97f6454982
commit
2d324f22a7
1 changed files with 33 additions and 32 deletions
65
src/core.c
65
src/core.c
|
@ -135,40 +135,36 @@
|
||||||
#define CHDIR chdir
|
#define CHDIR chdir
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(PLATFORM_DESKTOP) || defined(PLATFORM_WEB)
|
#if defined(PLATFORM_DESKTOP)
|
||||||
#if defined(PLATFORM_WEB)
|
|
||||||
#define GLFW_INCLUDE_ES2
|
|
||||||
#endif
|
|
||||||
//#define GLFW_INCLUDE_NONE // Disable the standard OpenGL header inclusion on GLFW3
|
//#define GLFW_INCLUDE_NONE // Disable the standard OpenGL header inclusion on GLFW3
|
||||||
#include <GLFW/glfw3.h> // GLFW3 library: Windows, OpenGL context and Input management
|
#include <GLFW/glfw3.h> // GLFW3 library: Windows, OpenGL context and Input management
|
||||||
// NOTE: GLFW3 already includes gl.h (OpenGL) headers
|
// NOTE: GLFW3 already includes gl.h (OpenGL) headers
|
||||||
|
|
||||||
// Support retrieving native window handlers
|
// Support retrieving native window handlers
|
||||||
#if defined(_WIN32)
|
#if defined(_WIN32)
|
||||||
#define GLFW_EXPOSE_NATIVE_WIN32
|
#define GLFW_EXPOSE_NATIVE_WIN32
|
||||||
#include <GLFW/glfw3native.h> // WARNING: It requires customization to avoid windows.h inclusion!
|
#include <GLFW/glfw3native.h> // WARNING: It requires customization to avoid windows.h inclusion!
|
||||||
|
|
||||||
|
#if !defined(SUPPORT_BUSY_WAIT_LOOP)
|
||||||
|
// NOTE: Those functions require linking with winmm library
|
||||||
|
unsigned int __stdcall timeBeginPeriod(unsigned int uPeriod);
|
||||||
|
unsigned int __stdcall timeEndPeriod(unsigned int uPeriod);
|
||||||
|
#endif
|
||||||
#elif defined(__linux__)
|
#elif defined(__linux__)
|
||||||
//#define GLFW_EXPOSE_NATIVE_X11 // WARNING: Exposing Xlib.h > X.h results in dup symbols for Font type
|
#include <sys/time.h> // Required for: timespec, nanosleep(), select() - POSIX
|
||||||
//GLFW_EXPOSE_NATIVE_WAYLAND
|
|
||||||
//GLFW_EXPOSE_NATIVE_MIR
|
//#define GLFW_EXPOSE_NATIVE_X11 // WARNING: Exposing Xlib.h > X.h results in dup symbols for Font type
|
||||||
|
//#define GLFW_EXPOSE_NATIVE_WAYLAND
|
||||||
|
//#define GLFW_EXPOSE_NATIVE_MIR
|
||||||
|
#include <GLFW/glfw3native.h> // Required for: glfwGetX11Window()
|
||||||
|
#elif defined(__APPLE__)
|
||||||
|
#include <unistd.h> // Required for: usleep()
|
||||||
|
#include <objc/message.h> // 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_NSGL
|
||||||
|
#include <GLFW/glfw3native.h> // Required for: glfwGetCocoaWindow(), glfwGetNSGLContext()
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#if !defined(SUPPORT_BUSY_WAIT_LOOP) && defined(_WIN32)
|
|
||||||
// NOTE: Those functions require linking with winmm library
|
|
||||||
unsigned int __stdcall timeBeginPeriod(unsigned int uPeriod);
|
|
||||||
unsigned int __stdcall timeEndPeriod(unsigned int uPeriod);
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(__linux__) || defined(PLATFORM_WEB)
|
|
||||||
#include <sys/time.h> // Required for: timespec, nanosleep(), select() - POSIX
|
|
||||||
#elif defined(__APPLE__)
|
|
||||||
#include <unistd.h> // Required for: usleep()
|
|
||||||
#include <objc/message.h> // Required for: objc_msgsend(), sel_registerName()
|
|
||||||
#define GLFW_EXPOSE_NATIVE_COCOA
|
|
||||||
#define GLFW_EXPOSE_NATIVE_NSGL
|
|
||||||
#include <GLFW/glfw3native.h> // Required for: glfwGetCocoaWindow(), glfwGetNSGLContext()
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(PLATFORM_ANDROID)
|
#if defined(PLATFORM_ANDROID)
|
||||||
|
@ -205,8 +201,12 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(PLATFORM_WEB)
|
#if defined(PLATFORM_WEB)
|
||||||
#include <emscripten/emscripten.h>
|
#define GLFW_INCLUDE_ES2 // GLFW3: Enable OpenGL ES 2.0 (translated to WebGL)
|
||||||
#include <emscripten/html5.h>
|
#include <GLFW/glfw3.h> // GLFW3 library: Windows, OpenGL context and Input management
|
||||||
|
#include <sys/time.h> // Required for: timespec, nanosleep(), select() - POSIX
|
||||||
|
|
||||||
|
#include <emscripten/emscripten.h> // Emscripten library - LLVM to JavaScript compiler
|
||||||
|
#include <emscripten/html5.h> // Emscripten HTML5 library
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
|
@ -817,7 +817,7 @@ void *GetWindowHandle(void)
|
||||||
return NULL; // TODO: Find a way to return value... cast to void *?
|
return NULL; // TODO: Find a way to return value... cast to void *?
|
||||||
#elif defined(__APPLE__)
|
#elif defined(__APPLE__)
|
||||||
// NOTE: Returned handle is: void *id
|
// NOTE: Returned handle is: void *id
|
||||||
return glfwGetCocoaWindow(window);
|
return NULL; //glfwGetCocoaWindow(window); //
|
||||||
#else
|
#else
|
||||||
return NULL;
|
return NULL;
|
||||||
#endif
|
#endif
|
||||||
|
@ -2975,11 +2975,12 @@ static void SwapBuffers(void)
|
||||||
#if defined(PLATFORM_DESKTOP) || defined(PLATFORM_WEB)
|
#if defined(PLATFORM_DESKTOP) || defined(PLATFORM_WEB)
|
||||||
glfwSwapBuffers(window);
|
glfwSwapBuffers(window);
|
||||||
#if __APPLE__
|
#if __APPLE__
|
||||||
// workaround for missing/erroneous initial rendering on macOS
|
// Workaround for missing/erroneous initial rendering on macOS
|
||||||
if (windowNeedsUpdating) {
|
if (windowNeedsUpdating)
|
||||||
|
{
|
||||||
// Desugared version of Objective C: [glfwGetNSGLContext(window) update]
|
// Desugared version of Objective C: [glfwGetNSGLContext(window) update]
|
||||||
((id (*)(id, SEL))objc_msgSend)(glfwGetNSGLContext(window),
|
((id (*)(id, SEL))objc_msgSend)(glfwGetNSGLContext(window), sel_registerName("update"));
|
||||||
sel_registerName("update"));
|
|
||||||
windowNeedsUpdating--;
|
windowNeedsUpdating--;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue