screen
import "github.com/tangoui/tango/sys/screen"本页由
site/tools/apigen从源码注释生成(按 darwin 构建标签选文件),请勿手改。
Package screen lists the displays attached to the computer.
Coordinates are logical (DIP) pixels with the origin at the top-left corner of the primary display; displays left of or above it have negative coordinates. Scale is the ratio of physical to logical pixels.
Functions are safe from any goroutine once the app runs. They return ErrUnsupported when the backend cannot list displays (mobile, minimal backends) and tango.ErrNotRunning after the app quit. Display changes (a monitor plugged in, the arrangement or scale changed) arrive as tango.EventDisplaysChanged; OnChange is a shortcut for listening to them.
变量
var ErrNoDisplay = errors.New("tango: no display")ErrNoDisplay is returned when the system reports no display at all (a headless session).
var ErrUnsupported = platform.ErrUnsupportedErrUnsupported is platform.ErrUnsupported, re-exported for callers outside the module.
函数
func OnChange
func OnChange(a *tango.App, fn func())OnChange calls fn on the main thread whenever displays are added, removed, rearranged or rescaled.
类型
Display
type Display = platform.DisplayDisplay is one monitor. WorkArea excludes the menu bar, dock and taskbars.
func All
func All(a *tango.App) ([]Display, error)All returns every display; the primary one is first.
func At
func At(a *tango.App, x, y int) (Display, error)At returns the display containing the point (x, y), or the display nearest to it when the point is on none.
func Primary
func Primary(a *tango.App) (Display, error)Primary returns the primary display (the one with the menu bar on macOS, the main taskbar on Windows).
Rect
type Rect = platform.RectRect is a rectangle in logical pixels.