windows

package
v1.8.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 26, 2026 License: BSD-3-Clause Imports: 33 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

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). The calls to Windows go through package win32 (SPEC §6.3 rule 10).

The files of the backend that call Windows are named *_windows.go. The files with no OS tag hold the plain-Go parts, which are tested on any host: the timer heap, the frame requests, the pacer's state machine, the styles and sizes of the windows, the console decision, the reader of GLUTTER_DEV_EVENTS, the translators of the mouse, the wheel, touch and pen, and the keyboard (the key tables of keymap_gen.go, the converter and the message sessions), the conversions and the retry of the clipboard (clipboard.go), the settings (settings.go), the lifecycle table (lifecycle.go), the list of font files (fonts.go) and the desktop services (step 28.11: services.go has Desktop with the checks of URIs, tray.go the tray's model, diff and menu plan, balloon.go the queue of the notifications and filedialog.go the options and answers of the file dialogs, all over the calls that services_windows.go makes), drag and drop (step 28.12: dnd.go has the target of a window and the runner of the drags the app starts, modal.go the count of the dialogs that block a window, placement.go the places of new windows); the model of the input methods is package ime and the matching of fonts is internal/text/winfonts.

Flutter: the Windows embedder (engine/src/flutter/shell/platform/windows).

Index

Constants

View Source
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 Wine test can show an app after a click or a key (SPEC §25.6). It is read only in debug builds (foundation.DebugMode).

Flutter: no counterpart

View Source
const (
	// TagWindowsDevEventsInvalid is the tag of the error for a GLUTTER_DEV_EVENTS script that is
	// not valid; the metadata is "step".
	TagWindowsDevEventsInvalid = "WindowsDevEventsInvalid"
)

The tags of the errors that this file makes (rm4n0s/errors, R5).

Variables

This section is empty.

Functions

This section is empty.

Types

type Desktop

type Desktop struct {
	// contains filtered or unexported fields
}

Desktop is the desktop services of Windows (SPEC §25.9): opening a URI with ShellExecuteExW, the notifications as tray balloons, the system tray and the common item dialogs. ShowNotification, CloseNotification, OpenURI and ShowFileDialog may be called from any goroutine but the UI thread's; NewTray and the events of the shell belong to the UI thread.

Flutter: no counterpart (Flutter apps use the url_launcher, flutter_local_notifications, tray_manager and file_selector plugins)

func (*Desktop) Close

func (d *Desktop) Close()

Close deletes the notify icons and stops the timers; the services are not used afterwards. It runs on the UI thread.

Flutter: no counterpart

func (*Desktop) CloseNotification

func (d *Desktop) CloseNotification(ctx context.Context, id uint32) error

CloseNotification closes the notification with the ID, which calls its OnClose with CloseByApp. Closing one that is gone is not an error.

Flutter: no counterpart

func (*Desktop) NewTray

func (d *Desktop) NewTray(spec platform.TraySpec) (platform.Tray, error)

NewTray adds the icon of the app to the notification area with Shell_NotifyIconW: the service window is the owner, the callback message is the platform's own, and NOTIFYICON_VERSION_4 is asked for (an icon on an older shell keeps the old messages). An app has one tray at a time (TrayDuplicate); an icon that cannot be added is TrayRegisterFailed. It must be called on the UI thread.

Flutter: no counterpart (tray_manager)

func (*Desktop) OpenURI

func (d *Desktop) OpenURI(ctx context.Context, uri string) error

OpenURI opens the URI with ShellExecuteExW (verb open) on a worker thread (SPEC §25.9). Windows' own validation comes first, because ShellExecute also starts programs: see checkURI. A URI that has no handler, or that ShellExecuteEx refuses, is OpenURIUnavailable with the reason.

Flutter: no counterpart (url_launcher_windows: launchUrl)

func (*Desktop) ShowFileDialog

func (d *Desktop) ShowFileDialog(ctx context.Context, spec platform.FileDialogSpec) (platform.FileDialogResult, error)

ShowFileDialog shows the common item dialog on a worker thread and waits for the user (SPEC §25.9). A user who closes the dialog is a result with Cancelled set. A dialog that cannot be made is FileChooserUnavailable and any other failure FileChooserFailed. ctx closes the dialog.

Flutter: no counterpart (file_selector_windows)

func (*Desktop) ShowNotification

func (d *Desktop) ShowNotification(ctx context.Context, spec mobile.NotificationSpec) (uint32, error)

ShowNotification shows the notification as a tray balloon, or queues it behind the one that is shown (SPEC §25.9). It returns the notification's ID; ReplacesID of a notification that is shown or queued replaces it. An app that cannot show a balloon is NotificationsUnavailable and a shell that refuses the balloon WindowsBalloonFailed.

Flutter: no counterpart (flutter_local_notifications_windows)

type DevEvent

type DevEvent struct {
	// Kind is the name of the step: "wait", "move", "tap", "wheel", "key", "keydown", "keyup",
	// "text", "compose" or "composing".
	Kind 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, for "move",
	// "tap" and "wheel".
	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.
	DX, DY float64
	// Keys are the virtual-key codes of a "key", "keydown" or "keyup": "key" presses them in order
	// and releases them in the opposite order.
	Keys []uint32
	// Text is the text of a "text" step.
	Text string
	// Steps are the pieces of a "compose" or "composing" step, each the composition string of an
	// update.
	Steps []string
}

DevEvent is one step of a dev events script.

Flutter: no counterpart

func ParseDevEvents

func ParseDevEvents(script string) ([]DevEvent, error)

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)
tap:x,y           moves the mouse there and clicks the left button
wheel:x,y,dx,dy   turns the wheel at the place; dx and dy are the scroll in logical pixels
key:A             presses and releases a key; key:SHIFT+LEFT presses Shift, then Left, and releases both
keydown:SHIFT     presses a key and keeps it down (until keyup:SHIFT)
keyup:SHIFT       releases a key
text:Hello        types the text as WM_CHAR messages (a keyboard layout's or an input method's
                  characters; its blanks are typed, but \n and the other control characters
                  type nothing; no ";")
compose:a,b,c     an input method composes a, then b, then c, commits c and ends the composition
composing:a,b,c   the same, but the composition stays in progress (a later compose: or
                  composing: goes on with it)

A key is a name of Flutter's table of virtual keys (the name of the VK_ constant without the prefix, in any case, with or without "VK_": RETURN, BACK, LEFT, PRIOR, F1, SHIFT, CONTROL, MENU...), a letter or a digit, or one of the aliases ENTER, BACKSPACE, CTRL, ALT, ESC, DEL, PAGEUP and PAGEDOWN. A step that is not known, or has the wrong arguments, fails with WindowsDevEventsInvalid.

Flutter: no counterpart

Directories

Path Synopsis
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.
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.
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.
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.
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.
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.
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.
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).

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL