Documentation
¶
Overview ¶
Package xkbcommon interprets Wayland keyboard maps with libxkbcommon, loaded at runtime without cgo. Close owned values when they are no longer used.
Index ¶
- Constants
- Variables
- func Available() error
- func KeysymFromName(name string) (uint32, error)
- func KeysymName(sym uint32) (string, error)
- func KeysymNameInto(sym uint32, dst []byte) (int, error)
- func WaylandKeycode(evdev uint32) uint32
- type ComposeState
- func (s *ComposeState) Close() error
- func (s *ComposeState) Feed(sym uint32) (uint32, error)
- func (s *ComposeState) KeySym() (uint32, error)
- func (s *ComposeState) Reset() error
- func (s *ComposeState) Status() (uint32, error)
- func (s *ComposeState) UTF8() (string, error)
- func (s *ComposeState) UTF8Into(dst []byte) (int, error)
- type ComposeTable
- type Context
- func (c *Context) Close() error
- func (c *Context) NewComposeTable(locale string) (*ComposeTable, error)
- func (c *Context) NewKeymapFD(fd int, size int) (*Keymap, error)
- func (c *Context) NewKeymapRules(rules, model, layout, variant, options string) (*Keymap, error)
- func (c *Context) NewKeymapString(text string) (*Keymap, error)
- type Keymap
- type State
- func (s *State) Close() error
- func (s *State) KeySym(keycode uint32) (uint32, error)
- func (s *State) Layout() (uint32, error)
- func (s *State) ModIndexActive(idx uint32) (bool, error)
- func (s *State) ModNameActive(name string) (bool, error)
- func (s *State) Mods() (uint32, error)
- func (s *State) UTF8(keycode uint32) (string, error)
- func (s *State) UTF8Into(keycode uint32, dst []byte) (int, error)
- func (s *State) UpdateMask(depressed, latched, locked, groupDepressed, groupLatched, groupLocked uint32) (uint32, error)
Constants ¶
const MaxUTF8Buffer = 512
MaxUTF8Buffer is the byte API's maximum scratch length, including the native trailing NUL. Thus a full result can contain at most 511 payload bytes.
Variables ¶
var ErrClosed = errors.New("xkbcommon: closed handle")
var ErrUTF8Buffer = fmt.Errorf("xkbcommon: UTF-8 buffer length must be 1..%d", MaxUTF8Buffer)
ErrUTF8Buffer reports a destination buffer whose length is outside 1..MaxUTF8Buffer.
Functions ¶
func Available ¶
func Available() error
Available resolves the SONAME and every required symbol, reporting the first incompatible symbol rather than failing later in a keyboard event callback.
func KeysymFromName ¶
func KeysymName ¶
func KeysymNameInto ¶ added in v0.2.0
KeysymNameInto writes the keysym name into dst without allocating, with the same bounds and short-buffer semantics as State.UTF8Into.
func WaylandKeycode ¶
Keycodes from wl_keyboard are evdev codes; add 8 before calling State.KeySym or State.UTF8.
Types ¶
type ComposeState ¶
type ComposeState struct {
// contains filtered or unexported fields
}
func (*ComposeState) Close ¶
func (s *ComposeState) Close() error
func (*ComposeState) KeySym ¶
func (s *ComposeState) KeySym() (uint32, error)
func (*ComposeState) Reset ¶
func (s *ComposeState) Reset() error
func (*ComposeState) Status ¶
func (s *ComposeState) Status() (uint32, error)
func (*ComposeState) UTF8 ¶
func (s *ComposeState) UTF8() (string, error)
type ComposeTable ¶
type ComposeTable struct {
// contains filtered or unexported fields
}
func (*ComposeTable) Close ¶
func (t *ComposeTable) Close() error
func (*ComposeTable) NewState ¶
func (t *ComposeTable) NewState() (*ComposeState, error)
type Context ¶
type Context struct {
// contains filtered or unexported fields
}
func NewContext ¶
func (*Context) NewComposeTable ¶
func (c *Context) NewComposeTable(locale string) (*ComposeTable, error)
func (*Context) NewKeymapFD ¶
NewKeymapFD copies exactly size bytes from offset zero of a Wayland xkb_v1 keymap FD (at most 16 MiB). A trailing Wayland NUL, if present, is excluded from the compiled text. The caller retains ownership of fd, even on error.
func (*Context) NewKeymapRules ¶
NewKeymapRules compiles an evdev rules keymap. Empty rules/model/variant/options use libxkbcommon defaults; layout is e.g. "us", "fr", "de", or "us,de".
type Keymap ¶
type Keymap struct {
// contains filtered or unexported fields
}
func (*Keymap) KeyRepeats ¶ added in v0.2.0
KeyRepeats reports whether the key repeats when held. It does not allocate.
func (*Keymap) LayoutCount ¶
type State ¶
type State struct {
// contains filtered or unexported fields
}
func (*State) ModIndexActive ¶ added in v0.2.0
ModIndexActive reports whether the modifier at idx is effectively active. It does not allocate. An unknown index reports false.
func (*State) ModNameActive ¶ added in v0.2.0
ModNameActive reports whether the named modifier (for example raw.XKB_MOD_NAME_CTRL) is effectively active. Names up to 63 bytes do not allocate. An unknown name reports false.
func (*State) UTF8Into ¶
UTF8Into writes into caller-owned mutable storage without constructing a string. dst is passed to C through a uintptr-escaping call, so its backing array lives on the heap (a stack array sliced into dst is moved there once). n excludes NUL; on io.ErrShortBuffer n is the required payload size, all of dst is cleared, and the caller needs n+1 bytes. dst must have length 1..MaxUTF8Buffer. No storage is retained; the caller owns wiping after use.
func (*State) UpdateMask ¶
func (s *State) UpdateMask(depressed, latched, locked, groupDepressed, groupLatched, groupLocked uint32) (uint32, error)
UpdateMask accepts depressed/latched/locked modifier masks and layout group indices in the order supplied by wl_keyboard.modifiers. It returns changed components.