Merge pull request #655 from a3f/master
core: workaround window not being rendered till moved on macOS Mojave
This commit is contained in:
commit
93f68fa612
@ -73,6 +73,10 @@ if(${PLATFORM} MATCHES "Desktop")
|
|||||||
find_library(OPENGL_LIBRARY OpenGL)
|
find_library(OPENGL_LIBRARY OpenGL)
|
||||||
set(LIBS_PRIVATE ${OPENGL_LIBRARY})
|
set(LIBS_PRIVATE ${OPENGL_LIBRARY})
|
||||||
link_libraries("${LIBS_PRIVATE}")
|
link_libraries("${LIBS_PRIVATE}")
|
||||||
|
if (NOT CMAKE_SYSTEM STRLESS "Darwin-18.0.0")
|
||||||
|
add_definitions(-DGL_SILENCE_DEPRECATION)
|
||||||
|
MESSAGE(AUTHOR_WARNING "OpenGL is deprecated starting with macOS 10.14 (Mojave)!")
|
||||||
|
endif()
|
||||||
elseif(WIN32)
|
elseif(WIN32)
|
||||||
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
|
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
|
||||||
else()
|
else()
|
||||||
|
29
src/core.c
29
src/core.c
@ -134,12 +134,6 @@
|
|||||||
#define CHDIR chdir
|
#define CHDIR chdir
|
||||||
#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()
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(PLATFORM_DESKTOP) || defined(PLATFORM_WEB)
|
#if defined(PLATFORM_DESKTOP) || defined(PLATFORM_WEB)
|
||||||
#if defined(PLATFORM_WEB)
|
#if defined(PLATFORM_WEB)
|
||||||
#define GLFW_INCLUDE_ES2
|
#define GLFW_INCLUDE_ES2
|
||||||
@ -155,6 +149,15 @@
|
|||||||
#endif
|
#endif
|
||||||
#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_NSGL
|
||||||
|
#include <GLFW/glfw3native.h> // Required for: glfwGetNSGLContext()
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined(PLATFORM_ANDROID)
|
#if defined(PLATFORM_ANDROID)
|
||||||
//#include <android/sensor.h> // Android sensors functions (accelerometer, gyroscope, light...)
|
//#include <android/sensor.h> // Android sensors functions (accelerometer, gyroscope, light...)
|
||||||
#include <android/window.h> // Defines AWINDOW_FLAG_FULLSCREEN and others
|
#include <android/window.h> // Defines AWINDOW_FLAG_FULLSCREEN and others
|
||||||
@ -233,6 +236,11 @@ static bool windowReady = false; // Check if window has been init
|
|||||||
static bool windowMinimized = false; // Check if window has been minimized
|
static bool windowMinimized = false; // Check if window has been minimized
|
||||||
static const char *windowTitle = NULL; // Window text title...
|
static const char *windowTitle = NULL; // Window text title...
|
||||||
|
|
||||||
|
#if defined(__APPLE__)
|
||||||
|
static int windowNeedsUpdating = 2; // Times the Cocoa window needs to be updated initially
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#if defined(PLATFORM_ANDROID)
|
#if defined(PLATFORM_ANDROID)
|
||||||
static struct android_app *androidApp; // Android activity
|
static struct android_app *androidApp; // Android activity
|
||||||
static struct android_poll_source *source; // Android events polling source
|
static struct android_poll_source *source; // Android events polling source
|
||||||
@ -2870,6 +2878,15 @@ static void SwapBuffers(void)
|
|||||||
{
|
{
|
||||||
#if defined(PLATFORM_DESKTOP) || defined(PLATFORM_WEB)
|
#if defined(PLATFORM_DESKTOP) || defined(PLATFORM_WEB)
|
||||||
glfwSwapBuffers(window);
|
glfwSwapBuffers(window);
|
||||||
|
#if __APPLE__
|
||||||
|
// workaround for missing/erroneous initial rendering on macOS
|
||||||
|
if (windowNeedsUpdating) {
|
||||||
|
// Desugared version of Objective C: [glfwGetNSGLContext(window) update]
|
||||||
|
((id (*)(id, SEL))objc_msgSend)(glfwGetNSGLContext(window),
|
||||||
|
sel_registerName("update"));
|
||||||
|
windowNeedsUpdating--;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(PLATFORM_ANDROID) || defined(PLATFORM_RPI) || defined(PLATFORM_UWP)
|
#if defined(PLATFORM_ANDROID) || defined(PLATFORM_RPI) || defined(PLATFORM_UWP)
|
||||||
|
@ -354,11 +354,11 @@
|
|||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
// Structures Definition
|
// Structures Definition
|
||||||
//----------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------
|
||||||
#ifndef __cplusplus
|
|
||||||
// Boolean type
|
// Boolean type
|
||||||
#ifndef bool
|
#if defined(__STDC__) && __STDC_VERSION__ >= 199901L
|
||||||
typedef enum { false, true } bool;
|
#include <stdbool.h>
|
||||||
#endif
|
#elif !defined(__cplusplus) && !defined(bool)
|
||||||
|
typedef enum { false, true } bool;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Vector2 type
|
// Vector2 type
|
||||||
|
Loading…
Reference in New Issue
Block a user