extern GtkWindow *window; // TODO: how do we get rid of this? the app won't pass anyhting useful to eglGetDisplay // FIXME - can't use pbuffers with wayland EGLDisplay //#if 0 EGLDisplay bionic_eglGetDisplay(NativeDisplayType native_display) { /* * On android, at least SDL passes 0 (EGL_DISPLAY_DEFAULT) to eglGetDisplay and uses the resulting display. * We obviously want to make the app use the correct display, which may happen to be a different one * than the "default" display (especially on Wayland) */ GdkDisplay *display = gtk_root_get_display(GTK_ROOT(window)); struct wl_display *wl_display = gdk_wayland_display_get_wl_display(display); return eglGetPlatformDisplay(EGL_PLATFORM_WAYLAND_KHR, wl_display, NULL); } //#endif EGLSurface bionic_eglCreateWindowSurface(EGLDisplay display, EGLConfig config, struct ANativeWindow *native_window, EGLint const *attrib_list) { // better than crashing (TODO: check if apps try to use the NULL value anyway) if(!native_window) return NULL; PrintConfigAttributes(display, config); EGLSurface ret = eglCreateWindowSurface(display, config, native_window->egl_window, attrib_list); printf("EGL::: native_window->egl_window: %ld\n", native_window->egl_window); printf("EGL::: eglGetError: %d\n", eglGetError()); printf("EGL::: ret: %p\n", ret); return ret; }