Documentation
¶
Index ¶
- Variables
- type Backend
- func (backend *Backend) Click(button Button, double bool) error
- func (backend *Backend) Close() error
- func (backend *Backend) DragSmooth(x, y int, lowDelay, highDelay float64) error
- func (backend *Backend) Key(event KeyEvent) (err error)
- func (backend *Backend) KeyboardReady() error
- func (backend *Backend) Location() (int, int, error)
- func (backend *Backend) MouseReady() error
- func (backend *Backend) MoveAbsolute(x, y int, _ []int) error
- func (backend *Backend) MoveRelative(x, y int) error
- func (backend *Backend) MoveSmooth(x, y int, relative bool, lowDelay, highDelay float64) error
- func (backend *Backend) Scroll(x, y int) error
- func (backend *Backend) Text(event TextEvent) (err error)
- func (backend *Backend) Toggle(button Button, down bool) error
- type Button
- type Config
- type Connection
- type Dialer
- type GuardianDialer
- type GuardianOptions
- type KeyEvent
- type KeyboardMapping
- type PointerState
- type Setup
- type TextEvent
- type XTestVersion
Constants ¶
This section is empty.
Variables ¶
var ( // ErrUnsupported identifies X11/XTEST capabilities the core cannot provide. // The public adapter translates it to robotgo.ErrNotSupported. ErrUnsupported = errors.New("X11 input operation is not supported") )
Functions ¶
This section is empty.
Types ¶
type Backend ¶
type Backend struct {
// contains filtered or unexported fields
}
Backend owns one lazily opened X connection. Its mutex covers whole high-level transactions, including the stable scratch-keymap pool.
func (*Backend) DragSmooth ¶
func (*Backend) KeyboardReady ¶
func (*Backend) MouseReady ¶
func (*Backend) MoveRelative ¶
func (*Backend) MoveSmooth ¶
type Config ¶
type Config struct {
ResolveDisplay func() (string, error)
Dialer Dialer
KeyHoldDelay time.Duration
Sleep func(time.Duration)
}
Config defines immutable dependencies and timings for one Backend.
type Connection ¶
type Connection interface {
Close() error
WaitForEvent() (open bool, err error)
Setup() (Setup, error)
InitXTest() error
XTestVersion(major byte, minor uint16) (XTestVersion, error)
GrabServer() error
UngrabServer() error
KeyboardMapping(first xproto.Keycode, count byte) (KeyboardMapping, error)
ModifierMapping() ([]xproto.Keycode, error)
ChangeKeyboardMapping(first xproto.Keycode, perKeycode byte, keysyms []xproto.Keysym) error
PressedKeys() ([]byte, error)
QueryPointer(root xproto.Window) (PointerState, error)
FakeInput(eventType, detail byte, root xproto.Window, x, y int16) error
}
Connection owns every X11 primitive used by Backend. The boundary is intentionally complete so another process can own the same transaction and lifecycle machinery without exposing *xgb.Conn to the stateful core. Close must synchronously finish verified transport cleanup and unblock WaitForEvent, even when it returns an error.
type Dialer ¶
type Dialer interface {
Dial(display string) (Connection, error)
}
Dialer creates one complete X11 connection owned by Backend.
func NewGuardianDialer ¶
func NewGuardianDialer(options GuardianOptions) Dialer
NewGuardianDialer returns a Dialer whose X11 connections live in a re-executed guardian process. It never falls back to an in-process XGB connection when guardian startup or authentication fails.
type GuardianDialer ¶
type GuardianDialer struct {
Options GuardianOptions
}
GuardianDialer moves ownership of an X11 connection into a re-executed helper over a token-authenticated Linux abstract socket whose kernel peer credentials are verified by the parent. The helper survives a targeted SIGKILL of its parent and restores connection-owned input and keyboard mappings when the control socket closes.
func (GuardianDialer) Dial ¶
func (dialer GuardianDialer) Dial(display string) (Connection, error)
Dial starts a guardian and opens the requested display inside that helper.
type GuardianOptions ¶
type GuardianOptions struct {
Executable string
StartupTimeout time.Duration
RequestTimeout time.Duration
CleanupTimeout time.Duration
CrashSettle time.Duration
}
GuardianOptions controls the bounded lifecycle of a Pure-Go X11 guardian. Zero values select conservative defaults. Executable is primarily a test seam; production callers should leave it empty to re-exec /proc/self/exe.
type KeyEvent ¶
type KeyEvent struct {
Keysym uint32
Modifiers []uint32
Down bool
Tap bool
AllowScratch bool
ForceScratch bool
}
KeyEvent is a normalized X11 keysym transaction. Public key names and aliases are resolved by the caller before entering the stateful core.
type KeyboardMapping ¶
KeyboardMapping is a detached snapshot of one contiguous keyboard-map range.
type PointerState ¶
PointerState is the root-relative position and core button mask.
type XTestVersion ¶
XTestVersion is the server's negotiated XTEST protocol version.