avyos.dev/pkg/graphics/input
package input
Overview
No package-level documentation is provided.
| Export Group | Count |
|---|---|
| Constants | 0 |
| Variables | 0 |
| Functions | 0 |
| Types | 6 |
Types
Event
type Event struct {
Type EventType
// Mouse events
X, Y int
MouseButton MouseButton
// Keyboard events
Key Key
Rune rune
Modifiers Modifiers
// Shortcut events
ShortcutID uint32
WindowID uint32
Scope uint32
}Event represents an input event.
Methods
HasMod
func (e Event) HasMod(mod Modifiers) boolHasMod returns true if the modifier is set.
IsAlt
func (e Event) IsAlt() boolIsAlt returns true if alt is held.
IsCtrl
func (e Event) IsCtrl() boolIsCtrl returns true if ctrl is held.
IsShift
func (e Event) IsShift() boolIsShift returns true if shift is held.
EventType
type EventType intEventType represents the type of an event.
Constants
EventNone, EventMouseMove, EventMouseButtonPress, EventMouseButtonRelease, EventKeyPress, EventKeyRelease, EventFocusIn, EventFocusOut, EventQuit, EventResize, EventShortcut
const (
EventNone EventType = iota
EventMouseMove
EventMouseButtonPress
EventMouseButtonRelease
EventKeyPress
EventKeyRelease
EventFocusIn
EventFocusOut
EventQuit
EventResize
EventShortcut
)Handler
type Handler interface {
Open() error
Start()
Close() error
Poll() *Event
MousePosition() (x, y int)
SetScreenSize(width, height int)
}Handler is the input subsystem interface. Implementations include evdev (Linux raw input) and Wayland seat.
Key
type Key intKey represents a keyboard key.
Constants
KeyNone, KeyEscape, KeyBackspace, KeyTab, KeyEnter, KeySpace, KeyLeft, KeyRight, KeyUp, KeyDown, KeyHome, KeyEnd, KeyPageUp, KeyPageDown, KeyInsert, KeyDelete, KeyF1, KeyF2, KeyF3, KeyF4, KeyF5, KeyF6, KeyF7, KeyF8, KeyF9, KeyF10, KeyF11, KeyF12, KeyLeftShift, KeyRightShift, KeyLeftCtrl, KeyRightCtrl, KeyLeftAlt, KeyRightAlt, KeyCapsLock, KeyNumLock, KeyScrollLock
const (
KeyNone Key = iota
KeyEscape
KeyBackspace
KeyTab
KeyEnter
KeySpace
KeyLeft
KeyRight
KeyUp
KeyDown
KeyHome
KeyEnd
KeyPageUp
KeyPageDown
KeyInsert
KeyDelete
KeyF1
KeyF2
KeyF3
KeyF4
KeyF5
KeyF6
KeyF7
KeyF8
KeyF9
KeyF10
KeyF11
KeyF12
KeyLeftShift
KeyRightShift
KeyLeftCtrl
KeyRightCtrl
KeyLeftAlt
KeyRightAlt
KeyCapsLock
KeyNumLock
KeyScrollLock
)Modifiers
type Modifiers uint8Modifiers represents keyboard modifiers.
Constants
ModShift, ModCtrl, ModAlt, ModCapsLock
const (
ModShift Modifiers = 1 << iota
ModCtrl
ModAlt
ModCapsLock
)MouseButton
type MouseButton intMouseButton represents a mouse button.
Constants
MouseButtonNone, MouseButtonLeft, MouseButtonMiddle, MouseButtonRight, MouseButtonWheelUp, MouseButtonWheelDown, MouseButtonWheelLeft, MouseButtonWheelRight
const (
MouseButtonNone MouseButton = iota
MouseButtonLeft
MouseButtonMiddle
MouseButtonRight
MouseButtonWheelUp
MouseButtonWheelDown
MouseButtonWheelLeft
MouseButtonWheelRight
)