vminput

package
v0.6.10 Latest Latest
Warning

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

Go to latest
Published: May 21, 2026 License: MIT Imports: 12 Imported by: 0

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

Constants

This section is empty.

Variables

View Source
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) Ready

func (s *Sender) Ready() bool

Ready reports whether the VM is running and ready for HID reports.

func (*Sender) SendDigitizerEvents

func (s *Sender) SendDigitizerEvents(events unsafe.Pointer, deviceIndex uint32) error

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

func (s *Sender) SendMagnifyEvents(events unsafe.Pointer, deviceIndex uint32) error

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

func (s *Sender) SendMultiTouchEvents(events unsafe.Pointer, deviceIndex uint32) error

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

func (s *Sender) SendQuickLookEvents(events unsafe.Pointer, deviceIndex uint32) error

SendQuickLookEvents sends Quick Look events to the VM.

func (*Sender) SendRotationEvents

func (s *Sender) SendRotationEvents(events unsafe.Pointer, deviceIndex uint32) error

SendRotationEvents sends rotation events to the VM.

func (*Sender) SendScrollWheelEvents

func (s *Sender) SendScrollWheelEvents(events unsafe.Pointer, deviceIndex uint32) error

SendScrollWheelEvents sends scroll wheel events to the VM.

func (*Sender) SendSmartMagnifyEvents

func (s *Sender) SendSmartMagnifyEvents(events unsafe.Pointer, deviceIndex uint32) error

SendSmartMagnifyEvents sends smart magnify events to the VM.

func (*Sender) SendText

func (s *Sender) SendText(text string) error

SendText sends a UTF-8 string as a sequence of keyboard events. This is intentionally small: callers that need keycode-level control can build and send their own event arrays.

func (*Sender) WaitReady

func (s *Sender) WaitReady(ctx context.Context) error

WaitReady blocks until the VM is ready or the context is cancelled.

Jump to

Keyboard shortcuts

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