Documentation
¶
Overview ¶
Package platform defines the interface between the engine and an operating system backend, together with the types shared by all backends.
Flutter: the embedder API (engine/src/flutter/shell/platform/embedder).
Index ¶
- Constants
- func CloseRequest(h Handler, view ui.ViewID, reason ui.AppExitReason) bool
- func OpenRequest(h Handler, request ui.OpenRequest) bool
- func ParseFontDescription(desc string) (family string, size float64, ok bool)
- type Accessibility
- type AccessibilityHost
- type ActivationTokenProvider
- type Audio
- type AudioDevice
- type AudioDeviceInfo
- type AudioFormat
- type AudioHandler
- type AudioHost
- type AudioKind
- type AudioOpenOptions
- type AudioState
- type BackHandler
- type Clipboard
- type CloseReasonHandler
- type ContextMenuController
- type Decorations
- type DesktopProvider
- type Display
- type ExitController
- type FileDialogHost
- type FileDialogKind
- type FileDialogResult
- type FileDialogSpec
- type FileFilter
- type FontAntialiasing
- type FontHinting
- type GamepadHost
- type Gamepads
- type Handler
- type KeyboardFocusHandler
- type MenuBar
- type MouseCursor
- type NopHandler
- func (NopHandler) OnCloseRequest(ui.ViewID) bool
- func (NopHandler) OnContentLost(ui.ViewID)
- func (NopHandler) OnDisplaysChanged()
- func (NopHandler) OnDragEnd(ui.DragResult)
- func (NopHandler) OnDrop(ui.DropEvent) ui.DropActions
- func (NopHandler) OnFrame(ui.ViewID, time.Duration)
- func (NopHandler) OnKey(ui.KeyData)
- func (NopHandler) OnLifecycle(ui.AppLifecycleState)
- func (NopHandler) OnMetrics(ui.ViewID, ViewMetrics)
- func (NopHandler) OnPointer([]ui.PointerData)
- func (NopHandler) OnSettings(Settings)
- func (NopHandler) OnTextInput(ui.TextInputEvent)
- func (NopHandler) OnViewFocus(ui.ViewID, bool)
- type OpenRequestHandler
- type PadBattery
- type PadEvent
- type PadEventKind
- type PadExtras
- type PadExtrasHandler
- type PadHandler
- type PadID
- type PadInfo
- type PadPowerState
- type PadSensor
- type PadSensorControl
- type PadSensorKind
- type PadTouch
- type Platform
- type PointerLockHandler
- type PointerLocker
- type PortalHandleProvider
- type ScreenshotPoster
- type ScriptWaiter
- type SensorDevice
- type SensorHandler
- type SensorKind
- type SensorOpenOptions
- type SensorReading
- type Sensors
- type SensorsHost
- type Services
- type Settings
- type SurfaceHandler
- type SurfaceRenewer
- type SyncInputHandler
- type Tray
- type TrayHost
- type TrayMenuItem
- type TraySpec
- type ViewMetrics
- type Window
- type WindowConfig
- type WindowKind
- type WindowState
Constants ¶
const ( // no audio server running. // // Flutter: no counterpart TagAudioUnavailable = "AudioUnavailable" // TagAudioDeviceOpenFailed is the tag of the error of a device that cannot be opened. // // Flutter: no counterpart TagAudioDeviceOpenFailed = "AudioDeviceOpenFailed" // TagAudioDeviceLost is the tag of the error of a device that is gone. // // Flutter: no counterpart TagAudioDeviceLost = "AudioDeviceLost" // TagAudioFormatUnsupported is the tag of the error of a format, or samples, that the device or the stream cannot take. // // Flutter: no counterpart TagAudioFormatUnsupported = "AudioFormatUnsupported" // TagAudioCapturePermissionDenied is the tag of the error of a recording that the user did not allow. // // Flutter: no counterpart TagAudioCapturePermissionDenied = "AudioCapturePermissionDenied" )
The tags of the errors an Audio service returns.
const ( // // Flutter: no counterpart TagGamepadRumbleUnavailable = "GamepadRumbleUnavailable" // // Flutter: no counterpart TagGamepadLEDUnavailable = "GamepadLEDUnavailable" // // Flutter: no counterpart TagGamepadSensorsUnavailable = "GamepadSensorsUnavailable" )
The tags of the errors a Gamepads service returns.
const ( // service. // // Flutter: no counterpart TagSensorUnavailable = "SensorUnavailable" // TagSensorPermissionDenied is the tag of the error of a sensor that the user did not allow. // // Flutter: no counterpart TagSensorPermissionDenied = "SensorPermissionDenied" // TagSensorOpenFailed is the tag of the error of a sensor that cannot be opened. // // Flutter: no counterpart TagSensorOpenFailed = "SensorOpenFailed" )
The tags of the errors a Sensors service returns.
Variables ¶
This section is empty.
Functions ¶
func CloseRequest ¶
CloseRequest asks h whether the window of view may close, for reason: through CloseReasonHandler when h has it, else through Handler.OnCloseRequest.
Flutter: no counterpart
func OpenRequest ¶
func OpenRequest(h Handler, request ui.OpenRequest) bool
OpenRequest gives h a request of the system to open URLs or files, and reports whether h takes such requests (it is an OpenRequestHandler).
Flutter: no counterpart
func ParseFontDescription ¶
ParseFontDescription reads a Pango font description, the form of GNOME's font-name and monospace-font-name settings ("Cantarell 11", "Source Code Pro Semi-Bold 10", "Noto Sans Mono Bold Italic 12"): a family (the first of a comma separated list), style words that are left out, and a size in points. A size in pixels ("12px") is converted to points at 96 dpi. The variations after "@" are ignored. size is 0 when the description has none, and ok is false when there is no family.
Flutter: no counterpart
Types ¶
type Accessibility ¶
type Accessibility interface {
// Start follows the screen reader in the background until ctx ends or Close.
// A desktop without an accessibility service is not an error: the bridge stays off.
Start(ctx context.Context, host AccessibilityHost)
// UpdateSemantics gives the bridge the changes to the semantics tree of a view.
UpdateSemantics(view ui.ViewID, update *ui.SemanticsUpdate)
// SetWindow tells the title of the window of the view, which names the frame of its
// tree, and whether it has the keyboard focus.
SetWindow(view ui.ViewID, title string, active bool)
// RemoveView forgets the tree of a view that was closed.
RemoveView(view ui.ViewID)
// Close stops the bridge. It may be called from any goroutine, and twice.
Close()
}
Accessibility is the bridge to the assistive technologies of the desktop (SPEC §8.10). The engine starts it, gives it the semantics trees of the views, and it asks for the semantics tree only while a screen reader is on. All methods but Close are for the UI thread; the host is called on the UI thread too.
Flutter: no counterpart (the embedder's accessibility bridge)
type AccessibilityHost ¶
type AccessibilityHost interface {
// ScreenReaderChanged tells that a screen reader started or stopped: the framework
// then makes the semantics tree, or stops making it
// (PlatformDispatcher.SetSemanticsEnabled).
ScreenReaderChanged(enabled bool)
// PerformAction carries out the request of an assistive technology to perform an
// action on a node (PlatformDispatcher.DispatchSemanticsActionEvent).
PerformAction(event ui.SemanticsActionEvent)
}
AccessibilityHost is what the engine gives the bridge. Both methods are called on the UI thread.
Flutter: no counterpart
type ActivationTokenProvider ¶
type ActivationTokenProvider interface {
// RequestActivationToken asks for a token for the window of the view. done is
// called on the UI thread with the token, or with an empty token when the
// desktop gave none. The platform has the app id of the window and the last
// input event of the seat.
RequestActivationToken(view ui.ViewID, done func(token string))
}
ActivationTokenProvider is implemented by a Platform that can ask the desktop for an activation token: a proof of a user action that lets another app, one that this app launches, take the focus (Wayland's xdg_activation_v1). The services that launch apps (opening a URI, notifications) pass the token on through XDG_ACTIVATION_TOKEN.
Flutter: no counterpart
type Audio ¶
type Audio interface {
// Devices lists the devices of a kind. It fails with AudioUnavailable when the system has no audio server.
Devices(kind AudioKind) ([]AudioDeviceInfo, error)
// SetChangeHandler sets what is called when the list of devices or the default device changes; nil clears it. The function may
// be called from any thread.
SetChangeHandler(fn func())
// Open opens a device. It fails with AudioDeviceOpenFailed when the device cannot be opened, AudioFormatUnsupported when it
// cannot work in any format, AudioCapturePermissionDenied when the user refused the microphone, and AudioUnavailable when the
// system has no audio server.
Open(ctx context.Context, kind AudioKind, opts AudioOpenOptions, h AudioHandler) (AudioDevice, error)
}
Audio is the audio service of a platform (SPEC §28.3).
Flutter: no counterpart
type AudioDevice ¶
type AudioDevice interface {
// Format is the format of the frames that the handler gets and gives. It does not change while the device is open.
Format() AudioFormat
// Pause stops the device from calling the handler; Resume starts it again. Both may be called on a device that is paused or
// running.
Pause() error
Resume() error
// Close ends the device. When it returns the handler is not running and is never called again.
Close() error
}
AudioDevice is a device that is open. The handler it was opened with is called until Close returns.
Flutter: no counterpart
type AudioDeviceInfo ¶
type AudioDeviceInfo struct {
// ID names the device for Open; it is the system's own name for it and means nothing to the app.
ID string
// Name is what to show to the user.
Name string
Kind AudioKind
// Default says that this is the device that the system uses when none is asked for.
Default bool
// Format is the format that the device likes best (zero when the backend does not know).
Format AudioFormat
}
AudioDeviceInfo describes a device that the system has.
Flutter: no counterpart
type AudioFormat ¶
type AudioFormat struct {
Rate, Channels int
}
AudioFormat is the format of the samples that a device passes: interleaved float32 frames of Channels channels, Rate frames a second. The channels are in SDL's order (SPEC §28.3).
Flutter: no counterpart
type AudioHandler ¶
type AudioHandler interface {
// Fill is called by a playback device when it needs frames: out holds a whole number of frames of the device's format, and
// is to be filled completely (with silence when there is no sound). The slice is only valid during the call.
Fill(out []float32)
// Capture is called by a capture device with the frames it recorded, a whole number of frames of the device's format. The
// slice is only valid during the call.
Capture(in []float32)
// StateChanged says that the state of the device changed without the owner asking for it (a device that is lost, a suspended
// device that starts). It may be called from any thread.
StateChanged(s AudioState)
}
AudioHandler is what a device calls, on the thread of its own (the audio thread: a locked goroutine or the thread of the system's library), never on the UI thread. It must not wait for the UI thread, and it must not allocate or take locks that a slow thread holds, or the sound breaks up.
Flutter: no counterpart
type AudioHost ¶
type AudioHost interface {
// Audio returns the audio service, or nil.
Audio() Audio
// AddReleaseHook registers a function that the host calls when the app ends, so that a device that is still open is closed
// before the process leaves. The function runs on the UI thread.
AddReleaseHook(fn func())
}
AudioHost is implemented by the host of the dispatcher (the engine) and found through ui.PlatformDispatcher.HostAs: it gives access to the audio service of the platform, or nil when the platform has none.
Flutter: no counterpart
type AudioKind ¶
type AudioKind uint8
AudioKind says whether an audio device plays sound or records it.
Flutter: no counterpart
type AudioOpenOptions ¶
type AudioOpenOptions struct {
// ID is the device to open; empty means the default device of the kind, which the backend follows when the system's default
// changes.
ID string
// Format is the format the app would like; the device may give another, as Format of the AudioDevice says. A zero field
// leaves the choice to the backend.
Format AudioFormat
// BufferFrames is the size of the buffer in frames the app would like; 0 leaves it to the backend (a latency within the
// targets of SPEC §28.6).
BufferFrames int
// PauseInBackground says that the device pauses while the app is hidden (Android).
PauseInBackground bool
}
AudioOpenOptions are what an app asks of a device when it opens it.
Flutter: no counterpart
type AudioState ¶
type AudioState uint8
AudioState is the state of an open device.
Flutter: no counterpart
const ( // AudioRunning is a device that plays or records. // // Flutter: no counterpart AudioRunning AudioState = iota // AudioPaused is a device that its owner paused (or that the platform paused because the app is hidden). // // Flutter: no counterpart AudioPaused // AudioSuspended is a device that waits for something that is not up to the app (the browser's rule that sound starts with a // user gesture): it starts to run by itself. // // Flutter: no counterpart AudioSuspended // AudioLost is a device that is gone (unplugged, or the system's server ended) and was not replaced. // // Flutter: no counterpart AudioLost // AudioClosed is a device that was closed. // // Flutter: no counterpart AudioClosed )
type BackHandler ¶
type BackHandler interface {
// OnPopRoute reports that the system asks the app to go back: the framework pops a route or
// ends the app.
OnPopRoute()
// OnStartBackGesture reports that a predictive back gesture started and returns whether the
// framework took it.
OnStartBackGesture(e ui.BackGestureEvent) bool
// OnUpdateBackGestureProgress reports the progress of a predictive back gesture.
OnUpdateBackGestureProgress(e ui.BackGestureEvent)
// OnCommitBackGesture reports that the gesture was completed: the route pops.
OnCommitBackGesture()
// OnCancelBackGesture reports that the gesture was cancelled.
OnCancelBackGesture()
// OnMemoryPressure reports that the system is low on memory.
OnMemoryPressure()
}
BackHandler is implemented by a Handler that takes the system's back navigation and its memory warnings: Android's back button and gesture (predictive or not), and onTrimMemory (SPEC §24.8). The platform asks for it with a type assertion; a handler without it ignores them.
Flutter: no counterpart (the navigation channel, the back gesture channel and the system channel of the embedder)
type Clipboard ¶
type Clipboard interface {
// SetText makes text the content of the clipboard; the app owns it until
// another application takes it. done, when it is not nil, is called with the
// error, if any.
SetText(ctx context.Context, text string, done func(err error))
// GetText reads the text of the clipboard. The text is empty and ok false when
// the clipboard has no text. ctx ends a read that is taking too long.
GetText(ctx context.Context, done func(text string, ok bool, err error))
// SetContent makes the content the content of the selection of the kind: the
// system clipboard or the primary selection. done is as for SetText.
SetContent(ctx context.Context, kind ui.ClipboardKind, content ui.ClipboardContent, done func(err error))
// GetContent reads the selection of the kind in the format (one of the
// ui.ClipboardFormat constants). The content is empty when the selection has
// no such format. ctx ends a read that is taking too long.
GetContent(ctx context.Context, kind ui.ClipboardKind, format string, done func(content ui.ClipboardContent, err error))
}
Clipboard is the system clipboard of the desktop. Its methods are for the UI thread. Reading the clipboard of another application takes time (the other application has to write the data), so the results come back through a function that the platform calls later on the UI thread; it is never called before the method has returned.
SetContent and GetContent reach the primary selection and the formats beyond text; the platform that has no primary selection fails them for it with ClipboardPrimaryUnavailable.
Flutter: services/clipboard.dart Clipboard
type CloseReasonHandler ¶
type CloseReasonHandler interface {
// OnCloseRequestFor is Handler.OnCloseRequest with the reason of the request.
OnCloseRequestFor(view ui.ViewID, reason ui.AppExitReason) bool
}
CloseReasonHandler is implemented by a handler that wants to know why a window is asked to close (ui.AppExitReason, SPEC §8.7 "Closing"). A platform that can tell the close button from the app's Quit and from the end of the session (macOS) calls it instead of Handler.OnCloseRequest; OnCloseRequest is the reason ui.AppExitReasonWindowClose. CloseRequest calls whichever the handler has.
Flutter: no counterpart
type ContextMenuController ¶
type ContextMenuController interface {
// SetBrowserContextMenuEnabled says whether the browser's context menu is shown when the
// user asks for it (a right click); it is enabled until the app disables it.
SetBrowserContextMenuEnabled(enabled bool)
}
ContextMenuController is implemented by a Window that has a context menu of its own to show or to hide: the browser's, on the web (SPEC §23.4).
Flutter: no counterpart
type Decorations ¶
type Decorations int
Decorations is how the title bar and the borders of a window are made. The zero value, DecorationsUnspecified, means DecorationsAuto.
Flutter: no counterpart
const ( // DecorationsUnspecified is the zero value and means DecorationsAuto. // // Flutter: no counterpart DecorationsUnspecified Decorations = iota // DecorationsAuto uses the first of these that works: the compositor's own // (server-side), libdecor, and the title bar of the framework (SPEC §8.2). // // Flutter: no counterpart DecorationsAuto // DecorationsApp skips the first two: the app places a WindowDecoration or its // own title bar. // // Flutter: no counterpart DecorationsApp // DecorationsLibdecor uses libdecor even where the compositor has its own title // bars; without libdecor it is DecorationsAuto. It is a test aid // (GLUTTER_DECORATIONS=libdecor): the apps ask for DecorationsAuto or // DecorationsApp. // // Flutter: no counterpart DecorationsLibdecor )
The values of Decorations.
type DesktopProvider ¶
type DesktopProvider interface {
// Desktop returns the services. It may be called from any goroutine.
Desktop() mobile.Services
}
DesktopProvider is implemented by a Platform that has the desktop services of package desktop itself, because the desktop has no D-Bus to offer them (Android, SPEC §24.11): opening a URI and notifications. A platform without it is served by D-Bus (Linux), or by its own Desktop in internal/platform/web (the web).
Flutter: no counterpart
type Display ¶
type Display struct {
// ID identifies the display.
ID int
// Name is the name the compositor or X server gives the display.
Name string
// Bounds is the display's position and size in logical pixels.
Bounds ui.Rect
// DevicePixelRatio is the number of physical pixels per logical pixel.
DevicePixelRatio float64
// RefreshRate is the refresh rate in frames per second.
RefreshRate float64
// Primary is whether this is the primary display.
Primary bool
}
Display describes one connected display.
Flutter: ui/window.dart Display
type ExitController ¶
type ExitController interface {
// CanExit says whether the app may end Run when it asks to exit.
CanExit() bool
}
ExitController is implemented by a Platform whose app cannot end itself: a web page cannot close itself, so the engine does nothing when the app asks to exit (SPEC §23.3).
Flutter: no counterpart
type FileDialogHost ¶
type FileDialogHost interface {
// ShowFileDialog shows the dialog and waits for the user. It must not be called on the UI thread.
// A user who closes the dialog is a result with Cancelled set, not an error. It fails with
// FileChooserUnavailable when the dialog cannot be made and with FileChooserFailed for any other
// failure; ctx closes the dialog.
ShowFileDialog(ctx context.Context, spec FileDialogSpec) (FileDialogResult, error)
}
FileDialogHost is implemented by the desktop services of a platform that has file dialogs of its own.
Flutter: no counterpart
type FileDialogKind ¶
type FileDialogKind int
FileDialogKind is the kind of a file dialog.
Flutter: no counterpart
const ( // FileDialogOpen opens one file, several files, or a folder. // // Flutter: no counterpart FileDialogOpen FileDialogKind = iota // FileDialogSave saves one file. // // Flutter: no counterpart FileDialogSave // FileDialogSaveMany saves several files, with the names given, into one folder. // // Flutter: no counterpart FileDialogSaveMany )
The kinds of file dialog.
type FileDialogResult ¶
type FileDialogResult struct {
// Cancelled says that the user closed the dialog without choosing.
Cancelled bool
// Paths are what the user chose, as paths of the file system.
Paths []string
// Filter is the name of the filter that was selected, when the dialog says.
Filter string
}
FileDialogResult is the answer of a file dialog.
Flutter: no counterpart
type FileDialogSpec ¶
type FileDialogSpec struct {
Kind FileDialogKind
// Owner is the handle of the window the dialog belongs to, as PortalHandleProvider gives it; empty
// for none.
Owner string
// Title and AcceptLabel are the title of the dialog and the text of its accept button.
Title, AcceptLabel string
// Filters are the kinds of file the dialog offers; the first is chosen.
Filters []FileFilter
// Multiple and Directory are the options of FileDialogOpen.
Multiple, Directory bool
// Folder is the folder the dialog opens in and FileName the name the file starts with.
Folder, FileName string
// Names are the names of the files of FileDialogSaveMany.
Names []string
}
FileDialogSpec is a dialog to show.
Flutter: no counterpart
type FileFilter ¶
FileFilter is a kind of file that a dialog offers: a name and the patterns ("*.png").
Flutter: no counterpart
type FontAntialiasing ¶
type FontAntialiasing int
FontAntialiasing is how the system wants text smoothed. The zero value, FontAntialiasingUnspecified, means the platform does not say.
Flutter: no counterpart
const ( // FontAntialiasingUnspecified is the zero value. // // Flutter: no counterpart FontAntialiasingUnspecified FontAntialiasing = iota // FontAntialiasingNone draws glyphs without smoothing. // // Flutter: no counterpart FontAntialiasingNone // FontAntialiasingGrayscale smooths glyphs with gray levels. // // Flutter: no counterpart FontAntialiasingGrayscale // FontAntialiasingRGBA smooths glyphs per color channel (sub-pixel). // // Flutter: no counterpart FontAntialiasingRGBA )
The values of FontAntialiasing.
type FontHinting ¶
type FontHinting int
FontHinting is how strongly the system wants glyph outlines fitted to the pixel grid. The zero value, FontHintingUnspecified, means the platform does not say.
Flutter: no counterpart
const ( // FontHintingUnspecified is the zero value. // // Flutter: no counterpart FontHintingUnspecified FontHinting = iota // FontHintingNone does no hinting. // // Flutter: no counterpart FontHintingNone // FontHintingSlight hints vertically only. // // Flutter: no counterpart FontHintingSlight // FontHintingMedium hints moderately. // // Flutter: no counterpart FontHintingMedium // FontHintingFull hints fully. // // Flutter: no counterpart FontHintingFull )
The values of FontHinting.
type GamepadHost ¶
type GamepadHost interface {
Gamepads() Gamepads
}
GamepadHost is implemented by the host of the dispatcher (the engine) and found through ui.PlatformDispatcher.HostAs: it gives access to the gamepad service of the platform, or nil when the platform has none.
Flutter: no counterpart
type Gamepads ¶
type Gamepads interface {
// MappingPlatform names the platform for the table of mappings: "Linux", "Windows", "Android" or "Web". It decides
// which built-in mappings are loaded and which platform: fields of an app's mapping files apply.
MappingPlatform() string
// Start begins to look for pads and to report them to h. It may be called again after Stop.
Start(h PadHandler) error
// Stop ends it: no more calls reach the handler and what the backend holds is released.
Stop()
// Rumble makes the pad's motors turn for d (0 stops them); the strengths are from 0 to 65535. It fails with
// GamepadRumbleUnavailable when the pad or the platform cannot, and with a tag of the backend's own when the system refuses.
Rumble(id PadID, low, high uint16, d time.Duration) error
// RumbleTriggers does the same for the motors of the triggers, and fails the same way.
RumbleTriggers(id PadID, left, right uint16, d time.Duration) error
// SetLED sets the colour of the pad's light. It fails with GamepadLEDUnavailable when the pad or the platform cannot.
SetLED(id PadID, r, g, b uint8) error
}
Gamepads is the gamepad service of a platform.
Flutter: no counterpart
type Handler ¶
type Handler interface {
// OnPointer delivers a batch of pointer reports, in order.
OnPointer(data []ui.PointerData)
// OnKey delivers one key event.
OnKey(data ui.KeyData)
// OnTextInput delivers a text-input event from the IME.
OnTextInput(event ui.TextInputEvent)
// OnFrame asks for a frame of the view. The duration is the frame time
// since an arbitrary fixed point in the past.
OnFrame(view ui.ViewID, frameTime time.Duration)
// OnMetrics reports a new size or scale of the view.
OnMetrics(view ui.ViewID, metrics ViewMetrics)
// OnLifecycle reports a change of the application lifecycle state.
OnLifecycle(state ui.AppLifecycleState)
// OnDrop delivers a drag-and-drop event over a view (event.ViewID) and returns
// the action the app accepts at that place, DropActionNone for none. The drop
// carries the data, which the platform has read by then.
OnDrop(event ui.DropEvent) ui.DropActions
// OnDragEnd reports how a drag that the app started with Window.StartDrag ended.
OnDragEnd(result ui.DragResult)
// OnDisplaysChanged reports that the displays changed: one was connected or
// disconnected, or one changed its size, scale or refresh rate. Platform.Displays
// has the new list.
OnDisplaysChanged()
// OnSettings reports changed system settings.
OnSettings(settings Settings)
// OnViewFocus reports that a view got the focus (true) or lost it (false): the
// window is the one the user works in, as the compositor or the window manager
// says (Wayland: the activated state of the toplevel; X11: the focus events, or
// the active window). It is also the first thing the platform tells about the
// focus of a new window, as soon as it is known, so a window that is not active
// gets a false. When it moves from one view to another, the old view is told
// first. A platform that has a keyboard focus of its own, which can differ from
// this one, also tells KeyboardFocusHandler.
OnViewFocus(view ui.ViewID, focused bool)
// OnContentLost reports that what the window shows is no longer the last frame
// that was presented (an X11 window was exposed, and the server kept nothing of
// it), so that the next frame must be presented whole, whatever changed in it.
OnContentLost(view ui.ViewID)
// OnCloseRequest reports that the user asked to close the view. Returning
// true closes the window; false keeps it open.
OnCloseRequest(view ui.ViewID) bool
}
Handler receives everything the platform reports. The engine implements it. Its methods are called on the UI thread, inside Platform.Run.
Flutter: no counterpart (the embedder's callbacks into the engine)
type KeyboardFocusHandler ¶
type KeyboardFocusHandler interface {
// OnKeyboardFocus reports that the keys now go to a view (true) or no longer do
// (false).
OnKeyboardFocus(view ui.ViewID, focused bool)
}
KeyboardFocusHandler is implemented by a handler that wants to know which window the keys go to. A platform whose keyboard focus is not the focus of its windows (Wayland: wl_keyboard.enter and leave, against the activated state; a seat may have no keyboard at all) calls it besides Handler.OnViewFocus, and the handler routes the keys, the text input and the input method to that window. Platforms that do not call it route them to the window of OnViewFocus.
Flutter: no counterpart
type MenuBar ¶
type MenuBar interface {
// SetMenus replaces the menus of the menu bar with the top-level menus of the app, or with the
// platform's default menu bar when the list is empty. The handler gets the callbacks of the items
// until the next call.
SetMenus(menus []ui.PlatformMenuItemData, h ui.PlatformMenuHandler)
}
MenuBar is implemented by a Platform whose apps have a menu bar that the app fills (macOS): the engine finds it with a type assertion and gives it the menus of a PlatformMenuBar. Called on the UI thread.
Flutter: no counterpart (the plugin of the flutter/menu channel, shell/platform/darwin/macos/framework/Source/FlutterMenuPlugin.mm)
type MouseCursor ¶
type MouseCursor int
MouseCursor is a cursor shown over a window: one of Flutter's system mouse cursors. The zero value, MouseCursorUnspecified, means the platform's default arrow, like MouseCursorBasic.
Flutter: services/mouse_cursor.dart SystemMouseCursors
const ( // MouseCursorUnspecified is the zero value: the default arrow. // // Flutter: no counterpart MouseCursorUnspecified MouseCursor = iota // MouseCursorNone hides the cursor. // // Flutter: services/mouse_cursor.dart SystemMouseCursors.none MouseCursorNone // MouseCursorBasic is the arrow. // // Flutter: services/mouse_cursor.dart SystemMouseCursors.basic MouseCursorBasic // MouseCursorClick is the pointing hand, for something that can be clicked. // // Flutter: services/mouse_cursor.dart SystemMouseCursors.click MouseCursorClick // MouseCursorForbidden says the action is not allowed. // // Flutter: services/mouse_cursor.dart SystemMouseCursors.forbidden MouseCursorForbidden // MouseCursorWait says the app is busy and cannot be used. // // Flutter: services/mouse_cursor.dart SystemMouseCursors.wait MouseCursorWait // MouseCursorProgress says the app is busy but can still be used. // // Flutter: services/mouse_cursor.dart SystemMouseCursors.progress MouseCursorProgress // MouseCursorContextMenu says a context menu is available. // // Flutter: services/mouse_cursor.dart SystemMouseCursors.contextMenu MouseCursorContextMenu // MouseCursorHelp says help is available. // // Flutter: services/mouse_cursor.dart SystemMouseCursors.help MouseCursorHelp // MouseCursorText is the I-beam, for text that can be selected. // // Flutter: services/mouse_cursor.dart SystemMouseCursors.text MouseCursorText // MouseCursorVerticalText is the I-beam for vertical text. // // Flutter: services/mouse_cursor.dart SystemMouseCursors.verticalText MouseCursorVerticalText // MouseCursorCell is the cross of a spreadsheet cell. // // Flutter: services/mouse_cursor.dart SystemMouseCursors.cell MouseCursorCell // MouseCursorPrecise is the crosshair. // // Flutter: services/mouse_cursor.dart SystemMouseCursors.precise MouseCursorPrecise // MouseCursorMove says an item can be moved. // // Flutter: services/mouse_cursor.dart SystemMouseCursors.move MouseCursorMove // MouseCursorGrab is the open hand, for something that can be grabbed. // // Flutter: services/mouse_cursor.dart SystemMouseCursors.grab MouseCursorGrab // MouseCursorGrabbing is the closed hand, for something being dragged. // // Flutter: services/mouse_cursor.dart SystemMouseCursors.grabbing MouseCursorGrabbing // MouseCursorNoDrop says the item cannot be dropped here. // // Flutter: services/mouse_cursor.dart SystemMouseCursors.noDrop MouseCursorNoDrop // MouseCursorAlias says a shortcut will be made. // // Flutter: services/mouse_cursor.dart SystemMouseCursors.alias MouseCursorAlias // MouseCursorCopy says the item will be copied. // // Flutter: services/mouse_cursor.dart SystemMouseCursors.copy MouseCursorCopy // MouseCursorDisappearing says the item will disappear. // // Flutter: services/mouse_cursor.dart SystemMouseCursors.disappearing MouseCursorDisappearing // MouseCursorAllScroll says the content scrolls in every direction. // // Flutter: services/mouse_cursor.dart SystemMouseCursors.allScroll MouseCursorAllScroll // MouseCursorResizeLeftRight resizes horizontally. // // Flutter: services/mouse_cursor.dart SystemMouseCursors.resizeLeftRight MouseCursorResizeLeftRight // MouseCursorResizeUpDown resizes vertically. // // Flutter: services/mouse_cursor.dart SystemMouseCursors.resizeUpDown MouseCursorResizeUpDown // MouseCursorResizeUpLeftDownRight resizes along the diagonal from the top // left to the bottom right. // // Flutter: services/mouse_cursor.dart SystemMouseCursors.resizeUpLeftDownRight MouseCursorResizeUpLeftDownRight // MouseCursorResizeUpRightDownLeft resizes along the diagonal from the top // right to the bottom left. // // Flutter: services/mouse_cursor.dart SystemMouseCursors.resizeUpRightDownLeft MouseCursorResizeUpRightDownLeft // MouseCursorResizeUp moves the top edge. // // Flutter: services/mouse_cursor.dart SystemMouseCursors.resizeUp MouseCursorResizeUp // MouseCursorResizeDown moves the bottom edge. // // Flutter: services/mouse_cursor.dart SystemMouseCursors.resizeDown MouseCursorResizeDown // MouseCursorResizeLeft moves the left edge. // // Flutter: services/mouse_cursor.dart SystemMouseCursors.resizeLeft MouseCursorResizeLeft // MouseCursorResizeRight moves the right edge. // // Flutter: services/mouse_cursor.dart SystemMouseCursors.resizeRight MouseCursorResizeRight // MouseCursorResizeUpLeft moves the top left corner. // // Flutter: services/mouse_cursor.dart SystemMouseCursors.resizeUpLeft MouseCursorResizeUpLeft // MouseCursorResizeUpRight moves the top right corner. // // Flutter: services/mouse_cursor.dart SystemMouseCursors.resizeUpRight MouseCursorResizeUpRight // MouseCursorResizeDownLeft moves the bottom left corner. // // Flutter: services/mouse_cursor.dart SystemMouseCursors.resizeDownLeft MouseCursorResizeDownLeft // MouseCursorResizeDownRight moves the bottom right corner. // // Flutter: services/mouse_cursor.dart SystemMouseCursors.resizeDownRight MouseCursorResizeDownRight // MouseCursorResizeColumn resizes a column. // // Flutter: services/mouse_cursor.dart SystemMouseCursors.resizeColumn MouseCursorResizeColumn // MouseCursorResizeRow resizes a row. // // Flutter: services/mouse_cursor.dart SystemMouseCursors.resizeRow MouseCursorResizeRow // MouseCursorZoomIn says the content will zoom in. // // Flutter: services/mouse_cursor.dart SystemMouseCursors.zoomIn MouseCursorZoomIn // MouseCursorZoomOut says the content will zoom out. // // Flutter: services/mouse_cursor.dart SystemMouseCursors.zoomOut MouseCursorZoomOut )
The values of MouseCursor follow the declaration order of Flutter's SystemMouseCursors.
func MouseCursorFromKind ¶
func MouseCursorFromKind(kind string) (MouseCursor, bool)
MouseCursorFromKind returns the cursor of a Flutter system mouse cursor kind ("click", "resizeUpDown"), and false for a kind it does not know.
Flutter: services/mouse_cursor.dart SystemMouseCursor.kind
func (MouseCursor) String ¶
func (c MouseCursor) String() string
String returns the name of the cursor, such as "MouseCursorText".
Flutter: services/mouse_cursor.dart SystemMouseCursors
func (MouseCursor) Valid ¶
func (c MouseCursor) Valid() bool
Valid reports whether the cursor is one of the values above.
Flutter: no counterpart
type NopHandler ¶
type NopHandler struct{}
NopHandler is a Handler that ignores every event and agrees to every close request. It is for tests and for the development examples that only need a window.
Flutter: no counterpart
func (NopHandler) OnCloseRequest ¶
func (NopHandler) OnCloseRequest(ui.ViewID) bool
OnCloseRequest agrees to close the view.
Flutter: no counterpart
func (NopHandler) OnContentLost ¶
func (NopHandler) OnContentLost(ui.ViewID)
OnContentLost ignores the loss.
Flutter: no counterpart
func (NopHandler) OnDisplaysChanged ¶
func (NopHandler) OnDisplaysChanged()
OnDisplaysChanged ignores the change.
Flutter: no counterpart
func (NopHandler) OnDragEnd ¶
func (NopHandler) OnDragEnd(ui.DragResult)
OnDragEnd ignores the end of a drag.
Flutter: no counterpart
func (NopHandler) OnDrop ¶
func (NopHandler) OnDrop(ui.DropEvent) ui.DropActions
OnDrop ignores the drop event and accepts nothing.
Flutter: no counterpart
func (NopHandler) OnFrame ¶
func (NopHandler) OnFrame(ui.ViewID, time.Duration)
OnFrame ignores the frame request.
Flutter: no counterpart
func (NopHandler) OnKey ¶
func (NopHandler) OnKey(ui.KeyData)
OnKey ignores the key event.
Flutter: no counterpart
func (NopHandler) OnLifecycle ¶
func (NopHandler) OnLifecycle(ui.AppLifecycleState)
OnLifecycle ignores the lifecycle change.
Flutter: no counterpart
func (NopHandler) OnMetrics ¶
func (NopHandler) OnMetrics(ui.ViewID, ViewMetrics)
OnMetrics ignores the new metrics.
Flutter: no counterpart
func (NopHandler) OnPointer ¶
func (NopHandler) OnPointer([]ui.PointerData)
OnPointer ignores the pointer data.
Flutter: no counterpart
func (NopHandler) OnSettings ¶
func (NopHandler) OnSettings(Settings)
OnSettings ignores the new settings.
Flutter: no counterpart
func (NopHandler) OnTextInput ¶
func (NopHandler) OnTextInput(ui.TextInputEvent)
OnTextInput ignores the text-input event.
Flutter: no counterpart
func (NopHandler) OnViewFocus ¶
func (NopHandler) OnViewFocus(ui.ViewID, bool)
OnViewFocus ignores the focus change.
Flutter: no counterpart
type OpenRequestHandler ¶
type OpenRequestHandler interface {
// OnOpenRequest reports that the system asks the app to open URLs or files.
OnOpenRequest(request ui.OpenRequest)
}
OpenRequestHandler is implemented by a handler that wants the requests of the system to open URLs and files (ui.OpenRequest, SPEC §8.7 "Open requests"): a click on a link of a scheme the app handles, a double click on a document of its type. A platform where they come as events and not as arguments of the program (macOS: application:openURLs:) calls it, also for the ones that started the app. OpenRequest calls it when the handler has it.
Flutter: no counterpart
type PadBattery ¶
type PadBattery struct {
Pad PadID
State PadPowerState
// Percent is the charge from 0 to 100, or -1 when the pad does not say.
Percent int
}
PadBattery is the battery state that a pad reported.
Flutter: no counterpart
type PadEvent ¶
type PadEvent struct {
Pad PadID
// Time is when the report was made, on the system's monotonic clock.
Time time.Duration
Kind PadEventKind
Index int
Value int
}
PadEvent is a report of one input of a pad.
Flutter: no counterpart
type PadEventKind ¶
type PadEventKind uint8
PadEventKind says what a PadEvent reports.
Flutter: no counterpart
const ( // PadAxis is a raw axis: Value is from -32768 to 32767. // // Flutter: no counterpart PadAxis PadEventKind = iota // PadButton is a raw button: Value is 1 when it is down and 0 when it is up. // // Flutter: no counterpart PadButton // PadHat is a raw hat: Value is a mask of 1 (up), 2 (right), 4 (down) and 8 (left). // // Flutter: no counterpart PadHat )
type PadExtras ¶
type PadExtras interface {
// EnableExtras wakes the extras. It may be called before Start, which makes the service start awake, and again, which does
// nothing. A pad that a driver serves from now on is told to the handler as removed and added again, once, when it moves
// from its event device (or Raw Input) to its driver.
EnableExtras()
}
PadExtras is implemented by the Gamepads of a backend that has more than it needs to read the buttons and axes: the HID drivers of Linux and Windows, which write to the pads (the enhanced mode, the light, the rumble reports). A service of this kind starts asleep: it only reads, and writes to no pad, until EnableExtras is called (SPEC §28.2, "Decided in step 36.1"). A backend that has no extras does not implement it.
Flutter: no counterpart
type PadExtrasHandler ¶
type PadExtrasHandler interface {
PadTouch(t PadTouch)
PadSensor(s PadSensor)
PadBattery(b PadBattery)
}
PadExtrasHandler is implemented by a PadHandler that takes more than the buttons and axes: the touchpad, the motion sensors and the battery of the pads that have them. A backend whose pads have none never looks for it. The methods are called on the UI thread, in order with the events, like the methods of PadHandler.
Flutter: no counterpart
type PadHandler ¶
type PadHandler interface {
// PadAdded tells that a pad is connected. The pads that are there when Start is called are reported first.
PadAdded(info PadInfo)
// PadRemoved tells that the pad is gone.
PadRemoved(id PadID)
// PadEvents gives the reports of the pads, oldest first. The slice is valid during the call only.
PadEvents(events []PadEvent)
}
PadHandler receives what a Gamepads backend finds. Its methods are called on the UI thread, in the order of the events, and never from inside Start.
Flutter: no counterpart
type PadID ¶
type PadID int64
PadID names a pad while it is connected. The platform makes it; it is never reused during a run.
Flutter: no counterpart
type PadInfo ¶
type PadInfo struct {
ID PadID
// Name is the name of the pad, as gamepaddb.DeviceName makes it.
Name string
// GUID identifies the model (gamepaddb.GUID).
GUID [16]byte
// Path says where the pad is on the system ("/dev/input/event7"); it is empty where there is no such thing.
Path string
// Axes, Buttons and Hats are the numbers of raw axes, buttons and hats; the indices of PadEvent count from zero in them.
Axes, Buttons, Hats int
// Mapping is a mapping text ("a:b0,b:b1,...") that the backend made from what the pad reports, used when the table of
// mappings has none for the GUID; empty when the backend made none.
Mapping string
// Standard says that the pad reports the standard layout already: its raw buttons and axes are in the order of
// gamepaddb's Button and Axis, and no mapping is applied (a browser's "standard" mapping, XInput).
Standard bool
// Rumble, RumbleTriggers and LED say what the pad can do.
Rumble, RumbleTriggers, LED bool
// Battery is the charge of the pad from 0 to 100, or -1 when it is not known.
Battery int
// ButtonMask says which buttons of the layout a Standard pad has, one bit for each gamepaddb.Button; 0 means all of them.
// A pad that reports raw inputs gets its buttons from its mapping instead.
ButtonMask uint32
// Touchpads is the number of touchpads of the pad (a PlayStation pad has one); each reports two fingers.
Touchpads int
// Sensors says that the pad has a gyroscope and an accelerometer, and SensorRate is how many readings of each it makes in
// a second (0 when it does not say).
Sensors bool
SensorRate float32
}
PadInfo is what a backend knows of a pad when it reports it.
Flutter: no counterpart
type PadPowerState ¶
type PadPowerState uint8
PadPowerState says what a pad does with its battery.
Flutter: no counterpart
const ( // PadPowerUnknown is a pad that does not say. // // Flutter: no counterpart PadPowerUnknown PadPowerState = iota // PadOnBattery is a pad that runs on its battery. // // Flutter: no counterpart PadOnBattery // PadCharging is a pad whose battery is charging. // // Flutter: no counterpart PadCharging // PadCharged is a pad whose battery is full while it is plugged in. // // Flutter: no counterpart PadCharged )
type PadSensor ¶
type PadSensor struct {
Pad PadID
// Time is when the report that held the reading was made, on the system's monotonic clock; SensorTime is when the sensor
// made the reading, on the sensor's own clock (it only means something between two readings of the same sensor).
Time, SensorTime time.Duration
Kind PadSensorKind
Values [3]float32
}
PadSensor is a reading of a motion sensor of a pad. The axes are x to the right, y up and z out of the face of the pad when it lies flat with its sticks up, with the signs of the PlayStation pads, to which the others are made to agree.
Flutter: no counterpart
type PadSensorControl ¶
type PadSensorControl interface {
// SetPadSensors turns the sensors of the pad on or off. It fails with GamepadSensorsUnavailable when the pad has none.
SetPadSensors(id PadID, on bool) error
}
PadSensorControl is implemented by the Gamepads of a backend whose pads have motion sensors: they report only while an app wants them, which saves the pad's battery and the bandwidth of its link.
Flutter: no counterpart
type PadSensorKind ¶
type PadSensorKind uint8
PadSensorKind is the kind of a sensor of a pad.
Flutter: no counterpart
const ( // PadGyroscope is the gyroscope: Values are in radians a second. // // Flutter: no counterpart PadGyroscope PadSensorKind = iota // PadAccelerometer is the accelerometer: Values are in metres a second squared, gravity included. // // Flutter: no counterpart PadAccelerometer )
type PadTouch ¶
type PadTouch struct {
Pad PadID
// Time is when the report was made, on the system's monotonic clock.
Time time.Duration
// Touchpad and Finger number the touchpad and the finger, from 0.
Touchpad, Finger int
Down bool
X, Y, Pressure float32
}
PadTouch is a finger on a touchpad of a pad, reported by the backends whose pads have one (the HID drivers of PlayStation pads, SPEC §28.2). X and Y are from 0 to 1, from the top left corner; Down says that the finger is on the pad.
Flutter: no counterpart
type Platform ¶
type Platform interface {
// Run owns the UI thread's event loop. It delivers events to h and returns
// nil when ctx is cancelled or the platform has nothing left to show. A
// second call while Run is active fails with PlatformAlreadyRunning.
Run(ctx context.Context, h Handler) error
// Post runs fn on the UI thread. It is safe to call from any goroutine and
// wakes the loop. Functions posted by one goroutine run in the order that
// goroutine posted them.
Post(fn func())
// NewWindow creates a top-level window; the engine turns it into a view.
NewWindow(cfg WindowConfig) (Window, error)
// Displays lists the connected displays.
Displays() []Display
// Clipboard returns the system clipboard.
Clipboard() Clipboard
// Settings returns the current system settings. Changes arrive through
// Handler.OnSettings.
Settings() Settings
// Services returns the optional desktop capabilities of this platform, or
// nil when it has none.
Services() Services
}
Platform is the contract between the engine and an operating system backend. Only the engine talks to it, and only on the UI thread, except for Post.
Flutter: no counterpart (the embedder API)
type PointerLockHandler ¶
type PointerLockHandler interface {
// OnPointerLockEnded reports that the lock of the view's window ended.
OnPointerLockEnded(view ui.ViewID)
}
PointerLockHandler is implemented by a handler that wants to know when a lock ended by itself: the compositor or the browser ended it, or the window lost the focus (SPEC §27.6). A platform calls it, on the UI thread, once for each lock that ends this way, and never for an UnlockPointer of the app.
Flutter: no counterpart
type PointerLocker ¶
type PointerLocker interface {
// LockPointer asks for the lock. It fails with ui.TagPointerLockUnavailable (the platform lacks what it needs) or
// ui.TagPointerLockDenied (it refuses). Platforms that need the compositor's or the browser's answer lock
// at once from the app's point of view: a refusal comes later as PointerLockHandler.OnPointerLockEnded. Locking
// a window that is locked is not an error.
LockPointer() error
// UnlockPointer ends the lock and shows the cursor again. Nothing happens without a lock. It does not call
// PointerLockHandler.OnPointerLockEnded.
UnlockPointer()
}
PointerLocker is implemented by a Window that can lock the pointer (SPEC §27.6): the cursor is hidden and the mouse reports motion without a position. A window that does not implement it, or a platform that cannot, makes the engine fail the lock with ui.TagPointerLockUnavailable.
While the lock lasts, the pointer events of the mouse keep the position the pointer had when the lock began (PhysicalX and PhysicalY), carry the motion in PhysicalDeltaX and PhysicalDeltaY (unaccelerated where the platform has it), and the buttons still make down and up events there.
Flutter: no counterpart
type PortalHandleProvider ¶
type PortalHandleProvider interface {
// PortalHandle calls done on the UI thread with the handle of the window, or with
// an empty string when the window has none (a compositor without
// zxdg_exporter_v2).
PortalHandle(done func(handle string))
}
PortalHandleProvider is implemented by a Window that can say how the portals of xdg-desktop-portal name it as the parent of a dialog (SPEC §8.9): "wayland:<handle>" from zxdg_exporter_v2, or "x11:<window id in hex>".
Flutter: no counterpart
type ScreenshotPoster ¶
type ScreenshotPoster interface {
// PostScreenshot sends the PNG to where the host collects it. It returns at once;
// done is called later, on the UI thread, with the error if the PNG did not arrive.
PostScreenshot(png []byte, done func(err error))
}
ScreenshotPoster is implemented by a Platform that cannot write files, so that the self-capture of the engine (GLUTTER_SCREENSHOT) hands the PNG over to it instead: the web posts it to the server that serves the page (SPEC §23.8).
Flutter: no counterpart
type ScriptWaiter ¶
type ScriptWaiter interface {
// ScriptPending says that a script was given and has not run its last step yet.
ScriptPending() bool
}
ScriptWaiter is implemented by a Platform that runs a script of synthetic events (GLUTTER_DEV_EVENTS in debug builds), so that the self-capture of the engine waits for the script to end before it takes the frame: a capture that only counted time took the frame before the script's keys had come when the machine was busy.
Flutter: no counterpart
type SensorDevice ¶
type SensorDevice interface {
// Rate is the number of readings a second that the sensor was set to, or 0 when the backend does not know it.
Rate() float64
// Close ends the sensor. When it returns the handler is not running and is never called again.
Close() error
}
SensorDevice is a sensor that is open. The handler it was opened with is called until Close returns.
Flutter: no counterpart
type SensorHandler ¶
type SensorHandler interface {
// SensorReadings gets the readings made since the last call, oldest first. The slice is valid only during the call.
SensorReadings(readings []SensorReading)
}
SensorHandler is what a sensor calls with the readings it made. It may be called on any thread.
Flutter: no counterpart
type SensorKind ¶
type SensorKind uint8
SensorKind is the kind of a motion sensor of the device (SPEC §28.4).
Flutter: no counterpart
const ( // SensorAccelerometer measures the acceleration of the device with gravity included, in m/s², along the axes of the device in // its natural orientation: x to the right, y up and z out of the screen. A device that lies flat on a table, face up, reads // about 9.8 on z. // // Flutter: no counterpart SensorAccelerometer SensorKind = iota // SensorGyroscope measures the rate of rotation about the same axes, in rad/s, counterclockwise as seen from the positive // end of the axis (the right-hand rule). // // Flutter: no counterpart SensorGyroscope )
type SensorOpenOptions ¶
type SensorOpenOptions struct {
// Rate is the number of readings a second that the app would like; 0 leaves it to the backend (60, or the fastest that the
// sensor can do if that is slower). A backend that cannot choose (the web's, which gets an event whenever the browser has
// one) ignores it; SensorDevice.Rate says what the device does.
Rate float64
}
SensorOpenOptions are what an app asks of a sensor when it opens it.
Flutter: no counterpart
type SensorReading ¶
type SensorReading struct {
// Time is when the reading was made, on a monotonic clock of the platform (nanoseconds from an arbitrary start): only the
// difference of two readings of the same sensor means something.
Time time.Duration
// Values are x, y and z, in the unit and the axes of the kind.
Values [3]float64
}
SensorReading is one reading of a sensor.
Flutter: no counterpart
type Sensors ¶
type Sensors interface {
// Available says whether the device has a sensor of the kind (the web cannot know before the first reading and says yes
// where the browser has the events).
Available(kind SensorKind) bool
// Open opens a sensor and starts it. It fails with SensorUnavailable when the device has no such sensor, SensorPermissionDenied
// when the user refused it, and SensorOpenFailed for the rest. Where the system asks the user, the call waits for the answer
// until ctx ends.
Open(ctx context.Context, kind SensorKind, opts SensorOpenOptions, h SensorHandler) (SensorDevice, error)
}
Sensors is the motion sensors service of a platform (SPEC §28.4).
Flutter: no counterpart
type SensorsHost ¶
type SensorsHost interface {
// Sensors returns the sensors service, or nil.
Sensors() Sensors
// AddReleaseHook registers a function that the host calls when the app ends, so that a sensor that is still open is closed
// before the process leaves. The function runs on the UI thread.
AddReleaseHook(fn func())
}
SensorsHost is implemented by the host of the dispatcher (the engine) and found through ui.PlatformDispatcher.HostAs: it gives access to the sensors service of the platform, or nil when the platform has none.
Flutter: no counterpart
type Services ¶
type Services interface {
// Accessibility returns the bridge to the assistive technologies, or nil.
Accessibility() Accessibility
// Gamepads returns the gamepad service (SPEC §28.2), or nil when the platform has none.
Gamepads() Gamepads
// Audio returns the audio service (SPEC §28.3), or nil when the platform has none.
Audio() Audio
// Sensors returns the motion sensors service (SPEC §28.4), or nil when the platform has none.
Sensors() Sensors
}
Services groups the optional capabilities of a platform that the engine uses. Each accessor returns nil when the capability is absent. (The desktop services of package desktop, such as the tray and the notifications, are made by the app.)
Flutter: no counterpart
type Settings ¶
type Settings struct {
// PlatformBrightness is the system color scheme.
PlatformBrightness ui.Brightness
// AccentColor is the system accent color. It is meaningful only when
// HasAccentColor is true.
AccentColor ui.Color
// HasAccentColor is whether the system has an accent color.
HasAccentColor bool
// TextScaleFactor is the system text scale; 0 means 1.
TextScaleFactor float64
// ScaleFontSize, when it is not nil, scales a font size in logical pixels the way the system
// does: not linearly on Android 14 and later. It is called on the UI thread. A platform that
// scales text linearly leaves it nil and the factor is used.
ScaleFontSize func(fontSize float64) float64
// AlwaysUse24HourFormat is whether the user wants times in 24-hour format.
AlwaysUse24HourFormat bool
// BoldText is whether the user asked for bold text.
BoldText bool
// DisableAnimations is whether the user asked for reduced motion.
DisableAnimations bool
// HighContrast is whether the user asked for high contrast.
HighContrast bool
// OnOffSwitchLabels is whether the user asked for labels on switches (iOS: On/Off Labels).
OnOffSwitchLabels bool
// ReduceTransparency is whether the user asked for less transparency and blur.
ReduceTransparency bool
// DifferentiateWithoutColor is whether the user asked that color is not the only way things are told apart.
DifferentiateWithoutColor bool
// use (AccessibilityFeatures.AccessibleNavigation).
AccessibleNavigation bool
// Locales lists the user's locales, most preferred first.
Locales []ui.Locale
// CursorSize is the size of the mouse cursor in pixels; 0 means the
// platform default.
CursorSize int
// CursorTheme is the name of the XCursor theme; empty means the
// platform default.
CursorTheme string
// FontAntialiasing is how the system wants text smoothed.
FontAntialiasing FontAntialiasing
// FontHinting is how strongly the system wants glyph outlines fitted to
// the pixel grid.
FontHinting FontHinting
// UIFontFamily and UIFontSize are the family and the size, in points, of the
// desktop's interface font (GNOME's font-name); empty and 0 when the platform
// does not say.
UIFontFamily string
UIFontSize float64
// MonospaceFontFamily and MonospaceFontSize are the family and the size, in
// points, of the desktop's monospace font (GNOME's monospace-font-name); empty and
// 0 when the platform does not say.
MonospaceFontFamily string
MonospaceFontSize float64
// CaretBlinkTime is the time the caret of a text field stays on, and then off, as the
// system says (Windows: GetCaretBlinkTime). Zero means the platform does not say and the
// framework's 500 ms is used; ui.CaretBlinkNever means the user turned blinking off.
//
// Deviation: Flutter blinks at a fixed half period (SPEC §12.10).
CaretBlinkTime time.Duration
// DoubleClickTime is the longest time between the two clicks of a double click, as the
// system says (Windows: GetDoubleClickTime); zero means the platform does not say.
//
// Deviation: Flutter's double-tap timeout is a constant, kDoubleTapTimeout (SPEC §12.10).
DoubleClickTime time.Duration
}
Settings is the system-wide configuration the app follows.
Flutter: ui/platform_dispatcher.dart PlatformConfiguration
type SurfaceHandler ¶
type SurfaceHandler interface {
// OnSurfaceLost says that the native surface lost is no longer valid. It is called on the UI
// thread, before the platform lets go of the native window, and the renderer must not use the
// handle after it returns.
OnSurfaceLost(view ui.ViewID, lost gpu.SurfaceHandle)
}
SurfaceHandler is implemented by a Handler that is told when the native surface of a view goes away while the view stays: an Android activity gets a new Surface when the user comes back to the app (SPEC §24.4). The renderer lets go of what it made for the old surface; the next frame attaches the new one, which the platform asks for once there is one.
Flutter: shell/platform/android/android_surface.h AndroidSurface (the surface is made again)
type SurfaceRenewer ¶
type SurfaceRenewer interface {
// RenewSurface replaces the native surface.
RenewSurface()
}
SurfaceRenewer is implemented by a Window whose native surface can be replaced by a new one: the web's canvas keeps the first kind of context it was asked for, so a renderer that follows a failed one needs a canvas that has had none (SPEC §9.6). The window keeps its size, its input and its place; the new surface is blank until the next frame.
Flutter: no counterpart
type SyncInputHandler ¶
type SyncInputHandler interface {
// OnKeySync handles the key event now and reports whether the framework handled it.
OnKeySync(data ui.KeyData) bool
// OnPointerSync handles the pointer data now. The OnRespond functions of the data
// have been called, for the data that is answered, when it returns.
OnPointerSync(data []ui.PointerData)
// OnTextInputSync handles the text-input event now. A platform whose text field holds the
// text (the web's) needs the framework's answer, the new state of the field, before the next
// event of the field is read, so that it does not take its own echo for a change.
OnTextInputSync(event ui.TextInputEvent)
}
SyncInputHandler is implemented by a Handler that can handle input at once and say what the framework made of it, for a platform whose events need the answer before the event handler returns: the web calls preventDefault on a key that the framework handled and on a wheel that a scrollable took (SPEC §23.3). The input that arrived earlier and is still waiting for its frame is handled first, so the order stays as it arrived.
Flutter: no counterpart (the synchronous invokeOnKeyData and invokeOnPointerDataPacket of the web engine)
type Tray ¶
type Tray interface {
// Update gives the icon its new model; only what differs from the old one is told to the system.
Update(spec TraySpec)
// Close takes the icon out of the tray. Closing twice does nothing.
Close()
}
Tray is the icon of the app in the system tray. Its methods belong to the UI thread.
Flutter: no counterpart
type TrayHost ¶
type TrayHost interface {
// NewTray puts an icon in the tray. It must be called on the UI thread, and fails with
// TrayDuplicate when the app has a tray already and with TrayRegisterFailed when the icon cannot
// be added.
NewTray(spec TraySpec) (Tray, error)
}
TrayHost is implemented by the desktop services of a platform that has a system tray of its own.
Flutter: no counterpart
type TrayMenuItem ¶
type TrayMenuItem struct {
// Label is the text of the item.
Label string
// Separator makes the entry a line between two groups; its other fields are ignored.
Separator bool
// Disabled greys the item out; Hidden leaves it out of the menu.
Disabled, Hidden bool
// Checkable gives the item a check mark and Radio a radio mark; Checked says whether it is set.
Checkable, Radio, Checked bool
// Children are the entries of a submenu.
Children []TrayMenuItem
// OnPressed is called, on the UI thread, when the user chooses the item.
OnPressed func()
}
TrayMenuItem is an entry of the menu of a tray icon: an item, a separator or, with Children, a submenu.
Flutter: no counterpart
type TraySpec ¶
type TraySpec struct {
// ID and Title name the icon to the system; the platform may not show them.
ID, Title string
// Tooltip is the first line of the tip that shows when the pointer rests on the icon and
// TooltipBody the text under it.
Tooltip, TooltipBody string
// Icon is the picture of the icon; the picture nearest to the size of a small icon is used. Without
// pictures the icon of the program is used.
Icon ui.WindowIcon
// Menu is the menu of the icon.
Menu []TrayMenuItem
// OnActivate is called, on the UI thread, for a click on the icon (the primary action), and
// OnSecondaryActivate for a click with the middle button.
OnActivate, OnSecondaryActivate func()
}
TraySpec is what the app asks the tray icon to be.
Flutter: no counterpart
type ViewMetrics ¶
type ViewMetrics struct {
// PhysicalSize is the size of the view in physical pixels.
PhysicalSize ui.Size
// DevicePixelRatio is the number of physical pixels per logical pixel.
DevicePixelRatio float64
// ViewPadding is the area the system covers, in physical pixels.
ViewPadding ui.ViewPadding
// ViewInsets is the area covered by system UI the app can draw below.
ViewInsets ui.ViewPadding
// SystemGestureInsets is the area where the system handles gestures.
SystemGestureInsets ui.ViewPadding
// Display is the display the view is on. None means the engine chooses
// (the primary display).
Display foundation.Opt[int]
// Window says who draws the title bar and what state the window is in. A
// backend that does not know leaves the zero value.
Window ui.WindowInfo
}
ViewMetrics describes the size, scale and system areas of a view. Only the size and the scale are required; the engine fills in the rest from the display and the defaults.
Flutter: ui/window.dart ViewConfiguration
type Window ¶
type Window interface {
// ID returns the ID of the view this window shows.
ID() ui.ViewID
// NativeSurface returns the handle that a GPU backend renders into.
NativeSurface() gpu.SurfaceHandle
// SetTitle sets the window title.
SetTitle(title string)
// SetSize asks for a new window size, in logical pixels.
SetSize(size ui.Size)
// SetSizeConstraints sets the smallest and the largest size of the window in
// logical pixels; zero means no limit. The compositor may ignore it.
SetSizeConstraints(min, max ui.Size)
// SetState asks for the window to be maximized, minimized, fullscreen or
// back to normal.
SetState(state WindowState)
// SetHidden takes the window off the screen (true): no surface, no task-bar
// entry, no input and no focus; or puts it back (false) with the size, title,
// icon and state it had, and asks for the focus. A hidden window still exists:
// Run does not return because of it. While it is hidden it asks for no frame;
// a frame requested meanwhile is drawn once it is shown. It reports whether the
// platform can hide windows: one that cannot (the web) ignores the request and
// returns false.
SetHidden(hidden bool) bool
// SetCursor sets the mouse cursor shown over the window.
SetCursor(cursor MouseCursor)
// SetTextInput tells the IME about the focused text field. A zero
// ui.TextInputState with Enabled false disables text input.
SetTextInput(state ui.TextInputState)
// RequestFrame asks for Handler.OnFrame to be called for this window, at the
// next moment the compositor wants a frame. At most one frame is in flight
// per window: requests made while one is in flight are merged into one more
// frame, after the compositor is done with the first. The handler must
// present exactly one frame for each OnFrame, or no further frame follows.
RequestFrame()
// StartDrag starts a drag-and-drop operation from this window.
StartDrag(request ui.DragRequest) error
// PerformWindowAction does what the title bar of the app asks: move, resize,
// the window menu, minimize, maximize, restore and close. Moves, resizes and
// the menu need the input event that is going on. An action that the platform
// cannot do is ignored.
PerformWindowAction(action ui.WindowAction)
// Close destroys the window. Destroy the GPU surface of the window first.
Close()
// SetIcon sets the icon of the window; the zero icon removes it. It fails with
// the platform's error when the icon cannot be used. A platform that has no
// window icons ignores it.
SetIcon(icon ui.WindowIcon) error
// SetContentType gives the compositor a hint about what the window shows. A
// platform without such hints ignores it.
SetContentType(contentType ui.ContentType)
// KeepScreenOn stops the screen from going idle while the window is visible
// (on is true), or lets it go idle again. It fails with IdleInhibitUnavailable
// when the platform cannot.
KeepScreenOn(on bool) error
}
Window is one top-level native window. All methods are for the UI thread.
Flutter: no counterpart (the embedder's view API)
type WindowConfig ¶
type WindowConfig struct {
// Kind is the kind of window.
Kind WindowKind
// Parent is the view of the parent window of a dialog.
Parent ui.ViewID
// HasParent is whether Parent is set.
HasParent bool
// Modal is whether a dialog blocks its parent.
Modal bool
// Title is the window title.
Title string
// AppID is the application ID: the Wayland app_id or the X11 WM_CLASS. It
// must match the app's .desktop file.
AppID string
// Size is the initial size in logical pixels. A zero size lets the backend
// choose.
Size ui.Size
// MinSize is the smallest size in logical pixels; zero means no minimum.
MinSize ui.Size
// MaxSize is the largest size in logical pixels; zero means no maximum.
MaxSize ui.Size
// Resizable is whether the user can resize the window. None means the
// default, true; use IsResizable to read it.
Resizable foundation.Opt[bool]
// Decorated is whether the window has a title bar and borders. None means
// the default, true; use IsDecorated to read it.
Decorated foundation.Opt[bool]
// State is the initial window state.
State WindowState
// Decorations is how the title bar is made; it does not matter when Decorated
// is false.
Decorations Decorations
// Icon is the icon of the window; the zero value is none.
Icon ui.WindowIcon
// ContentType is the hint about what the window shows.
ContentType ui.ContentType
}
WindowConfig describes a window to create.
Flutter: widgets/_window.dart WindowController
func DefaultWindowConfig ¶
func DefaultWindowConfig() WindowConfig
DefaultWindowConfig returns a WindowConfig with the defaults: a regular, resizable, decorated window of a size the backend chooses. It is the zero value.
Flutter: no counterpart
func (WindowConfig) IsDecorated ¶
func (c WindowConfig) IsDecorated() bool
IsDecorated is whether the window has a title bar and borders; the default is true.
Flutter: no counterpart
func (WindowConfig) IsResizable ¶
func (c WindowConfig) IsResizable() bool
IsResizable is whether the user can resize the window; the default is true.
Flutter: no counterpart
type WindowKind ¶
type WindowKind int
WindowKind is the kind of a window. The zero value, WindowKindUnspecified, means WindowKindRegular.
Flutter: widgets/_window.dart WindowArchetype
const ( // WindowKindUnspecified is the zero value and means WindowKindRegular. // // Flutter: no counterpart WindowKindUnspecified WindowKind = iota // WindowKindRegular is an ordinary top-level window. // // Flutter: widgets/_window.dart WindowArchetype.regular WindowKindRegular // WindowKindDialog is a dialog, optionally modal, of a parent window. // // Flutter: widgets/_window.dart WindowArchetype.dialog WindowKindDialog // WindowKindBorderless is a window without decorations, such as a // tooltip-style window. // // Flutter: no counterpart WindowKindBorderless )
The values of WindowKind.
type WindowState ¶
type WindowState int
WindowState is the state of a window. The zero value, WindowStateUnspecified, means WindowStateNormal.
Flutter: no counterpart
const ( // WindowStateUnspecified is the zero value and means WindowStateNormal. // // Flutter: no counterpart WindowStateUnspecified WindowState = iota // WindowStateNormal is a window that is neither maximized, minimized nor // fullscreen. // // Flutter: no counterpart WindowStateNormal // WindowStateMaximized is a maximized window. // // Flutter: no counterpart WindowStateMaximized // WindowStateMinimized is a minimized (iconified) window. // // Flutter: no counterpart WindowStateMinimized // WindowStateFullscreen is a fullscreen window. // // Flutter: no counterpart WindowStateFullscreen )
The values of WindowState.
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
Package android is the platform backend for Android (GOOS=android, SPEC §24): the JNI entry points the Java embedding calls, the thread that runs the program's main, the log lines sent to logcat, and, from step 25.3, the looper, the surface, the input and the services.
|
Package android is the platform backend for Android (GOOS=android, SPEC §24): the JNI entry points the Java embedding calls, the thread that runs the program's main, the log lines sent to logcat, and, from step 25.3, the looper, the surface, the input and the services. |
|
aaudio
Package aaudio is the AAudio backend of the audio service on Android (SPEC §28.3, step 31.6): playback and capture of float32 frames through libaaudio.so (Android 8, API 26), called through purego, with a data callback that is made once, the low-latency performance mode, a stream that is made again when the device it was on is disconnected, and a device that pauses while the app is hidden.
|
Package aaudio is the AAudio backend of the audio service on Android (SPEC §28.3, step 31.6): playback and capture of float32 frames through libaaudio.so (Android 8, API 26), called through purego, with a data callback that is made once, the low-latency performance mode, a stream that is made again when the device it was on is disconnected, and a device that pauses while the app is hidden. |
|
asensor
Package asensor is the motion sensors backend of Android (SPEC §28.4, step 31.7): the accelerometer and the gyroscope through the sensor manager of the NDK (libandroid.so, Android 8, API 26), called through purego, with the events of every open sensor read on a looper that lives on an OS thread of its own.
|
Package asensor is the motion sensors backend of Android (SPEC §28.4, step 31.7): the accelerometer and the gyroscope through the sensor manager of the NDK (libandroid.so, Android 8, API 26), called through purego, with the events of every open sensor read on a looper that lives on an OS thread of its own. |
|
Package darwin holds what macOS and iOS share (SPEC §29.2): the loader of the system frameworks (dl), the Objective-C helpers (objcx), Core Foundation (cf), and the layout test helper for the Go mirrors of C structures (layouttest).
|
Package darwin holds what macOS and iOS share (SPEC §29.2): the loader of the system frameworks (dl), the Objective-C helpers (objcx), Core Foundation (cf), and the layout test helper for the Go mirrors of C structures (layouttest). |
|
a11ymodel
Package a11ymodel is the plain-Go model of the accessibility bridges of macOS and iOS (SPEC §29.10, §30.7): the mirror of the semantics trees of the views of the app, built from ui.SemanticsUpdate, and the changes between two trees that become notifications.
|
Package a11ymodel is the plain-Go model of the accessibility bridges of macOS and iOS (SPEC §29.10, §30.7): the mirror of the semantics trees of the views of the app, built from ui.SemanticsUpdate, and the changes between two trees that become notifications. |
|
cf
Package cf is the part of Core Foundation that the macOS and iOS backends use (SPEC §29.2, §29.3): strings, dictionaries, the run loop, and the version-0 run loop sources and the timers that carry Post and the timer heap of the UI thread.
|
Package cf is the part of Core Foundation that the macOS and iOS backends use (SPEC §29.2, §29.3): strings, dictionaries, the run loop, and the version-0 run loop sources and the timers that carry Post and the timer heap of the UI thread. |
|
coreaudio
Package coreaudio is the audio backend of macOS and iOS (SPEC §29.11, §30.10): Core Audio's AudioQueue for playback and capture, with the list of devices and its changes from the property listeners of the system object.
|
Package coreaudio is the audio backend of macOS and iOS (SPEC §29.11, §30.10): Core Audio's AudioQueue for playback and capture, with the list of devices and its changes from the property listeners of the system object. |
|
dl
Package dl is the one safe way to load the system frameworks of macOS and iOS and to call into them without cgo: it wraps purego's Dlopen, Dlsym and callbacks, tags every failure, and offers the libc helpers (malloc, free, C strings) that the backends share.
|
Package dl is the one safe way to load the system frameworks of macOS and iOS and to call into them without cgo: it wraps purego's Dlopen, Dlsym and callbacks, tags every failure, and offers the libc helpers (malloc, free, C strings) that the backends share. |
|
layouttest
Package layouttest checks the Go mirrors of C and Objective-C structures that the macOS and iOS backends pass to and get from the system (NSRect, CGPoint, CVTimeStamp, AudioStreamBasicDescription, ...) against the headers of the SDK (SPEC §29.2, §8.1 rule 3).
|
Package layouttest checks the Go mirrors of C and Objective-C structures that the macOS and iOS backends pass to and get from the system (NSRect, CGPoint, CVTimeStamp, AudioStreamBasicDescription, ...) against the headers of the SDK (SPEC §29.2, §8.1 rule 3). |
|
loop
Package loop has the plain-Go parts of the run loop that macOS and iOS share (SPEC §29.3, §30.2): the heap of timers that one CFRunLoopTimer is set to, the merging of the frame requests of a window, the pacer that starts and stops the display link, and the gate that offers one tick of a display link's thread at a time to the loop.
|
Package loop has the plain-Go parts of the run loop that macOS and iOS share (SPEC §29.3, §30.2): the heap of timers that one CFRunLoopTimer is set to, the merging of the frame requests of a window, the pacer that starts and stops the display link, and the gate that offers one tick of a display link's thread at a time to the loop. |
|
mainthread
Package mainthread runs the tests of a macOS program on the main thread: AppKit works only there (SPEC §29.3), and the Go test runner runs every test on a goroutine of its own.
|
Package mainthread runs the tests of a macOS program on the main thread: AppKit works only there (SPEC §29.3), and the Go test runner runs every test on a goroutine of its own. |
|
notify
Package notify is the numbering and the life of the notifications of an app on macOS and iOS (SPEC §29.9, §30.6) and, in center_darwin.go, UNUserNotificationCenter behind it.
|
Package notify is the numbering and the life of the notifications of an app on macOS and iOS (SPEC §29.9, §30.6) and, in center_darwin.go, UNUserNotificationCenter behind it. |
|
objcx
Package objcx is Glutter's thin layer over purego's objc package (SPEC §29.2): selectors made once, Foundation values (NSString, NSNumber, NSArray, NSURL, NSError) to and from Go, autorelease pools, blocks, and the registry of the Objective-C classes that Go implements (the app delegate, the view, the accessibility elements), whose instances find their Go object by a handle.
|
Package objcx is Glutter's thin layer over purego's objc package (SPEC §29.2): selectors made once, Foundation values (NSString, NSNumber, NSArray, NSURL, NSError) to and from Go, autorelease pools, blocks, and the registry of the Objective-C classes that Go implements (the app delegate, the view, the accessibility elements), whose instances find their Go object by a handle. |
|
openuri
Package openuri is the check that comes before a URI is opened on macOS and iOS (SPEC §29.9, §30.6): the part of opening that is plain Go, so that its tests run on any host.
|
Package openuri is the check that comes before a URI is opened on macOS and iOS (SPEC §29.9, §30.6): the part of opening that is plain Go, so that its tests run on any host. |
|
Package fake is a scripted platform for tests: it replays queued events and records what the engine asks of it.
|
Package fake is a scripted platform for tests: it replays queued events and records what the engine asks of it. |
|
Package ios is the platform of iOS (SPEC §30): UIKit through purego's objc (SPEC §29.2, the helpers of internal/platform/darwin) and, in the *_ios.go files only, the few lines of cgo that Go's iOS port needs (D35: the port links externally and purego needs cgo there, so the files that name the frameworks to link carry `import "C"`; nothing else is in C).
|
Package ios is the platform of iOS (SPEC §30): UIKit through purego's objc (SPEC §29.2, the helpers of internal/platform/darwin) and, in the *_ios.go files only, the few lines of cgo that Go's iOS port needs (D35: the port links externally and purego needs cgo there, so the files that name the frameworks to link carry `import "C"`; nothing else is in C). |
|
a11y
Package a11y is the plain-Go part of the accessibility bridge of iOS (SPEC §30.7): what a node of the semantics tree is to UIAccessibility: whether it is an element, its label, value and hint, its traits, the actions that VoiceOver can do on it and the scroll directions that VoiceOver sends.
|
Package a11y is the plain-Go part of the accessibility bridge of iOS (SPEC §30.7): what a node of the semantics tree is to UIAccessibility: whether it is an element, its label, value and hint, its traits, the actions that VoiceOver can do on it and the scroll directions that VoiceOver sends. |
|
Package linux holds what the Linux backends share: the event loop, the key tables, system settings and the choice between Wayland and X11.
|
Package linux holds what the Linux backends share: the event loop, the key tables, system settings and the choice between Wayland and X11. |
|
alsa
Package alsa is the ALSA backend of the audio service on Linux (SPEC §28.3, step 31.5), for the systems where no PulseAudio (or PipeWire) server answers: playback and capture of float32 frames through libasound's PCM interface, on a goroutine of its own for each device.
|
Package alsa is the ALSA backend of the audio service on Linux (SPEC §28.3, step 31.5), for the systems where no PulseAudio (or PipeWire) server answers: playback and capture of float32 frames through libasound's PCM interface, on a goroutine of its own for each device. |
|
dl
Package dl is the one safe way to load C libraries and call into them without cgo: it wraps purego's Dlopen, Dlsym and callbacks, tags every failure, and offers the libc helpers (malloc, free, C strings) that the backends share.
|
Package dl is the one safe way to load C libraries and call into them without cgo: it wraps purego's Dlopen, Dlsym and callbacks, tags every failure, and offers the libc helpers (malloc, free, C strings) that the backends share. |
|
dl/layouttest
Package layouttest is the helper for the layout test that every Go mirror of a C struct needs (SPEC §8.1 rule 3).
|
Package layouttest is the helper for the layout test that every Go mirror of a C struct needs (SPEC §8.1 rule 3). |
|
evdev
Package evdev is the gamepad backend of Linux: it finds the pads among the event devices of /dev/input, reads their buttons, axes and hats, and reports them to the pad manager (internal/pads) through platform.Gamepads.
|
Package evdev is the gamepad backend of Linux: it finds the pads among the event devices of /dev/input, reads their buttons, axes and hats, and reports them to the pad manager (internal/pads) through platform.Gamepads. |
|
fontconfig
Package fontconfig binds libfontconfig (through purego, SPEC §8.1) to match a font family, weight, slant and language to the font files of the system, in the fallback order the user's fontconfig settings give.
|
Package fontconfig binds libfontconfig (through purego, SPEC §8.1) to match a font family, weight, slant and language to the font files of the system, in the fallback order the user's fontconfig settings give. |
|
ime
Package ime connects a window system backend to an input method framework over D-Bus (IBus or Fcitx5): the same way for X11, and for Wayland on a compositor without text-input-v3 (SPEC §8.3, §8.6).
|
Package ime connects a window system backend to an input method framework over D-Bus (IBus or Fcitx5): the same way for X11, and for Wayland on a compositor without text-input-v3 (SPEC §8.3, §8.6). |
|
ime/imetest
Package imetest has test doubles for the input method of the Linux backends: an input method that records its calls, and a poster that lets the test run what the bridge hands to the UI thread.
|
Package imetest has test doubles for the input method of the Linux backends: an input method that records its calls, and a poster that lets the test run what the bridge hands to the UI thread. |
|
input
Package input turns what the Linux windowing systems report about pointers and touch screens into ui.PointerData, the same way for Wayland and X11.
|
Package input turns what the Linux windowing systems report about pointers and touch screens into ui.PointerData, the same way for Wayland and X11. |
|
pixelpool
Package pixelpool is the buffers of one window that a CPU renderer draws into: the part of the Wayland and X11 backends that hands a buffer out only when the display server no longer reads it, and says how old its content is (SPEC §9.6; steps 32.1 and 32.2).
|
Package pixelpool is the buffers of one window that a CPU renderer draws into: the part of the Wayland and X11 backends that hands a buffer out only when the display server no longer reads it, and says how old its content is (SPEC §9.6; steps 32.1 and 32.2). |
|
pulse
Package pulse is the PulseAudio backend of the audio service on Linux (SPEC §28.3, step 31.5): playback and capture streams of float32 frames on libpulse's threaded main loop, the devices and the default device of the server, and a notification when they change.
|
Package pulse is the PulseAudio backend of the audio service on Linux (SPEC §28.3, step 31.5): playback and capture streams of float32 frames on libpulse's threaded main loop, the devices and the default device of the server, and a notification when they change. |
|
wayland
Package wayland is the Wayland backend.
|
Package wayland is the Wayland backend. |
|
wayland/decor
Package decor binds libdecor, the library that draws native title bars for Wayland compositors without server-side decorations (GNOME).
|
Package decor binds libdecor, the library that draws native title bars for Wayland compositors without server-side decorations (GNOME). |
|
wayland/fakecomp
Package fakecomp is a tiny fake Wayland compositor for tests: it speaks the wire protocol over a socket pair, answers the requests that the tests send, and logs them.
|
Package fakecomp is a tiny fake Wayland compositor for tests: it speaks the wire protocol over a socket pair, answers the requests that the tests send, and logs them. |
|
wayland/wl
Package wl is the Wayland client: the runtime over libwayland-client, which is bound with purego, and the Go bindings of every protocol in ../protocols, generated by `glutter-gen wayland` into the *_gen.go files.
|
Package wl is the Wayland client: the runtime over libwayland-client, which is bound with purego, and the Go bindings of every protocol in ../protocols, generated by `glutter-gen wayland` into the *_gen.go files. |
|
x11
Package x11 is the X11 backend.
|
Package x11 is the X11 backend. |
|
xkb
Package xkb binds libxkbcommon (through purego, SPEC §8.1) and turns key presses into Flutter key data: the physical key, the logical key and the text, for any keyboard layout, with dead keys and compose sequences.
|
Package xkb binds libxkbcommon (through purego, SPEC §8.1) and turns key presses into Flutter key data: the physical key, the logical key and the text, for any keyboard layout, with dead keys and compose sequences. |
|
Package macos is the platform backend of macOS: AppKit through purego and its objc package, with no cgo (SPEC §29).
|
Package macos is the platform backend of macOS: AppKit through purego and its objc package, with no cgo (SPEC §29). |
|
a11y
Package a11y is the accessibility bridge of macOS (SPEC §29.10): a plain-Go model of the semantics trees of the views of the app and the mapping of a node to what NSAccessibility says about an element (its role, label, value, help, state, actions and text range), and, in the files for macOS, the elements that VoiceOver and the Accessibility Inspector read and the notifications that tell them of a change.
|
Package a11y is the accessibility bridge of macOS (SPEC §29.10): a plain-Go model of the semantics trees of the views of the app and the mapping of a node to what NSAccessibility says about an element (its role, label, value, help, state, actions and text range), and, in the files for macOS, the elements that VoiceOver and the Accessibility Inspector read and the notifications that tell them of a change. |
|
iokit
Package iokit is the gamepad backend of macOS (SPEC §29.11): the pads that IOKit's HID manager reports, read as raw axes, buttons and hats, and the pads that have a HID driver (package gamepadhid), read through their reports.
|
Package iokit is the gamepad backend of macOS (SPEC §29.11): the pads that IOKit's HID manager reports, read as raw axes, buttons and hats, and the pads that have a HID driver (package gamepadhid), read through their reports. |
|
Package mobile is the logic of the desktop services of package desktop on a mobile platform (Android in 1.6, SPEC §24.11): opening a URI with an intent and showing notifications through the system's notification manager.
|
Package mobile is the logic of the desktop services of package desktop on a mobile platform (Android in 1.6, SPEC §24.11): opening a URI with an intent and showing notifications through the system's notification manager. |
|
Package padstd helps the backends whose pads already report the standard layout (XInput on Windows, the standard mapping of a browser): such a pad is a PadInfo with Standard set, and its raw buttons and axes are the Button and Axis of gamepaddb in the order of the layout.
|
Package padstd helps the backends whose pads already report the standard layout (XInput on Windows, the standard mapping of a browser): such a pad is a PadInfo with Standard set, and its raw buttons and axes are the Button and Axis of gamepaddb in the order of the layout. |
|
Package pointerconv is the converter of the pointer events of a platform that reports them raw, as Flutter's engine has one (Converter): it keeps the state of each device and synthesizes the events that the framework expects in between.
|
Package pointerconv is the converter of the pointer events of a platform that reports them raw, as Flutter's engine has one (Converter): it keeps the state of each device and synthesizes the events that the framework expects in between. |
|
Package textedit is the model behind a text field that the platform keeps outside the framework (the hidden DOM field of the web, SPEC §23.5, and the Editable of the Android input method, SPEC §24.6), as plain Go: the editing state in UTF-16 units, the composition, and the editor that turns each change of the platform's field into the ui.TextInputEvent that makes the framework's field the same.
|
Package textedit is the model behind a text field that the platform keeps outside the framework (the hidden DOM field of the web, SPEC §23.5, and the Editable of the Android input method, SPEC §24.6), as plain Go: the editing state in UTF-16 units, the composition, and the editor that turns each change of the platform's field into the ui.TextInputEvent that makes the framework's field the same. |
|
Package web is the platform backend of the web (GOOS=js GOARCH=wasm, SPEC §23): one window that is a canvas in a host element of the page, frames from requestAnimationFrame, and the lifecycle and the settings of the browser.
|
Package web is the platform backend of the web (GOOS=js GOARCH=wasm, SPEC §23): one window that is a canvas in a host element of the page, frames from requestAnimationFrame, and the lifecycle and the settings of the browser. |
|
audiotest
command
Command audiotest is the program of the browser tests of the audio of the web (step 31.6, SPEC §28.3, §28.8).
|
Command audiotest is the program of the browser tests of the audio of the web (step 31.6, SPEC §28.3, §28.8). |
|
desktoptest
command
Command desktoptest is the program of the browser tests of the web desktop services (step 21.6, SPEC §17, §23.7).
|
Command desktoptest is the program of the browser tests of the web desktop services (step 21.6, SPEC §17, §23.7). |
|
inputtest
command
Command inputtest is the program of the browser tests of the web input (step 21.2, SPEC §17, §23.4).
|
Command inputtest is the program of the browser tests of the web input (step 21.2, SPEC §17, §23.4). |
|
padtest
command
Command padtest is the program of the browser test of the gamepads of the web (step 31.2, SPEC §28.2, §28.8).
|
Command padtest is the program of the browser test of the gamepads of the web (step 31.2, SPEC §28.2, §28.8). |
|
sensortest
command
Command sensortest is the program of the browser tests of the motion sensors and the haptics of the web (step 31.7, SPEC §28.4, §28.8).
|
Command sensortest is the program of the browser tests of the motion sensors and the haptics of the web (step 31.7, SPEC §28.4, §28.8). |
|
synthetic
Package synthetic dispatches synthetic DOM events at the canvas of a Glutter app, the way the browser would deliver real ones: the debug-only script of the web platform (GLUTTER_DEV_EVENTS, for proof screenshots) and the browser tests use it.
|
Package synthetic dispatches synthetic DOM events at the canvas of a Glutter app, the way the browser would deliver real ones: the debug-only script of the web platform (GLUTTER_DEV_EVENTS, for proof screenshots) and the browser tests use it. |
|
texttest
command
Command texttest is the program of the browser tests of the web text input and clipboard (step 21.3, SPEC §17, §23.5).
|
Command texttest is the program of the browser tests of the web text input and clipboard (step 21.3, SPEC §17, §23.5). |
|
Package windows is the Win32 platform backend (SPEC §25): the windows, the message loop, the frame pacing, the displays and the process start of Windows (step 28.2), behind internal/platform; the pointer input (step 28.3), the keyboard (step 28.4), the text input and the input methods (step 28.5, with package ime); the clipboard, the system settings, the list of fonts and the lifecycle (step 28.6), and the tray, the notifications, the file dialogs and the opening of URIs (step 28.11); and OLE drag and drop and the windows that an app opens besides the first (step 28.12, with package ole).
|
Package windows is the Win32 platform backend (SPEC §25): the windows, the message loop, the frame pacing, the displays and the process start of Windows (step 28.2), behind internal/platform; the pointer input (step 28.3), the keyboard (step 28.4), the text input and the input methods (step 28.5, with package ime); the clipboard, the system settings, the list of fonts and the lifecycle (step 28.6), and the tray, the notifications, the file dialogs and the opening of URIs (step 28.11); and OLE drag and drop and the windows that an app opens besides the first (step 28.12, with package ole). |
|
ime
Package ime is the text input of the Windows backend as plain Go: the composition of an input method (IMM32, SPEC §25.7) turned into the ui.TextInputEvents of the framework by the model of internal/platform/textedit, the characters of the keyboard that no key made, and the places of the composition and candidate windows.
|
Package ime is the text input of the Windows backend as plain Go: the composition of an input method (IMM32, SPEC §25.7) turned into the ui.TextInputEvents of the framework by the model of internal/platform/textedit, the characters of the keyboard that no key made, and the places of the composition and candidate windows. |
|
ime/imetest
Package imetest is a fake of the input method manager (ime.IMM) for the tests of the text input of Windows, in the ime package and in the window code that uses it.
|
Package imetest is a fake of the input method manager (ime.IMM) for the tests of the text input of Windows, in the ime package and in the window code that uses it. |
|
ole
Package ole is the OLE drag and drop of the Windows backend (SPEC §25.10): the COM objects that Go makes for it (IDropTarget, IDropSource, IDataObject and IEnumFORMATETC, SPEC §25.2), the reader of a data object that another program made, and the plain-Go models they stand on, which are tested on any host: the effects and the keys that choose among them, the formats and their names, the set of data that a drag offers, the enumerator of formats, and the decisions of the drag source.
|
Package ole is the OLE drag and drop of the Windows backend (SPEC §25.10): the COM objects that Go makes for it (IDropTarget, IDropSource, IDataObject and IEnumFORMATETC, SPEC §25.2), the reader of a data object that another program made, and the plain-Go models they stand on, which are tested on any host: the effects and the keys that choose among them, the formats and their names, the set of data that a drag offers, the enumerator of formats, and the decisions of the drag source. |
|
uia
Package uia is the accessibility bridge of Windows (SPEC §25.11): it mirrors the framework's semantics tree as UI Automation providers, so that Narrator, NVDA, JAWS and Accessibility Insights can read the app and act on it.
|
Package uia is the accessibility bridge of Windows (SPEC §25.11): it mirrors the framework's semantics tree as UI Automation providers, so that Narrator, NVDA, JAWS and Accessibility Insights can read the app and act on it. |
|
uia/callshim
Package callshim calls a function of the Windows calling convention with floating-point arguments, for the tests of UI Automation (SPEC §25.2): syscall.SyscallN passes integers only, and a COM method that takes a double (IRawElementProviderFragmentRoot::ElementProviderFromPoint, IRangeValueProvider::SetValue, and the client's SetValue and SetScrollPercent) gets it in a floating register.
|
Package callshim calls a function of the Windows calling convention with floating-point arguments, for the tests of UI Automation (SPEC §25.2): syscall.SyscallN passes integers only, and a COM method that takes a double (IRawElementProviderFragmentRoot::ElementProviderFromPoint, IRangeValueProvider::SetValue, and the client's SetValue and SetScrollPercent) gets it in a floating register. |
|
uia/semtree
Package semtree builds semantics updates for the tests of UI Automation (SPEC §25.11): the nodes the way the engine fills them in, so that a test states only what it cares about.
|
Package semtree builds semantics updates for the tests of UI Automation (SPEC §25.11): the nodes the way the engine fills them in, so that a test states only what it cares about. |
|
uia/uiatest
Package uiatest is the UI Automation client that tests use to look at the providers of package uia the way Narrator, NVDA and Accessibility Insights do (SPEC §25.11, §25.13): it creates CUIAutomation, finds the element of a window, walks the tree, reads properties, calls the patterns and listens to events.
|
Package uiatest is the UI Automation client that tests use to look at the providers of package uia the way Narrator, NVDA and Accessibility Insights do (SPEC §25.11, §25.13): it creates CUIAutomation, finds the element of a window, walks the tree, reads properties, calls the patterns and listens to events. |
|
wasapi
Package wasapi is the WASAPI backend of the audio service on Windows (SPEC §28.3, step 31.6): playback and capture of float32 frames through the shared mode of the Windows audio engine, driven by events, with the list of devices and the default device from the device enumerator and its notification client (a COM object that Go makes, SPEC §25.2).
|
Package wasapi is the WASAPI backend of the audio service on Windows (SPEC §28.3, step 31.6): playback and capture of float32 frames through the shared mode of the Windows audio engine, driven by events, with the list of devices and the default device from the device enumerator and its notification client (a COM object that Go makes, SPEC §25.2). |
|
win32
Package win32 is the one package that holds the bindings and the helpers for calling Windows without cgo (SPEC §25.2): System32-only DLL loading, the procedure tables, UTF-16 strings, the HRESULT and GetLastError errors, the COM calls over a vtable, the COM objects that Go implements, the callbacks, and the first kernel32 bindings.
|
Package win32 is the one package that holds the bindings and the helpers for calling Windows without cgo (SPEC §25.2): System32-only DLL loading, the procedure tables, UTF-16 strings, the HRESULT and GetLastError errors, the COM calls over a vtable, the COM objects that Go implements, the callbacks, and the first kernel32 bindings. |
|
win32/layouttest
Package layouttest checks the Go mirrors of Win32 and COM structures, and the positions of COM methods in their vtables, against the mingw-w64 headers (SPEC §25.2, §6.3 rule 11).
|
Package layouttest checks the Go mirrors of Win32 and COM structures, and the positions of COM methods in their vtables, against the mingw-w64 headers (SPEC §25.2, §6.3 rule 11). |
|
winpad
Package winpad is the gamepad service of Windows without the calls into Windows: it finds the pads that XInput serves and the HID pads that Raw Input lists, reads them, and reports them to the pad manager through platform.Gamepads (SPEC §28.2).
|
Package winpad is the gamepad service of Windows without the calls into Windows: it finds the pads that XInput serves and the HID pads that Raw Input lists, reads them, and reports them to the pad manager through platform.Gamepads (SPEC §28.2). |