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

Function ProcessKey

system/driver/android/event.go:97–116  ·  view source on GitHub ↗

ProcessKey processes an input key event

(env *C.JNIEnv, e *C.AInputEvent)

Source from the content-addressed store, hash-verified

95
96// ProcessKey processes an input key event
97func ProcessKey(env *C.JNIEnv, e *C.AInputEvent) {
98 deviceID := C.AInputEvent_getDeviceId(e)
99 if deviceID == 0 {
100 // Software keyboard input, leaving for scribe/IME.
101 return
102 }
103
104 r := rune(C.getKeyRune(env, e))
105 code := ConvAndroidKeyCode(int32(C.AKeyEvent_getKeyCode(e)))
106
107 if r >= '0' && r <= '9' { // GBoard generates key events for numbers, but we see them in textChanged
108 return
109 }
110 typ := events.KeyDown
111 if C.AKeyEvent_getAction(e) == C.AKEY_STATE_UP {
112 typ = events.KeyUp
113 }
114 // TODO(crawshaw): set Modifiers.
115 TheApp.Event.Key(typ, r, code, 0)
116}
117
118// AndroidKeyCodes is a map from android system key codes to system key codes
119var AndroidKeyCodes = map[int32]key.Codes{

Callers 1

ProcessEventFunction · 0.85

Calls 2

ConvAndroidKeyCodeFunction · 0.85
KeyMethod · 0.45

Tested by

no test coverage detected