package driver

import "fyne.io/fyne/v2/driver"

Index

Functions

func RunNative

func RunNative(fn func(any) error) error

RunNative provides a way to execute code within the platform-specific runtime context for various runtimes. This is mostly useful for Android where the JVM provides functionality that is not accessible directly in CGo. The call for most platforms will just execute passing an `UnknownContext` and returning any error reported.

Since: 2.3

Types

type AndroidContext

type AndroidContext struct {
	VM, Env, Ctx uintptr
}

AndroidContext is passed to the RunNative callback when it is executed on an Android device. The VM, Env and Ctx pointers are required to make various calls into JVM methods.

Since: 2.3

type AndroidWindowContext

type AndroidWindowContext struct {
	AndroidContext
	NativeWindow uintptr
}

AndroidWindowContext is passed to the NativeWindow.RunNative callback when it is executed on an Android device. The NativeWindow field is of type `*C.ANativeWindow`. The VM, Env and Ctx pointers are required to make various calls into JVM methods.

Since: 2.5

type MacWindowContext

type MacWindowContext struct {
	// NSWindow is the window handle for the native window.
	NSWindow uintptr
}

MacWindowContext is passed to the NativeWindow.RunNative callback when it is executed on a macOS device.

Since: 2.5

type NativeWindow

type NativeWindow interface {
	// RunNative  provides a way to execute code within the platform-specific runtime context for a window.
	// The context types are defined in the `driver` package and the specific context passed will differ by platform.
	RunNative(func(context any))
}

NativeWindow is an extension interface for `fyne.Window` that gives access to platform-native features of application windows.

Since: 2.5

type UnknownContext

type UnknownContext struct{}

UnknownContext is passed to the RunNative callback when it is executed on devices or windows without special native context.

Since: 2.3

type WaylandWindowContext

type WaylandWindowContext struct {
	// WaylandSurface is the handle to the native Wayland surface.
	WaylandSurface uintptr
}

WaylandWindowContext is passed to the NativeWindow.RunNative callback when it is executed on a device with the Wayland windowing system.

Since: 2.5

type WindowsWindowContext

type WindowsWindowContext struct {
	// HWND is the window handle for the native window.
	HWND uintptr
}

WindowsWindowContext is passed to the NativeWindow.RunNative callback when it is executed on a Microsoft Windows device.

Since: 2.5

type X11WindowContext

type X11WindowContext struct {
	// WindowHandle is the window handle for the native X11 window.
	WindowHandle uintptr
}

X11WindowContext is passed to the NativeWindow.RunNative callback when it is executed on a device with the X11 windowing system.

Since: 2.5

Source Files

native.go native_other.go

Directories

PathSynopsis
driver/desktopPackage desktop provides desktop specific driver functionality.
driver/mobilePackage mobile provides mobile specific driver functionality.
driver/software
Version
v2.5.1
Published
Aug 24, 2024
Platform
js/wasm
Last checked
6 seconds ago

Tools for package owners.