Files
gio-patched/app/egl_android.go
T
Elias Naur 2dcbf6fe3c app: confine the eglWindow indirection to the Wayland backend
Only the Wayland backend needs an wl_egl_window between the wl_surface
and EGL. Move code dealing with the indirection to Wayland specific
code.

Then, introduce the eglDriver interface instead of referencing the
native window type directly. This will help when multiple backends are
supported at runtime (e.g. Wayland+X11).

Finally, move the eglDriver implementation methods from GOOS-specific
code to separate EGL-specific files, allowing EGL types to be used
directly instead of unsafe.Pointer and uinptr.

The result is simpler generic EGL code, and easier path towards X11
support.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-10-02 23:07:54 +02:00

35 lines
790 B
Go

// SPDX-License-Identifier: Unlicense OR MIT
package app
/*
#include <EGL/egl.h>
*/
import "C"
type (
_EGLNativeDisplayType = C.EGLNativeDisplayType
_EGLNativeWindowType = C.EGLNativeWindowType
)
func eglGetDisplay(disp _EGLNativeDisplayType) _EGLDisplay {
return C.eglGetDisplay(disp)
}
func eglCreateWindowSurface(disp _EGLDisplay, conf _EGLConfig, win _EGLNativeWindowType, attribs []_EGLint) _EGLSurface {
eglSurf := C.eglCreateWindowSurface(disp, conf, win, &attribs[0])
return eglSurf
}
func (w *window) eglDestroy() {
}
func (w *window) eglDisplay() _EGLNativeDisplayType {
return nil
}
func (w *window) eglWindow(visID int) (_EGLNativeWindowType, int, int, error) {
win, width, height := w.nativeWindow(visID)
return _EGLNativeWindowType(win), width, height, nil
}