avyos.dev/pkg/graphics/input/evdev

package evdev

Package Overview

No package-level documentation is provided.

Export GroupCount
Constants0
Variables0
Functions0
Types3

Types

Device

type Device struct {
	// contains filtered or unexported fields
}

Device represents an evdev input device.

Handler

type Handler struct {
	// contains filtered or unexported fields
}

Handler manages evdev input devices.

Functions

func NewHandler() *Handler

NewHandler creates a new evdev input handler.

Methods

func (h *Handler) Close() error

Close closes all devices.

func (h *Handler) Devices() []string

Devices returns information about opened devices.

func (h *Handler) Events() <-chan graphics.Event

Events returns the event channel.

func (h *Handler) MousePosition() (x, y int)

MousePosition returns the current mouse position.

func (h *Handler) Open() error

Open scans for and opens input devices.

func (h *Handler) Poll() *graphics.Event

Poll returns the next event or nil if none available.

func (h *Handler) SetLayout(layout KeyboardLayout)

SetLayout sets the keyboard layout.

func (h *Handler) SetScreenSize(width, height int)

SetScreenSize sets the screen size for mouse bounds.

func (h *Handler) Start()

Start begins reading events from all devices.

func (h *Handler) Stop()

Stop stops reading events.

func (h *Handler) Wait(timeout time.Duration) *graphics.Event

Wait waits for the next event with a timeout.

KeyboardLayout

type KeyboardLayout string

KeyboardLayout represents a keyboard layout.

Constants

const (
	LayoutUS KeyboardLayout = "us"
	LayoutUK KeyboardLayout = "uk"
	LayoutDE KeyboardLayout = "de"
)