MCPcopy Create free account
hub / github.com/golang/mobile / processKey

Function processKey

app/android.go:432–453  ·  view source on GitHub ↗
(env *C.JNIEnv, e *C.AInputEvent)

Source from the content-addressed store, hash-verified

430}
431
432func processKey(env *C.JNIEnv, e *C.AInputEvent) {
433 deviceID := C.AInputEvent_getDeviceId(e)
434 if deviceID == 0 {
435 // Software keyboard input, leaving for scribe/IME.
436 return
437 }
438
439 k := key.Event{
440 Rune: rune(C.getKeyRune(env, e)),
441 Code: convAndroidKeyCode(int32(C.AKeyEvent_getKeyCode(e))),
442 }
443 switch C.AKeyEvent_getAction(e) {
444 case C.AKEY_EVENT_ACTION_DOWN:
445 k.Direction = key.DirPress
446 case C.AKEY_EVENT_ACTION_UP:
447 k.Direction = key.DirRelease
448 default:
449 k.Direction = key.DirNone
450 }
451 // TODO(crawshaw): set Modifiers.
452 theApp.eventsIn <- k
453}
454
455func eglGetError() string {
456 switch errNum := C.eglGetError(); errNum {

Callers 1

processEventFunction · 0.85

Calls 1

convAndroidKeyCodeFunction · 0.85

Tested by

no test coverage detected