add KeyTap() special key support

This commit is contained in:
vcaesar 2021-11-07 16:24:54 -04:00
parent 1de0de6dca
commit 3c8efddb74
2 changed files with 39 additions and 3 deletions

View File

@ -38,6 +38,7 @@ var Keycode = uMap{
"0": 11,
"-": 12,
"=": 13,
//
"_": 12,
"+": 13,
//
@ -53,10 +54,11 @@ var Keycode = uMap{
"p": 25,
"[": 26,
"]": 27,
"{": 26,
"}": 27,
"\\": 43,
"|": 43,
//
"{": 26,
"}": 27,
"|": 43,
//
"a": 30,
"s": 31,
@ -69,6 +71,7 @@ var Keycode = uMap{
"l": 38,
";": 39,
"'": 40,
//
":": 39,
`"`: 40,
//
@ -82,6 +85,7 @@ var Keycode = uMap{
",": 51,
".": 52,
"/": 53,
//
"<": 51,
">": 52,
"?": 53,
@ -120,3 +124,28 @@ var Keycode = uMap{
"left": 57419,
"right": 57421,
}
// Special is the special key map
var Special = map[string]string{
"~": "`",
"!": "1",
"@": "2",
"#": "3",
"$": "4",
"%": "5",
"^": "6",
"&": "7",
"*": "8",
"(": "9",
")": "0",
"_": "-",
"+": "=",
"{": "[",
"}": "]",
"|": "\\",
":": ";",
`"`: "'",
"<": ",",
">": ".",
"?": "/",
}

View File

@ -659,6 +659,13 @@ func KeyTap(tapKey string, args ...interface{}) string {
keyDelay = 10
)
if _, ok := Special[tapKey]; ok {
tapKey = Special[tapKey]
if len(args) <= 0 {
args = append(args, "shift")
}
}
// var ckeyArr []*C.char
ckeyArr := make([](*C.char), 0)
// zkey := C.CString(args[0])