MCPcopy Create free account
hub / github.com/cogentcore/core / Key

Method Key

events/source.go:69–84  ·  view source on GitHub ↗

SendKey processes a basic key event and sends it

(typ Types, rn rune, code key.Codes, mods key.Modifiers)

Source from the content-addressed store, hash-verified

67
68// SendKey processes a basic key event and sends it
69func (es *Source) Key(typ Types, rn rune, code key.Codes, mods key.Modifiers) {
70 ev := NewKey(typ, rn, code, mods)
71 es.Last.Mods = mods
72 es.Last.Key = code
73 ev.Init()
74 es.Deque.Send(ev)
75
76 _, mapped := key.CodeRuneMap[code]
77
78 if typ == KeyDown && ev.Code < key.CodeLeftControl &&
79 (ev.HasAnyModifier(key.Control, key.Meta) || !mapped || ev.Code == key.CodeTab) {
80 che := NewKey(KeyChord, rn, code, mods)
81 che.Init()
82 es.Deque.Send(che)
83 }
84}
85
86// KeyChord processes a basic KeyChord event and sends it
87func (es *Source) KeyChord(rn rune, code key.Codes, mods key.Modifiers) {

Callers 8

MapKeyTypeFunction · 0.45
MapDeleteAllFunction · 0.45
SetMapRobustFunction · 0.45
CopyMapRobustFunction · 0.45
KeyEventMethod · 0.45
ProcessKeyFunction · 0.45
OnKeyDownMethod · 0.45
OnKeyUpMethod · 0.45

Calls 4

NewKeyFunction · 0.85
InitMethod · 0.65
HasAnyModifierMethod · 0.65
SendMethod · 0.45

Tested by

no test coverage detected