Documentation
¶
Overview ¶
Package vminput provides direct virtual-machine input injection helpers.
It is intended to wrap the private keyboard, pointer, scroll, and multitouch event sender APIs exposed by VZVirtualMachine so callers can inject input without depending on AppKit focus or CGEvent delivery through the host window server.
The package should expose a small set of helpers for:
Keyboard events and text input Pointer movement, button events, and scrolling Multitouch and gesture delivery
All VM operations should run on the caller-supplied vm.Queue so the API remains safe to use from arbitrary goroutines.
Index ¶
- Variables
- type Sender
- func (s *Sender) Ready() bool
- func (s *Sender) SendDigitizerEvents(events unsafe.Pointer, deviceIndex uint32) error
- func (s *Sender) SendIOHIDEventObjects(events []pvz.VZIOHIDEvent, hidDeviceIndex uint32) error
- func (s *Sender) SendIOHIDEvents(events pvz.VZOpaqueIOHIDEvents, hidDeviceIndex uint32) errordeprecated
- func (s *Sender) SendKeyEvents(events []pvz.VZKeyEvent, keyboardID uint32) error
- func (s *Sender) SendKeyboardEvents(events pvz.VZOpaqueKeyboardEvents, keyboardID uint32) errordeprecated
- func (s *Sender) SendKeyboardNSEvent(event objectivec.IObject, keyboardID uint32) error
- func (s *Sender) SendKeyboardNSEvents(events []objectivec.IObject, keyboardID uint32) error
- func (s *Sender) SendMagnifyEvents(events unsafe.Pointer, deviceIndex uint32) error
- func (s *Sender) SendMouseEvents(events pvz.VZOpaqueMouseEvents, deviceIndex uint32) errordeprecated
- func (s *Sender) SendMultiTouchEvents(events unsafe.Pointer, deviceIndex uint32) error
- func (s *Sender) SendPointerNSEvent(event objectivec.IObject, deviceIndex uint32) error
- func (s *Sender) SendQuickLookEvents(events unsafe.Pointer, deviceIndex uint32) error
- func (s *Sender) SendRotationEvents(events unsafe.Pointer, deviceIndex uint32) error
- func (s *Sender) SendScrollWheelEvents(events unsafe.Pointer, deviceIndex uint32) error
- func (s *Sender) SendSmartMagnifyEvents(events unsafe.Pointer, deviceIndex uint32) error
- func (s *Sender) SendText(text string) error
- func (s *Sender) WaitReady(ctx context.Context) error
Constants ¶
This section is empty.
Variables ¶
var ( // ErrVMNotRunning reports that the VM is not running. ErrVMNotRunning = errors.New("vm not running") // ErrNotReady reports that the VM is not accepting HID reports. ErrNotReady = errors.New("vm not accepting hid reports") ErrKeyboardID = errors.New("keyboard id out of range") ErrHIDDeviceID = errors.New("hid device index out of range") )
Functions ¶
This section is empty.
Types ¶
type Sender ¶
type Sender struct {
// contains filtered or unexported fields
}
Sender sends direct input events to a VM.
func NewSender ¶
func NewSender(queue *vm.Queue, vm vz.VZVirtualMachine) *Sender
NewSender creates a direct input sender for a VM.
func (*Sender) SendDigitizerEvents ¶
SendDigitizerEvents sends digitizer events to the VM.
func (*Sender) SendIOHIDEventObjects ¶ added in v0.5.4
func (s *Sender) SendIOHIDEventObjects(events []pvz.VZIOHIDEvent, hidDeviceIndex uint32) error
SendIOHIDEventObjects sends typed _VZIOHIDEvent objects to the selected HID device.
This is only safe when the caller already has valid _VZIOHIDEvent objects. The private _VZIOHIDEvent initializer takes an IOHIDEventRef-style pointer, not an Objective-C event object, so this package does not currently expose a higher-level constructor for keyboard IOHID events.
func (*Sender) SendIOHIDEvents
deprecated
added in
v0.5.4
func (s *Sender) SendIOHIDEvents(events pvz.VZOpaqueIOHIDEvents, hidDeviceIndex uint32) error
SendIOHIDEvents sends an opaque private IOHID event payload to the VM.
Deprecated: Prefer Sender.SendIOHIDEventObjects when you already have _VZIOHIDEvent objects.
func (*Sender) SendKeyEvents ¶ added in v0.5.4
func (s *Sender) SendKeyEvents(events []pvz.VZKeyEvent, keyboardID uint32) error
SendKeyEvents sends typed private key event objects to the selected keyboard.
This is the recommended keyboard path. It avoids the undocumented `sendKeyboardEvents:keyboardID:` buffer contract and instead uses _VZKeyboard.sendKeyEvents: with _VZKeyEvent objects.
func (*Sender) SendKeyboardEvents
deprecated
func (s *Sender) SendKeyboardEvents(events pvz.VZOpaqueKeyboardEvents, keyboardID uint32) error
SendKeyboardEvents sends an opaque private keyboard-event payload to the VM.
Deprecated: Prefer Sender.SendKeyEvents or Sender.SendKeyboardNSEvents.
func (*Sender) SendKeyboardNSEvent ¶ added in v0.5.4
func (s *Sender) SendKeyboardNSEvent(event objectivec.IObject, keyboardID uint32) error
SendKeyboardNSEvent sends a single NSEvent keyboard event.
func (*Sender) SendKeyboardNSEvents ¶ added in v0.5.4
func (s *Sender) SendKeyboardNSEvents(events []objectivec.IObject, keyboardID uint32) error
SendKeyboardNSEvents converts NSEvent keyboard events into _VZKeyEvent objects, then sends them through _VZKeyboard.sendKeyEvents:.
func (*Sender) SendMagnifyEvents ¶
SendMagnifyEvents sends magnify events to the VM.
func (*Sender) SendMouseEvents
deprecated
func (s *Sender) SendMouseEvents(events pvz.VZOpaqueMouseEvents, deviceIndex uint32) error
SendMouseEvents sends mouse event objects to the VM.
Deprecated: this still forwards an opaque private payload.
func (*Sender) SendMultiTouchEvents ¶
SendMultiTouchEvents sends multitouch events to the VM.
func (*Sender) SendPointerNSEvent ¶
func (s *Sender) SendPointerNSEvent(event objectivec.IObject, deviceIndex uint32) error
SendPointerNSEvent forwards a single NSEvent to the VM.
func (*Sender) SendQuickLookEvents ¶
SendQuickLookEvents sends Quick Look events to the VM.
func (*Sender) SendRotationEvents ¶
SendRotationEvents sends rotation events to the VM.
func (*Sender) SendScrollWheelEvents ¶
SendScrollWheelEvents sends scroll wheel events to the VM.
func (*Sender) SendSmartMagnifyEvents ¶
SendSmartMagnifyEvents sends smart magnify events to the VM.