uihost
分层
只有 api/stable/uihost.txt 列出的符号受兼容性承诺约束。标有「实验性」的符号,以及类型下「实验性成员」列出的字段,任何 0.x 版本都可能有不兼容变化(docs/release.md「API 稳定性」)。
import "github.com/tangoui/tango/uihost"本页由
site/tools/apigen从源码注释生成(按 darwin 构建标签选文件),请勿手改。
Package uihost shows Tango's self-drawn UI (package ui) in native windows: it adapts a tango.App to the ui.Window contract and drives a ui.Runner from the backend's canvas callbacks. See docs/specs/canvas-surface.md.
The UI thread for Open, Attach and windows shown by the tan dev host is the app's main thread. Page functions, Runner methods and callbacks run there. Dedicated macOS UI threads are currently used only for internal testing.
Use Runner.Post to update page state from background goroutines. It runs fn on the window's UI thread and then asks for a frame. Main-thread callbacks can also use Runner.Post to queue page updates. Calls that need the main thread (Open, Attach, FollowSystemTheme) use App.Post or tango.Await. Runner.Invalidate, InvalidateAt and Close are safe from any goroutine. Development builds (-tags tango_dev) enforce thread affinity only for runners bound to a dedicated UI thread in internal tests. On macOS a window's first frame runs after the main-thread callback that called Open returns. Variables set right after Open in that callback are visible to the page, unless the callback first runs a nested event loop (a dialog, or AwaitAsync on main), during which frames may already start.
API tiers: only the symbols listed in api/stable/uihost.txt are covered by the compatibility promise of docs/release.md ("API 稳定性"); every other exported symbol is Experimental and may change in any 0.x release. The API reference on the documentation site marks the experimental symbols.
变量
var ErrDetached = errors.New("uihost: canvas detached")ErrDetached is returned by Attached.SetLayer after Detach or after the surface closed.
var ErrNoEmbedding = fmt.Errorf("uihost: the window cannot host embedded WebViews: %w", tango.ErrUnsupported)ErrNoEmbedding is reported by WebViewW.Err in windows that cannot host embedded WebViews, such as a headless runner.
实验性
var ErrNoNativeHost = fmt.Errorf("uihost: the window cannot host native views: %w", tango.ErrUnsupported)ErrNoNativeHost is reported by NativeHostW.Err in windows that cannot host native views, such as a headless runner or an attached layer.
实验性
var ErrNotUI = errors.New("uihost: not an open self-drawn window")ErrNotUI is returned by Shortcut for a surface that was not opened with Open, or that has closed.
函数
func AcceptDrops
func AcceptDrops(r *ui.Runner, s *tango.Surface)AcceptDrops hands files dropped on surface s to the Upload dragger (or any ui.DropZone) under the drop point of runner r: it calls r.DropFiles from s.OnFilesDropped. Create the surface with SurfaceOptions.AcceptFiles so the platform reports drops:
r, s, _ := uihost.Open(app, uihost.Options{Surface: tango.SurfaceOptions{AcceptFiles: true}}, page, ui.RunnerOptions{})
uihost.AcceptDrops(r, s)
Platforms that do not report the drop point (0, 0) deliver the files at the last pointer position instead.
func EmbeddedIn 实验性
func EmbeddedIn(s *tango.Surface) *tango.SurfaceEmbeddedIn returns the window an embedded WebView surface (from WebViewW.Surface) lives in, or nil when s is not an embedded WebView.
Experimental: see docs/release.md.
func FilePicker
func FilePicker(app *tango.App) func(accept string, multiple, dir bool) ([]string, error)FilePicker adapts the native open-file dialog (sys/dialog) to ui.UploadW.Picker:
ui.Upload(c, &files).Picker(uihost.FilePicker(app))
ui.ConfigProvider(c).Defaults("Upload", ui.Props{"picker": uihost.FilePicker(app)})
The returned function blocks until the dialog closes; Upload calls it on its own goroutine. accept becomes the dialog's file filter (MIME wildcards expand to common extensions, see ui.AcceptPatterns); dir picks folders. Cancelling returns (nil, nil).
func FilePickerWith
func FilePickerWith(app *tango.App, base dialog.FileOptions) func(accept string, multiple, dir bool) ([]string, error)FilePickerWith is FilePicker with base dialog options (Parent, Title, Directory …); Filters, Multiple and PickFolders are set per call.
func FollowSystemTheme
func FollowSystemTheme(r *ui.Runner, on bool)FollowSystemTheme turns following the system theme on or off for r, a runner returned by Open or Attach. Turning it on applies the theme for the current system appearance at once (a window opened with ThemeFixed then follows as with ThemeSystem). Main thread; other runners are ignored.
A runner also stops following by itself when its theme was changed by someone else: if, when the system appearance changes, the runner's theme is not the one uihost set last (the app called Runner.SetTheme, or a ConfigProvider with theme settings replaced it), uihost leaves it alone from then on. Call FollowSystemTheme(r, false) before setting a theme by hand to make that explicit, and FollowSystemTheme(r, true) to go back to following.
func FollowingSystemTheme
func FollowingSystemTheme(r *ui.Runner) boolFollowingSystemTheme reports whether r currently follows the system theme. Main thread. For a window with its own UI thread the answer uses the theme of its last frame.
func Open
func Open(app *tango.App, opts Options, page func(*ui.Context), ropts ui.RunnerOptions) (*ui.Runner, *tango.Surface, error)Open creates a window whose content is page, drawn by a new ui.Runner, and returns the runner and the window's surface. The surface is an ordinary *tango.Surface (title, size, state, appearance, OnClose, OnClosed, ...); WebView-only methods (Navigate, Eval, Send) do nothing. The runner is closed when the surface closes.
By default the window's theme follows the system's light/dark appearance and the components' built-in texts follow i18n.Locale(); see Options.Theme, Options.Locale and FollowSystemTheme.
Open must be called on the main thread: from App.OnReady, a function passed to App.Post, or another main-thread callback. It returns an error wrapping tango.ErrUnsupported when the platform cannot create such windows.
func Persist
func Persist(ptr any)Persist keeps a value across hot reloads under tan dev; in production builds (without -tags tango_dev) it does nothing.
func Renderer
func Renderer(r *ui.Runner) stringRenderer reports how r's window is drawn: "gpu" (Metal, Direct3D 11, OpenGL), "native" (retained macOS content layers), or "cpu" (no GPU, TANGO_RENDERER=cpu, a fallback after the GPU was lost, or a runner uihost did not open). Main thread.
func Shortcut 实验性
func Shortcut(s *tango.Surface, accelerator string, fn func()) (remove func(), err error)Shortcut makes accelerator ("CmdOrCtrl+N", "Shift+CmdOrCtrl+Z", "Alt+F4", "F5", "Escape") call fn while s, a window opened with Open, has the keyboard focus. The key press (with its repeats and release) does not reach the UI; holding the key fires fn once. fn runs on the app's main thread, which also runs the page function for ordinary windows. For a window using a dedicated UI thread during internal testing, use Runner.Post to change page state or call the Runner. A panic in fn goes to the app's panic handling (tango.Options.OnPanic, Where "event handler").
While a text field is focused only CmdOrCtrl combinations that are not text editing keys and F1–F12 fire (see ShortcutWith for the rest). A menu item with the same accelerator takes the key first, so the shortcut never fires; do not register accelerators your menus use.
remove unregisters the shortcut; calling it again does nothing. Shortcuts end when the window closes. When several shortcuts of a window share an accelerator, the first registered fires. The error wraps hotkey.ErrBadAccelerator for a malformed accelerator (or a key self-drawn windows do not report, such as F13), or is ErrNotUI. Shortcut may be called from any goroutine.
func ShortcutWith 实验性
func ShortcutWith(s *tango.Surface, accelerator string, opts ShortcutOptions, fn func()) (remove func(), err error)ShortcutWith is Shortcut with options.
func ShortcutWithContext 实验性
func ShortcutWithContext(s *tango.Surface, sequence string, opts ShortcutContextOptions, fn func(ShortcutContext) bool) (remove func(), err error)ShortcutWithContext registers a shortcut on a window opened with Open. Use the Shortcut accelerator syntax for each stroke, for example "CmdOrCtrl+K CmdOrCtrl+S"; use "Shift Shift", "Ctrl Ctrl", "Alt Alt" or "Meta Meta" for a double tap of either side of a bare modifier. Each tap uses the same physical key for its press and release. "Mod" is an alias for "CmdOrCtrl".
The callback runs on the app's main thread and may consume each matched event by returning true. A false result lets a later binding or the focused input path handle the event. Return true on a prefix press to arm the next stroke. A mismatch or timeout discards the pending sequence; consumed events stay consumed. Auto-repeat and physical release are offered for matched presses, even if modifiers changed. A double tap invokes the callback only on the second physical release. Native menu shortcuts and shortcut recording retain priority. In tan dev the callback runs after native translation and can only consume forwarded key events.
Pending continuations have priority over new bindings. For the same stroke bindings are tried in registration order, and prefixes sharing a stroke may arm together. Contextual bindings run before ShortcutWith. The returned remove function is idempotent and can be called from any goroutine, as can registration. Window close ends all bindings.
func SystemHighContrast 实验性
func SystemHighContrast(app *tango.App) (on, ok bool)SystemHighContrast reports whether the system asks for increased contrast; ok is false when the platform cannot tell. Main thread.
类型
Anchor
type Anchor uint8Anchor chooses what non-zero Layer.Bounds stay attached to when the window is resized.
const (
AnchorTopLeft Anchor = Anchor(platform.AnchorTopLeft)
AnchorTopRight Anchor = Anchor(platform.AnchorTopRight)
AnchorBottomLeft Anchor = Anchor(platform.AnchorBottomLeft)
AnchorBottomRight Anchor = Anchor(platform.AnchorBottomRight)
AnchorCenter Anchor = Anchor(platform.AnchorCenter)
)Attached
type Attached struct {
// contains filtered or unexported fields
}Attached is a canvas attached to a WebView surface. Its methods run on the main thread.
func Attach
func Attach(s *tango.Surface, layer Layer, page func(*ui.Context), ropts ui.RunnerOptions) (*ui.Runner, *Attached, error)Attach draws page with a new ui.Runner on a canvas placed inside the WebView surface s as layer says, and returns the runner and a handle to move or remove the canvas. Input over the canvas goes to the runner (pointer, wheel; keyboard while the canvas has focus: clicking it focuses it, clicking the page gives focus back to the WebView). The runner is closed when s closes or on Detach. On macOS, Windows and Linux, the canvas can contain WebView children.
Attach must be called on the main thread (App.OnReady, App.Post, a surface callback, ...). It returns an error wrapping tango.ErrUnsupported when the platform cannot mix a canvas with a WebView, and under the hot reload host of tan dev (attached canvases are not forwarded to the dev host; use uihost.Open windows there).
func AttachWith
func AttachWith(s *tango.Surface, layer Layer, opts Options, page func(*ui.Context), ropts ui.RunnerOptions) (*ui.Runner, *Attached, error)AttachWith is Attach with the theme, locale and OnFirstPresent options of Open. The existing surface provides the window geometry. Attach follows the system like Open with zero Options: the canvas's theme switches between light and dark with the system, as the page under it does through prefers-color-scheme, unless ropts.Theme is set.
func (*Attached) Detach
func (a *Attached) Detach()Detach removes the canvas from the surface and closes the runner. The surface stays open. Calling it again does nothing.
func (*Attached) Detached
func (a *Attached) Detached() boolDetached reports whether the canvas is gone (Detach, or the surface closed).
func (*Attached) Layer
func (a *Attached) Layer() LayerLayer returns the canvas's current placement.
func (*Attached) SetLayer
func (a *Attached) SetLayer(layer Layer) errorSetLayer moves the canvas. It returns ErrDetached after Detach and an error wrapping tango.ErrUnsupported when the backend cannot move an attached canvas.
func (*Attached) Size
func (a *Attached) Size() (w, h, scale float32)Size returns the canvas size in logical pixels and its device scale (0, 0, 0 once detached).
func (*Attached) Surface
func (a *Attached) Surface() *tango.SurfaceSurface returns the surface the canvas is attached to.
ContrastMode
type ContrastMode intContrastMode says how a window's generated theme relates to the system high-contrast preference (macOS Increase contrast, Windows contrast themes, the Linux appearance portal).
const (
// ContrastSystem follows the system: theme.HighContrast of the
// generated theme while the system asks for more contrast, switching
// when the user does. The default.
ContrastSystem ContrastMode = iota
// ContrastStandard never raises the contrast, whatever the system
// says.
ContrastStandard
// ContrastHigh always draws the high-contrast variant.
ContrastHigh
)CoverMode 实验性
type CoverMode uint8CoverMode says what an embedded WebView does while a layer of the UI (dropdown, tooltip, popover, dialog, message) overlaps its box. A native view is always drawn above the canvas, so without a strategy it would hide the layer.
const (
// CoverSnapshot (the zero value) freezes the WebView: the window
// takes a snapshot, draws it in the canvas under the layer and hides
// the native view until nothing covers the box any more. The page
// keeps running but its updates do not show while frozen. Until the
// first snapshot arrives (a few milliseconds) the native view stays
// on top; if the platform cannot take snapshots it behaves like
// CoverHide.
CoverSnapshot CoverMode = iota
// CoverHide hides the native view while covered; the box shows what
// the canvas draws there (its Bg, Paint).
CoverHide
// CoverIgnore keeps the native view on top of everything.
CoverIgnore
)实验性
FirstPresent
type FirstPresent struct {
// ReturnedAt is the time the presentation call returned. Under tan dev
// it records when the worker sent its first frame to the dev host.
ReturnedAt time.Time
// DisplayedAt delivers the platform-reported display time of that frame
// when available on macOS Metal. The channel delivers at most one value
// and can close without a value if the frame is discarded. It is nil
// on renderers without display feedback. Read it asynchronously.
DisplayedAt <-chan time.Time
}FirstPresent records the canvas's first successful presentation submission.
Layer
type Layer struct {
// Bounds is the canvas rectangle relative to the top-left corner of
// the content area, in logical pixels (X/Y are offsets here, not
// screen coordinates). The zero Rect fills the content area and
// follows its size; a non-zero Rect keeps its size and its distance
// from the corner Anchor names when the window is resized (use
// SetLayer from Surface.OnResized for other layouts).
Bounds tango.Rect
// Above stacks the canvas over the WebView. Below it (false) the
// canvas shows only through transparent parts of the page: the
// backend makes the WebView's own background transparent, and the
// page must not paint one either (html, body { background:
// transparent }). A canvas below the WebView gets no pointer input
// where the WebView covers it.
Above bool
// PassThrough sends pointer events over fully transparent canvas
// pixels (alpha 0 in the last presented frame) to the WebView below.
// Only meaningful with Above.
PassThrough bool
// HitAlpha is the PassThrough threshold: a pixel takes pointer input
// only if its alpha is at least HitAlpha. 0 means 1 (any
// non-transparent pixel); 32 lets soft shadows pass clicks through.
HitAlpha uint8
// Anchor keeps non-zero Bounds at a fixed distance from a corner (or
// the centre) of the content area as the window is resized. Bounds
// are still given from the top-left for the current size; the zero
// value is AnchorTopLeft.
Anchor Anchor
}Layer places an attached canvas in its surface.
LocaleMode
type LocaleMode intLocaleMode says whether component texts follow the app's locale.
const (
// LocaleSystem sets ui.SetDefaultLocale to the pack matching
// i18n.Locale() (the system languages, or the app's i18n.SetLocale)
// when a window opens and whenever that locale changes, and redraws
// the windows. Locales without a ui pack fall back to English.
LocaleSystem LocaleMode = iota
// LocaleFixed leaves ui's default locale alone.
LocaleFixed
)NativeHostOptions 实验性
type NativeHostOptions struct {
// Create makes the application's native view, on the main thread,
// after the first frame that builds the box: an NSView* on macOS, a
// child-capable HWND on Windows, a GtkWidget* on Linux (hold a
// reference: the window only parents it). It runs once per box
// lifetime; an error is reported by Err and not retried.
Create func() (view uintptr, err error)
// Release runs on the main thread once the window no longer shows
// the view: its box stopped being built (after KeepAlive), the window
// closed, or embedding failed. The view is already removed from the
// window; destroy it here.
Release func(view uintptr)
// PassInput lets mouse events over the view reach the UI below, as if
// the view were not there (video, remote screens). The box is then not
// a Tab stop. Without it the view takes the input over its area.
PassInput bool
// KeepAlive keeps the view, hidden, for this long after its box
// stopped being built, so that it comes back without a new Create.
KeepAlive time.Duration
// Covered chooses what happens while a layer of the UI overlaps the
// box. Native views have no snapshot: CoverSnapshot (the zero value)
// behaves like CoverHide.
Covered CoverMode
}NativeHostOptions configure a NativeHost.
NativeHostW 实验性
type NativeHostW struct {
*ui.NativeViewW
// contains filtered or unexported fields
}NativeHostW is the builder of NativeHost. The embedded ui.NativeViewW styles the box (Bg, Radius, ...) drawn where the native view does not show.
func NativeHost 实验性
func NativeHost(c *ui.Context, key string, opts NativeHostOptions, lopts ...layout.Option) *NativeHostWNativeHost embeds a native view made by the application in the layout. key identifies it in its scope (like ui.Key): building NativeHost with the same key in later frames keeps the same view. The view is created (NativeHostOptions.Create) after the first frame that builds the box and follows the box every frame: scrolling, animation, window resizing and scale changes. It is hidden while the box is scrolled or clipped out of view and released (NativeHostOptions.Release) when the box is no longer built (see KeepAlive) or the window closes.
Use it for content the system must compose itself, such as hardware decoded video. The view sits above the canvas: UI layers drawn over the box hide it (see Covered); native menus (sys/menu) show above it.
NativeHost works with Open on platforms that support native child views. On other hosts the box shows its background and Err reports the reason. Call from a page function on the window's UI thread.
Experimental: see docs/release.md.
func (*NativeHostW) Err 实验性
func (w *NativeHostW) Err() errorErr reports why the view is not shown: the window cannot host native views (ErrNoNativeHost), Create failed, or the platform refused the view. Nil while it is shown or not created yet.
Options
type Options struct {
// Surface configures the window like App.NewSurface. URL and Debug are
// ignored: there is no page, the content is drawn by the runner.
Surface tango.SurfaceOptions
// Theme says whether the window follows the system's light/dark
// appearance (follow.go). The zero value, ThemeSystem, follows it,
// unless RunnerOptions.Theme is set: then the window keeps that theme
// (ThemeFixed), as before these options existed.
Theme ThemeMode
// Flavor builds the theme while following: dark is the appearance to
// draw, accent the system accent color when AccentFromSystem is set
// and the system has one (else nil). nil: theme.AntDesign with
// theme.Dark() and theme.WithPrimary(*accent) as needed.
Flavor func(dark bool, accent *theme.Color) *theme.Theme
// AccentFromSystem uses the system accent color as the primary color.
AccentFromSystem bool
// Customize, when set, adjusts every generated theme's tokens.
Customize func(*theme.Theme)
// Contrast says whether a generated theme follows the system
// high-contrast preference (contrast.go). The zero value,
// ContrastSystem, draws theme.HighContrast of the light or dark theme
// while the system asks for more contrast; ContrastStandard and
// ContrastHigh fix it. Like Flavor and Customize it only applies while
// the window generates its theme: an explicit theme is never changed.
Contrast ContrastMode
// Locale says whether the built-in texts of components follow
// i18n.Locale() (LocaleSystem, the zero value) or are left alone.
Locale LocaleMode
// OnFirstPresent runs on the app's main thread after the canvas's
// first successful presentation submission. Open and AttachWith each
// register the callback for their own canvas.
OnFirstPresent func(FirstPresent)
}Options configure a UI window.
func (Options) ThemeFor
func (o Options) ThemeFor(sys systheme.Theme) *theme.ThemeThemeFor returns the theme a window with these options draws while the system appearance is sys: nil for ThemeFixed. Pages of the same app can use it to get the same tokens (see sys/theme/uivars):
uivars.SyncPage(app, opts.ThemeFor)
With ContrastHigh the result is the high-contrast variant. ThemeFor does not read the system high-contrast preference (ContrastSystem gives the standard variant); ThemeForContrast does.
func (Options) ThemeForContrast
func (o Options) ThemeForContrast(sys systheme.Theme, highContrast bool) *theme.ThemeThemeForContrast is ThemeFor while the system high-contrast preference is highContrast (see SystemHighContrast): the theme a window with these options draws then, the high-contrast variant included.
ShortcutContext 实验性
type ShortcutContext struct {
// Event carries the key, modifiers and phase. Down is false on physical
// release, and Repeat is true on auto-repeated presses.
Event input.KeyEvent
// Composing reports an active IME pre-edit.
Composing bool
// TextInput reports that the focused control enabled text input.
TextInput bool
// Prefix reports an intermediate stroke of a multi-stroke shortcut.
Prefix bool
}ShortcutContext describes the physical key event and the latest input state of the self-drawn window when a contextual shortcut is matched.
ShortcutContextOptions 实验性
type ShortcutContextOptions struct {
// Timeout is the maximum gap between consecutive chord presses. For a
// double tap it is the maximum duration of each tap and the gap between
// taps. Zero selects 1500 ms for chords and 300 ms for double taps.
Timeout time.Duration
}ShortcutContextOptions refines ShortcutWithContext.
ShortcutOptions 实验性
type ShortcutOptions struct {
// InTextInput also fires the shortcut while a text field has the
// keyboard focus, even for keys the field would use (plain keys,
// Escape, CmdOrCtrl+C ...). Never while an input method is composing.
InTextInput bool
}ShortcutOptions refine ShortcutWith.
ThemeMode
type ThemeMode intThemeMode says how a window's theme relates to the system appearance.
const (
// ThemeSystem follows the system: light or dark, switching when the
// user does. The default.
ThemeSystem ThemeMode = iota
// ThemeLight always uses the light variant of the generated theme
// (Flavor, AccentFromSystem and Customize still apply; with
// AccentFromSystem the accent color is still followed).
ThemeLight
// ThemeDark always uses the dark variant of the generated theme.
ThemeDark
// ThemeFixed uses RunnerOptions.Theme (theme.AntDesign() when nil)
// and never changes it.
ThemeFixed
)WebViewOptions 实验性
type WebViewOptions struct {
// URL is the first page, resolved like SurfaceOptions.URL (relative
// paths load from the app's assets). Changing it later has no effect:
// navigate with Surface().Navigate.
URL string
// Debug allows the inspector.
Debug bool
// WebView configures the user agent, headers, browsing mode and profile.
WebView tango.WebViewOptions
// Adopt places an existing native popup from the same canvas.
// The box takes ownership and URL, Debug, and WebView are ignored.
Adopt *tango.Surface
// Created runs once on the main thread right after the WebView's
// surface exists, before its first frame shows: register OnMessage
// handlers, ipc, OnLoaded there.
Created func(s *tango.Surface)
// KeepAlive keeps the WebView, hidden, for this long after its box
// stopped being built, so that it comes back with its page state
// (tabs, collapsible panels). Zero closes it at the end of the first
// frame without its box.
KeepAlive time.Duration
// Covered chooses the strategy while a layer overlaps the box.
Covered CoverMode
}WebViewOptions configure an embedded WebView.
WebViewW 实验性
type WebViewW struct {
*ui.NativeViewW
// contains filtered or unexported fields
}WebViewW is the builder of WebView. The embedded ui.NativeViewW styles the box (Bg, Radius, ...) drawn where the native view does not show.
func WebView 实验性
func WebView(c *ui.Context, key string, opts WebViewOptions, lopts ...layout.Option) *WebViewWWebView embeds a native WebView in the layout. key identifies it in its scope (like ui.Key): building WebView with the same key in later frames keeps the same WebView. The WebView is created after the first frame that builds it (WebViewOptions.Created reports it) and follows its box every frame: scrolling, animation, window resizing and scale changes. It is hidden while its box is scrolled or clipped out of view and is closed when its box is no longer built (see KeepAlive); it closes with the window.
Focus: the box is a Tab stop. Tabbing onto it gives the page keyboard focus (its first focusable element; the last one with Shift+Tab); clicking the page focuses it too, and the UI's focus follows to the box. Tab past the page's last focusable element (Shift+Tab before the first) or F6 / Shift+F6 return focus to the UI, to the control after (before) the box. Key events go to whichever side has focus, never to both.
WebView works with Open and with Attach on platforms that support child WebViews. On other hosts the box shows its background and Err reports the reason. Call from a page function on the window's UI thread.
Experimental: see docs/release.md.
func (*WebViewW) Err 实验性
func (w *WebViewW) Err() errorErr reports why the WebView does not exist: ErrNoEmbedding, an error wrapping tango.ErrUnsupported when the platform cannot embed WebViews, or a creation error. nil while it exists or is about to be created.
func (*WebViewW) Freeze 实验性
func (w *WebViewW) Freeze(on bool) *WebViewWFreeze treats the box as covered this frame (see CoverMode), for content the window cannot see as a layer: something drawn over the box in the page itself, a drag preview.
func (*WebViewW) Frozen 实验性
func (w *WebViewW) Frozen() boolFrozen reports whether the WebView is currently replaced by its snapshot (or hidden) because something covers its box.
func (*WebViewW) Surface 实验性
func (w *WebViewW) Surface() *tango.SurfaceSurface returns the WebView's surface (Navigate, Eval, Send, OnMessage through App.OnMessage, the WebView extensions), or nil before it exists (the first frame) or when it could not be created (see Err).