diff --git a/include/GLFW/glfw3native.h b/include/GLFW/glfw3native.h index 6154bb758..f9ec60eef 100644 --- a/include/GLFW/glfw3native.h +++ b/include/GLFW/glfw3native.h @@ -564,8 +564,9 @@ GLFWAPI int glfwGetOSMesaDepthBuffer(GLFWwindow* window, int* width, int* height GLFWAPI OSMesaContext glfwGetOSMesaContext(GLFWwindow* window); #endif -#ifdef defined(GLFW_EXPOSE_NATIVE_ANDROID) -GLFWAPI HWND glfwGetAndroidApp(GLFWwindow* window); +#if defined(GLFW_EXPOSE_NATIVE_ANDROID) +#include +GLFWAPI struct android_app * glfwGetAndroidApp(GLFWwindow* window); #endif #ifdef __cplusplus diff --git a/src/android_init.c b/src/android_init.c index b94e597ca..98d20f76f 100644 --- a/src/android_init.c +++ b/src/android_init.c @@ -30,21 +30,15 @@ extern int main(); void handle_cmd(struct android_app* _app, int32_t cmd) { - switch (cmd) { + switch (cmd) case APP_CMD_INIT_WINDOW: - // The window is being shown so the initialization is finished. - app = _app; - break; - default: - __android_log_print(ANDROID_LOG_INFO, "GLFW", - "event not handled: %d", cmd); - } + app = _app; // The window is being shown so the initialization is finished. } // Android Entry Point void android_main(struct android_app *app) { app->onAppCmd = handle_cmd; - pthread_t t;pthread_create(&t, NULL, &main, NULL); // Call the main entry point + pthread_create(&(pthread_t){0}, NULL, (void*)&main, NULL); // Call the main entry point while (1) { int ident; diff --git a/src/android_window.c b/src/android_window.c index 4056438c0..d47778d2c 100644 --- a/src/android_window.c +++ b/src/android_window.c @@ -42,7 +42,7 @@ int _glfwPlatformCreateWindow(_GLFWwindow* window, if (ctxconfig->client != GLFW_NO_API) { - if (ctxconfig->source == GLFW_NATIVE_CONTEXT_API | GLFW_EGL_CONTEXT_API) + if ((ctxconfig->source == GLFW_NATIVE_CONTEXT_API) | (ctxconfig->source == GLFW_EGL_CONTEXT_API)) { if (!_glfwInitEGL()) return GLFW_FALSE; diff --git a/src/context.c b/src/context.c index 3b4336994..71352665f 100644 --- a/src/context.c +++ b/src/context.c @@ -585,6 +585,11 @@ GLFWAPI void glfwMakeContextCurrent(GLFWwindow* handle) _GLFW_REQUIRE_INIT(); + if (window && window->context.client == GLFW_NO_API) + { + _glfwInputError(GLFW_NO_WINDOW_CONTEXT, NULL); + return; + } if (previous) { if (!window || window->context.source != previous->context.source)