mirror of
https://github.com/glfw/glfw.git
synced 2025-10-05 06:06: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);
|
GLFWAPI OSMesaContext glfwGetOSMesaContext(GLFWwindow* window);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef defined(GLFW_EXPOSE_NATIVE_ANDROID)
|
#if defined(GLFW_EXPOSE_NATIVE_ANDROID)
|
||||||
GLFWAPI HWND glfwGetAndroidApp(GLFWwindow* window);
|
#include <android_native_app_glue.h>
|
||||||
|
GLFWAPI struct android_app * glfwGetAndroidApp(GLFWwindow* window);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
@ -30,21 +30,15 @@
|
|||||||
|
|
||||||
extern int main();
|
extern int main();
|
||||||
void handle_cmd(struct android_app* _app, int32_t cmd) {
|
void handle_cmd(struct android_app* _app, int32_t cmd) {
|
||||||
switch (cmd) {
|
switch (cmd)
|
||||||
case APP_CMD_INIT_WINDOW:
|
case APP_CMD_INIT_WINDOW:
|
||||||
// The window is being shown so the initialization is finished.
|
app = _app; // 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);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Android Entry Point
|
// Android Entry Point
|
||||||
void android_main(struct android_app *app) {
|
void android_main(struct android_app *app) {
|
||||||
app->onAppCmd = handle_cmd;
|
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) {
|
while (1) {
|
||||||
int ident;
|
int ident;
|
||||||
|
@ -42,7 +42,7 @@ int _glfwPlatformCreateWindow(_GLFWwindow* window,
|
|||||||
|
|
||||||
if (ctxconfig->client != GLFW_NO_API)
|
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())
|
if (!_glfwInitEGL())
|
||||||
return GLFW_FALSE;
|
return GLFW_FALSE;
|
||||||
|
@ -585,6 +585,11 @@ GLFWAPI void glfwMakeContextCurrent(GLFWwindow* handle)
|
|||||||
|
|
||||||
_GLFW_REQUIRE_INIT();
|
_GLFW_REQUIRE_INIT();
|
||||||
|
|
||||||
|
if (window && window->context.client == GLFW_NO_API)
|
||||||
|
{
|
||||||
|
_glfwInputError(GLFW_NO_WINDOW_CONTEXT, NULL);
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (previous)
|
if (previous)
|
||||||
{
|
{
|
||||||
if (!window || window->context.source != previous->context.source)
|
if (!window || window->context.source != previous->context.source)
|
||||||
|
Loading…
Reference in New Issue
Block a user