mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-07 18:35:34 +00:00
app: (linux,android) merge EGLNative* types and functions
Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
+4
-18
@@ -7,23 +7,18 @@ package app
|
||||
import (
|
||||
"errors"
|
||||
"sync"
|
||||
"unsafe"
|
||||
)
|
||||
|
||||
/*
|
||||
#cgo LDFLAGS: -lwayland-egl
|
||||
#cgo CFLAGS: -DWL_EGL_PLATFORM
|
||||
|
||||
#include <EGL/egl.h>
|
||||
#include <wayland-client.h>
|
||||
#include <wayland-egl.h>
|
||||
#include <EGL/egl.h>
|
||||
*/
|
||||
import "C"
|
||||
|
||||
type (
|
||||
_EGLNativeDisplayType = C.EGLNativeDisplayType
|
||||
_EGLNativeWindowType = C.EGLNativeWindowType
|
||||
)
|
||||
|
||||
var eglWindows struct {
|
||||
mu sync.Mutex
|
||||
windows map[*C.struct_wl_surface]*C.struct_wl_egl_window
|
||||
@@ -43,7 +38,7 @@ func (w *window) eglDestroy() {
|
||||
}
|
||||
|
||||
func (w *window) eglDisplay() _EGLNativeDisplayType {
|
||||
return w.display()
|
||||
return _EGLNativeDisplayType(w.display())
|
||||
}
|
||||
|
||||
func (w *window) eglWindow(visID int) (_EGLNativeWindowType, int, int, error) {
|
||||
@@ -65,14 +60,5 @@ func (w *window) eglWindow(visID int) (_EGLNativeWindowType, int, int, error) {
|
||||
eglWindows.windows[surf] = eglWin
|
||||
}
|
||||
C.wl_egl_window_resize(eglWin, C.int(width), C.int(height), 0, 0)
|
||||
return eglWin, width, height, nil
|
||||
}
|
||||
|
||||
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
|
||||
return _EGLNativeWindowType(uintptr(unsafe.Pointer(eglWin))), width, height, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user