Files
android_translation_layer/src/libandroid/native_window.h
Mis012 9ef2151c5e GLSurfaceView: remove old implementation, import the one from AOSP
Now that we have a reasonably well working SurfaceView implementation,
it is actually cleaner to just implement GLSurfaceView the way AOSP
does. In fact, their code doesn't have any weird dependencies, and
can mostly be used as-is.

The AOSP code is pure Java, which means we had to implement some
EGL wrappers.

This change fixes issues with Wayland (it only ever worked because
the pbuffers were allocated using an XWayland EGLDisplay), and
with resizing (which we simply didn't support), all while getting
rid of quite some (arguably not very readable) LoC.
2023-10-20 20:54:37 +02:00

23 lines
709 B
C

#include <EGL/egl.h>
#include <gtk/gtk.h>
#include <jni.h>
#include <X11/Xlib.h>
struct ANativeWindow {
EGLNativeWindowType egl_window;
GtkWidget *surface_view_widget;
struct wl_display *wayland_display;
struct wl_surface *wayland_surface;
Display *x11_display;
gulong resize_handler;
int refcount;
};
extern EGLSurface egl_surface_hashtable;
struct ANativeWindow *ANativeWindow_fromSurface(JNIEnv* env, jobject surface);
EGLSurface bionic_eglCreateWindowSurface(EGLDisplay display, EGLConfig config, struct ANativeWindow *native_window, EGLint const *attrib_list);
EGLDisplay bionic_eglGetDisplay(NativeDisplayType native_display);
void ANativeWindow_release(struct ANativeWindow *native_window);