Documentation
¶
Overview ¶
Package linux implements the Linux backend (GTK 3 + WebKitGTK) in pure Go: the libraries are loaded at run time with purego, no cgo.
Index ¶
- func TestAccessibilityPerform(handle uintptr, label, action, value string) bool
- func TestActivateAccelerator(handle uintptr, acc string) bool
- func TestActivateMenuItem(handle uintptr, path ...string) error
- func TestChoosePopupItem(label string) bool
- func TestClickSurface(handle uintptr, x, y float64) bool
- func TestCloseMenuBar(handle uintptr)
- func TestComposeOver(handle uintptr, text string, caret int, commit bool, from, length int) bool
- func TestDefaultURLHandler(scheme string) string
- func TestDismissPopups() int
- func TestDragSurface(handle uintptr, points [][2]float64) bool
- func TestDropFiles(handle uintptr, x, y float64, paths []string) (over, dropped bool)
- func TestLazyGL(on bool)
- func TestMenuBarState(handle uintptr) (shown, open bool)
- func TestMovePointer(x, y int) bool
- func TestPopups() [][]string
- func TestPressButton(press bool) bool
- func TestPressKeys(names ...string) bool
- func TestPressTitleButton(handle uintptr, name string) bool
- func TestResizeCursor(handle uintptr) string
- func TestRightClickSurface(handle uintptr, x, y float64) bool
- func TestSetDroppedFiles(handle uintptr, paths []string)
- func TestSideButton(handle uintptr, back bool) bool
- func TestSurfaceGL(handle uintptr) (how string, pix []byte, width, height int)
- func TestSurfaceInputLowest(handle uintptr) bool
- func TestSurrounding(handle uintptr) (text string, caret int, ok bool)
- func TestTitleButtons(handle uintptr) []string
- func TestUseGPU(handle uintptr) bool
- func TestUsePortalShortcuts(on bool) bool
- type Backend
- func (b *Backend) App() platform.AppController
- func (b *Backend) Clipboard() platform.Clipboard
- func (b *Backend) Dialogs() platform.Dialogs
- func (b *Backend) Init(h platform.AppHandler, opts platform.AppOptions) error
- func (b *Backend) IsMainThread() bool
- func (b *Backend) Name() string
- func (b *Backend) NewTray(h platform.TrayHandler) (platform.Tray, error)
- func (b *Backend) NewWindow(o *platform.WindowOptions, h platform.WindowHandler) (platform.Window, error)
- func (b *Backend) NotificationsSupported() bool
- func (b *Backend) PopupMenu(m *platform.Menu, pw platform.Window, pos *platform.Point)
- func (b *Backend) Power() platform.Power
- func (b *Backend) Quit()
- func (b *Backend) RegisterHotkey(id int, acc string) error
- func (b *Backend) RemoveNotification(id string)
- func (b *Backend) Run() error
- func (b *Backend) Screen() platform.Screen
- func (b *Backend) SetApplicationMenu(m *platform.Menu)
- func (b *Backend) Shell() platform.Shell
- func (b *Backend) ShowNotification(n *platform.Notification) error
- func (b *Backend) Signal()
- func (b *Backend) Step()
- func (b *Backend) Theme() platform.Theme
- func (b *Backend) UnregisterHotkey(id int)
- func (b *Backend) UpdateMenuItem(it *platform.MenuItem)
- func (b *Backend) Wake()
- type TestAccessNode
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func TestAccessibilityPerform ¶ added in v0.2.0
TestAccessibilityPerform acts on the element labeled label as assistive technology does: "press", "increment", "decrement", "focus", or "value" to set its text to value. It reports whether the element can.
func TestActivateAccelerator ¶ added in v0.1.10
TestActivateAccelerator presses a window's shortcut, as its keys do, and reports whether a menu item took it.
func TestActivateMenuItem ¶
TestActivateMenuItem activates an item of a window's menu bar, found by the labels along its path.
func TestChoosePopupItem ¶ added in v0.2.0
TestChoosePopupItem chooses the item labeled label of a context menu being shown, and closes the menu, and reports whether it has one.
func TestClickSurface ¶ added in v0.2.0
TestClickSurface clicks (x, y), in DIPs, in a window showing native UI, through the XTEST extension like a mouse would. It reports false for a window showing a web page, and without an X server.
func TestCloseMenuBar ¶ added in v0.1.10
func TestCloseMenuBar(handle uintptr)
TestCloseMenuBar closes the menus of a window's menu bar, as Escape does.
func TestComposeOver ¶ added in v0.2.0
TestComposeOver does what an input method that edits typed text does: it deletes length runes from offset from of the text around the caret unless from is -1, then composes text with the caret at caret, or commits it.
func TestDefaultURLHandler ¶
TestDefaultURLHandler returns the id of the application GLib opens URLs of scheme with, as xdg-open and GTK apps do.
func TestDismissPopups ¶
func TestDismissPopups() int
TestDismissPopups closes the context menus being shown, as if the user pressed Escape, and reports how many there were.
func TestDragSurface ¶ added in v0.2.5
TestDragSurface presses the primary button at the first of points, in DIPs, in a window showing native UI, moves the pointer through the others, and releases it at the last, through XTEST.
func TestDropFiles ¶ added in v0.2.0
TestDropFiles drags files to (x, y) of a window showing native UI and drops them there, as GTK tells it, and reports whether the content took them over there and when dropped.
func TestLazyGL ¶ added in v0.2.9
func TestLazyGL(on bool)
TestLazyGL makes the GtkGLArea of the windows created from now on make no context until their content asks for the GPU, with MYGO_GPU=1 too, which otherwise draws with OpenGL from the first frame.
func TestMenuBarState ¶ added in v0.1.10
TestMenuBarState reports whether a window shows its menu bar, and whether the bar's first menu is open.
func TestMovePointer ¶ added in v0.1.5
TestMovePointer moves the pointer to a point of the screen through the XTEST extension like a mouse would. It reports false without an X server.
func TestPopups ¶ added in v0.2.0
func TestPopups() [][]string
TestPopups returns the labels of the items of the context menus being shown, "-" for separators.
func TestPressButton ¶ added in v0.1.5
TestPressButton presses or releases the first mouse button the same way.
func TestPressKeys ¶
TestPressKeys presses keys, X keysym names such as "Control_L", together and releases them, through the XTEST extension like a keyboard would. It reports false without an X server.
func TestPressTitleButton ¶ added in v0.1.11
TestPressTitleButton clicks one of them.
func TestResizeCursor ¶ added in v0.1.5
TestResizeCursor returns the name of the resize cursor a frameless window shows over an edge of its page, or "".
func TestRightClickSurface ¶ added in v0.2.0
TestRightClickSurface clicks (x, y) with the secondary button, as TestClickSurface does with the primary.
func TestSetDroppedFiles ¶
TestSetDroppedFiles makes paths the files of the next drop on a window's page, as if they had been dragged there.
func TestSideButton ¶ added in v0.2.5
TestSideButton clicks a mouse's back or forward button (buttons 8 and 9) in a window showing native UI, through XTEST.
func TestSurfaceGL ¶ added in v0.2.0
TestSurfaceGL tells how the native UI of a window draws: "opengl" when its renderer draws in the GtkGLArea, "memory" when the GtkGLArea shows frames drawn on the CPU, "cairo" when a drawing area, or a GtkGLArea without a context, paints them with cairo, and "" before the first frame. For a GtkGLArea it returns its framebuffer's pixels too, premultiplied BGRA rows from the top, and their size.
func TestSurfaceInputLowest ¶ added in v0.2.9
TestSurfaceInputLowest reports whether the input window of a window's GtkGLArea is below the other windows in its window, as those of a hidden title bar's controls, which take the pointer over the area.
func TestSurrounding ¶ added in v0.2.0
TestSurrounding returns the text around the caret that input methods get from a window showing native UI, and the caret's offset in runes. GTK's own input method reads it back: others, as fcitx5's, keep it to themselves, so the window's input switches to GTK's.
func TestTitleButtons ¶ added in v0.1.11
TestTitleButtons returns the names of the title buttons over the page of a window with a hidden title bar.
func TestUseGPU ¶ added in v0.2.9
TestUseGPU asks the surface of a window for the GPU, as its content does once drawing in memory costs too much, and reports whether it gave it.
func TestUsePortalShortcuts ¶
TestUsePortalShortcuts makes global shortcuts bind through the XDG desktop portal, as on Wayland, and reports whether the desktop offers it.
Types ¶
type Backend ¶
type Backend struct {
// contains filtered or unexported fields
}
Backend is the Linux (GTK 3 + WebKitGTK) implementation of platform.Backend.
func New ¶
func New() *Backend
New creates the Linux backend. Libraries are loaded by Init so that programs still start (and report a clear error) on machines without GTK.
func (*Backend) App ¶
func (b *Backend) App() platform.AppController
func (*Backend) Init ¶
func (b *Backend) Init(h platform.AppHandler, opts platform.AppOptions) error
func (*Backend) IsMainThread ¶
IsMainThread reports whether the caller runs on the thread the process started with, whose thread id is the process id. Package mygo locks the main goroutine to it, so this holds before Init too.
func (*Backend) NewWindow ¶
func (b *Backend) NewWindow(o *platform.WindowOptions, h platform.WindowHandler) (platform.Window, error)
func (*Backend) NotificationsSupported ¶
func (*Backend) RemoveNotification ¶
func (*Backend) SetApplicationMenu ¶
func (*Backend) ShowNotification ¶
func (b *Backend) ShowNotification(n *platform.Notification) error
func (*Backend) UnregisterHotkey ¶
func (*Backend) UpdateMenuItem ¶
type TestAccessNode ¶ added in v0.2.0
type TestAccessNode struct {
Role, Label, Value string
// contains filtered or unexported fields
}
TestAccessNode is an element of native UI as assistive technology reads it through ATK: the name of its role, its name, and its value.
func TestAccessibility ¶ added in v0.2.0
func TestAccessibility(handle uintptr) ([]TestAccessNode, bool)
TestAccessibility reads the elements of a window showing native UI as assistive technology does, in order, and reports false when it cannot.