summaryrefslogtreecommitdiff
path: root/src/libEGL.c
diff options
context:
space:
mode:
authorJari Vetoniemi <mailroxas@gmail.com>2018-03-11 18:24:08 +0200
committerJari Vetoniemi <mailroxas@gmail.com>2018-03-11 18:24:08 +0200
commit793d5888769a7351fc699a31f6caa73bcbcbe338 (patch)
tree68d4a1bb148f7503ae8e223831f93216ac96bb18 /src/libEGL.c
parent327da9112b166bb31218fa828a44413db7fee284 (diff)
android/EGL: Mark ANativeWindow w/ header
Remove eglGetDisplay as it's called with NULL anyways (Reimplement if otherwise in some app) In eglCreateWindowSurface, check that our pointer really is ANativeWindow, otherwise try use it as is.
Diffstat (limited to 'src/libEGL.c')
-rw-r--r--src/libEGL.c13
1 files changed, 3 insertions, 10 deletions
diff --git a/src/libEGL.c b/src/libEGL.c
index 45e8ffb..f2d9585 100644
--- a/src/libEGL.c
+++ b/src/libEGL.c
@@ -1,28 +1,21 @@
#include <dlfcn.h>
+#include <string.h>
#include <EGL/egl.h>
-#define GLFW_INCLUDE_NONE
#include <GLFW/glfw3.h>
#define GLFW_EXPOSE_NATIVE_X11
#include <GLFW/glfw3native.h>
struct ANativeWindow {
+ char header[4];
GLFWwindow *glfw;
};
-EGLDisplay
-eglGetDisplay(EGLNativeDisplayType native_display)
-{
- static union { EGLDisplay (*fun)(EGLNativeDisplayType); void *ptr; } orig;
- if (!orig.ptr) orig.ptr = dlsym(RTLD_NEXT, "eglGetDisplay");
- return orig.fun(glfwGetX11Display());
-}
-
EGLSurface
eglCreateWindowSurface(EGLDisplay display, EGLConfig config, NativeWindowType native_window, EGLint const *attrib_list)
{
static union { EGLSurface (*fun)(EGLDisplay, EGLConfig, NativeWindowType, EGLint const*); void *ptr; } orig;
if (!orig.ptr) orig.ptr = dlsym(RTLD_NEXT, "eglCreateWindowSurface");
struct ANativeWindow *window = (struct ANativeWindow*)native_window;
- return orig.fun(display, config, glfwGetX11Window(window->glfw), attrib_list);
+ return orig.fun(display, config, (!memcmp(window->header, "andr", sizeof(window->header)) ? glfwGetX11Window(window->glfw) : native_window), attrib_list);
}