Documentation
¶
Overview ¶
Package macos is the platform backend of macOS: AppKit through purego and its objc package, with no cgo (SPEC §29). It implements internal/platform.Platform: the app and its run loop on the main thread, the windows, the displays, input, text input, the pasteboard, settings, menus, the desktop services, drag and drop and accessibility. It is filled in by the steps of M33; until step 33.2 it is empty.
Its files are for darwin without ios (`darwin && !ios`); this file keeps the package listed on every OS. The helpers that macOS and iOS share are in internal/platform/darwin.
Flutter: engine/src/flutter/shell/platform/darwin/macos/framework/Source
Index ¶
Constants ¶
const ( // TagMacOSNotMainThread is the tag of the error of a platform made on a thread that is not the main // thread of the process: AppKit works only there (SPEC §29.3). TagMacOSNotMainThread = "MacOSNotMainThread" // TagPlatformAlreadyRunning is the tag of the error of a second Run while the first is active. TagPlatformAlreadyRunning = "PlatformAlreadyRunning" // TagMacOSWindowCreateFailed is the tag of the error of a window that AppKit did not make. TagMacOSWindowCreateFailed = "MacOSWindowCreateFailed" // TagMacOSDevEventsInvalid is the tag of the error of a GLUTTER_DEV_EVENTS script that cannot be read. TagMacOSDevEventsInvalid = "MacOSDevEventsInvalid" TagIdleInhibitUnavailable = "IdleInhibitUnavailable" )
The tags of the errors that package macos makes (SPEC §29.14; rm4n0s/errors, R5).
const DevEventsEnv = "GLUTTER_DEV_EVENTS"
DevEventsEnv is the environment variable with the script of synthetic events that debug builds replay after the first frame, so that a proof screenshot or a test can show an app after a click or a key (SPEC §29.6). It is read only in debug builds (foundation.DebugMode).
Flutter: no counterpart
const DevPasteboardEnv = "GLUTTER_DEV_PASTEBOARD"
DevPasteboardEnv is the environment variable with the name of a pasteboard that debug builds use instead of the general one, so that a test or a proof that copies and pastes never reads or changes the clipboard of the user (SPEC §29.7). It is read only in debug builds (foundation.DebugMode).
Flutter: no counterpart
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DevEvent ¶
type DevEvent struct {
// Kind is the name of the step: "wait", "move", "tap", "wheel", "key", or one of the pieces that "pan" is
// made of: "panbegin", "panstep" and "panend"; "text", "compose" and "composing" are the input method.
Kind string
// Text is the text of a "text" step, and Steps are the pieces of a "compose" or "composing" step, each
// the marked text of an update of the input method.
Text string
Steps []string
// Key is the physical key of a "key" step, in Flutter's names (KeyA, Digit1, Enter, ArrowLeft), and Mods
// the modifiers that are down while it is pressed: a "+"-joined subset of shift, control, alt and meta, in
// that order.
Key, Mods string
// Wait is how long to wait, for "wait".
Wait time.Duration
// X and Y are the place in the first window, in logical pixels from its top left.
X, Y float64
// DX and DY are the scroll of a "wheel" in logical pixels (positive scrolls down and to the right, as
// the web's deltas do), or the part of the scroll that a "panstep" does, in points of the trackpad.
DX, DY float64
}
DevEvent is one step of a dev events script.
Flutter: no counterpart
func ParseDevEvents ¶
ParseDevEvents reads a dev events script: steps separated by ";", each "name:arguments".
wait:500ms waits
move:x,y moves the mouse to the place (logical pixels of the first window, from its top left)
tap:x,y moves the mouse there and clicks the left button
wheel:x,y,dx,dy turns a notched wheel at the place; dx and dy are the scroll in logical pixels
(40 make a line; positive scrolls down and to the right)
key:Name[,mods] presses and releases a key, with the modifiers (shift, control, alt, meta, joined by
"+") pressed before it and released after it: key:KeyC,meta is Command+C. The names
are Flutter's physical keys: KeyA to KeyZ, Digit0 to Digit9, Enter, Tab, Space,
Backspace, Delete, Escape, ArrowLeft, ArrowRight, ArrowUp, ArrowDown, Home, End,
PageUp, PageDown, and F1 to F12
text:Hello types the text as an input method does when it composes nothing: one
insertText: for each character (the blanks are typed; \n and the other control
characters type nothing; no ";")
compose:a,b,c an input method composes a, then b, then c (setMarkedText: each), commits c
(insertText:) and ends the composition
composing:a,b,c the same, but the composition stays (a later compose: goes on with it)
pan:x,y,dx,dy[,d] a two-finger scroll of the trackpad at the place, with its phases: dx and dy are the
total scroll in points (positive moves the content down and to the right, as the
trackpad does), spread over the duration d (100ms when it is left out) in steps of
16 ms, followed by the end of the gesture
A step that is not known, or has the wrong arguments, fails with MacOSDevEventsInvalid.
Flutter: no counterpart
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
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. |
|
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. |