diff --git a/driver/native.go b/driver/native.go index e3c6f16345..6346c4fe68 100644 --- a/driver/native.go +++ b/driver/native.go @@ -50,3 +50,15 @@ type X11WindowContext struct { // WindowHandle is the window handle for the native X11 window. WindowHandle string } + +// WaylandWindowContext is passed to the NativeWindow.RunNative callback +// when it is executed on a device with the Wayland windowing system. +// +// Since: 2.5 +type WaylandWindowContext struct { + // WaylandSurface is the handle to the native Wayland surface. + WaylandSurface uintptr + + // EGLSurface is the handle to the native EGL surface. + EGLSurface uintptr +} diff --git a/internal/driver/glfw/window_wayland.go b/internal/driver/glfw/window_wayland.go index 7ab869478c..71c455f943 100644 --- a/internal/driver/glfw/window_wayland.go +++ b/internal/driver/glfw/window_wayland.go @@ -18,8 +18,10 @@ func (w *window) RunNative(f func(any) error) error { var err error done := make(chan struct{}) runOnMain(func() { - // TODO: define driver.WaylandWindowContext and pass window handle - err = f(driver.UnknownContext{}) + err = f(driver.WaylandWindowContext{ + WaylandSurface: uintptr(w.view().GetWaylandWindow()), + EGLSurface: uintptr(w.view().GetEGLSurface()), + }) close(done) }) <-done