Polish code

This commit is contained in:
Curi0 2017-10-04 20:55:01 +05:30
parent 51e0ca0561
commit 1daf1401fb
4 changed files with 12 additions and 12 deletions

View File

@ -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 <android_native_app_glue.h>
GLFWAPI struct android_app * glfwGetAndroidApp(GLFWwindow* window);
#endif
#ifdef __cplusplus

View File

@ -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;

View File

@ -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;

View File

@ -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)