Documentation
¶
Overview ¶
Package vinput injects pointer, keyboard and touch input into the compositor through zwlr_virtual_pointer_v1, zwp_virtual_keyboard_v1 and lys_virtual_touch_v1, on a private Wayland connection: the input half of a remote-desktop bridge, and of lys-ui's own headless test harness. The seat's keymap is relayed to the virtual keyboard, so key codes mean what they mean on the real keyboard.
Index ¶
- Variables
- func TouchAvailable(display string) (bool, error)
- type AxisSource
- type Device
- func (v *Device) Axis(src AxisSource, axis ScrollAxis, value float64) error
- func (v *Device) AxisDiscrete(src AxisSource, axis ScrollAxis, value float64, steps int32) error
- func (v *Device) AxisStop(src AxisSource, axis ScrollAxis) error
- func (v *Device) Button(code uint32, pressed bool) error
- func (v *Device) Close()
- func (v *Device) HandleDisplayError(ev wl.DisplayErrorEvent)
- func (v *Device) Key(code uint32, pressed bool) error
- func (v *Device) Keymap() []byte
- func (v *Device) Modifiers(depressed, latched, locked, group uint32) error
- func (v *Device) Motion(dx, dy float64) error
- func (v *Device) MotionAbsolute(x, y, width, height uint32) error
- func (v *Device) OutputSize() (width, height int32)
- func (v *Device) Roundtrip() error
- func (v *Device) TouchCancel() error
- func (v *Device) TouchDown(id, x, y, width, height uint32) error
- func (v *Device) TouchMotion(id, x, y, width, height uint32) error
- func (v *Device) TouchUp(id uint32) error
- type Options
- type ScrollAxis
Constants ¶
This section is empty.
Variables ¶
var ErrNoTouch = errors.New("vinput: compositor lacks lys_virtual_touch_manager_v1, so no virtual touchscreen")
ErrNoTouch is Dial's refusal of Options.Touch on a compositor that serves no lys_virtual_touch_manager_v1.
Functions ¶
func TouchAvailable ¶
TouchAvailable reports whether the compositor on display serves lys_virtual_touch_manager_v1, so Dial can arm Options.Touch there.
Types ¶
type AxisSource ¶
type AxisSource uint32
AxisSource is what a scroll comes from (wl_pointer.axis_source): a finger scroll lets clients scroll kinetically, a wheel clicks.
const ( SourceWheel AxisSource = 0 SourceFinger AxisSource = 1 SourceContinuous AxisSource = 2 SourceWheelTilt AxisSource = 3 )
The axis sources, wl_pointer's values.
type Device ¶
type Device struct {
// contains filtered or unexported fields
}
Device is one virtual pointer and, optionally, keyboard. Its methods are safe to call from any goroutine.
func Dial ¶
Dial connects to display (an absolute socket path, a name inside XDG_RUNTIME_DIR, or "" for WAYLAND_DISPLAY) and creates the devices.
func (*Device) Axis ¶
func (v *Device) Axis(src AxisSource, axis ScrollAxis, value float64) error
Axis scrolls axis by value, in wl_pointer axis units, from src: one frame carrying the motion and its source.
func (*Device) AxisDiscrete ¶
func (v *Device) AxisDiscrete(src AxisSource, axis ScrollAxis, value float64, steps int32) error
AxisDiscrete scrolls whole steps (a wheel), value the axis units they amount to, from src.
func (*Device) AxisStop ¶
func (v *Device) AxisStop(src AxisSource, axis ScrollAxis) error
AxisStop ends a scroll sequence from src on axis (wl_pointer.axis_stop), the stop and its source in one frame as a touchpad sends them: the fingers lifted, and a client may start its kinetic glide.
func (*Device) HandleDisplayError ¶
func (v *Device) HandleDisplayError(ev wl.DisplayErrorEvent)
HandleDisplayError implements wl.DisplayErrorHandler: the compositor's fatal protocol error, for Dial's failure message.
func (*Device) Keymap ¶
Keymap is the xkb_v1 text the virtual keyboard carries (the seat's, or the fallback), nil without a keyboard.
func (*Device) Modifiers ¶
Modifiers declares the modifier state explicitly (xkb masks), for a seat that cannot derive it from the keys.
func (*Device) MotionAbsolute ¶
MotionAbsolute moves the pointer to (x, y) within an extent of width x height (the compositor maps it onto its layout).
func (*Device) OutputSize ¶
OutputSize is the first output's current mode, 0x0 without one.
func (*Device) TouchCancel ¶
TouchCancel cancels every touch point of the device.
func (*Device) TouchDown ¶
TouchDown puts touch point id (below 65536) down at (x, y) within an extent of width x height spanning the output layout.
func (*Device) TouchMotion ¶
TouchMotion moves touch point id to (x, y) as TouchDown places it.
type Options ¶
type Options struct {
// Keyboard arms the virtual keyboard too; a pointer-only device
// is the shape of a seat whose input devices are pointers only.
Keyboard bool
// Touch arms a virtual touchscreen spanning the output layout, which
// only a compositor serving lys_virtual_touch_manager_v1 offers.
Touch bool
// FallbackKeymap is xkb_v1 text uploaded when the seat announces
// none (a virtual-only seat, a headless compositor): the protocol
// refuses key events before any keymap is set.
FallbackKeymap []byte
// Keymap is xkb_v1 text the keyboard carries instead of the seat's, the
// way a tool such as wtype numbers keys its own way. It wins over the
// seat's keymap and FallbackKeymap.
Keymap []byte
}
Options tunes Dial.
type ScrollAxis ¶
type ScrollAxis uint32
ScrollAxis is a wl_pointer axis.
const ( AxisVertical ScrollAxis = 0 AxisHorizontal ScrollAxis = 1 )
The scroll axes.