vminput

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2026 License: MIT Imports: 10 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")
)

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) SendKeyboardEvents

func (s *Sender) SendKeyboardEvents(events unsafe.Pointer, keyboardID uint32) error

SendKeyboardEvents sends keyboard event objects to the VM.

func (*Sender) SendMagnifyEvents

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

SendMagnifyEvents sends magnify events to the VM.

func (*Sender) SendMouseEvents

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

SendMouseEvents sends mouse event objects to the VM.

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