//export handleKeyUpEvent func handleKeyUpEvent(id unsafe.Pointer, code C.UInt32, mods C.UInt32, text *C.char) { theDisplay.dispatch(uintptr(id), event.KeyUp{ Code: key.Code(code), Mods: key.ModifierSet(mods), Text: C.GoString(text), }) }
//export handleKeyDownEvent func handleKeyDownEvent(id unsafe.Pointer, code C.UInt32, mods C.UInt32, text *C.char) { theDisplay.dispatch(uintptr(id), event.KeyDown{ Code: key.Code(code), Mods: key.ModifierSet(mods), Text: C.GoString(text), }) if key.Modifier(mods) == key.Command { switch code { case C.kVK_ANSI_X: handleCutEvent(id) case C.kVK_ANSI_C: handleCopyEvent(id) case C.kVK_ANSI_V: handlePasteEvent(id) } } }