mirror of
https://github.com/glfw/glfw.git
synced 2025-10-04 21:56:36 +00:00
Polish code
This commit is contained in:
parent
51e0ca0561
commit
1daf1401fb
@ -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
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user