mirror of
https://github.com/go-vgo/robotgo.git
synced 2025-05-31 06:13:55 +00:00
Add AddEvent f1-f12
This commit is contained in:
parent
a2cfdeeab6
commit
610eae215a
@ -120,6 +120,13 @@ void dispatch_proc(iohook_event * const event) {
|
||||
snprintf(buffer + length, sizeof(buffer) - length,
|
||||
",keycode=%u,rawcode=0x%X",
|
||||
event->data.keyboard.keycode, event->data.keyboard.rawcode);
|
||||
int akeycode=(uint16_t) event->data.keyboard.keycode;
|
||||
// printf("atoi(str)---%d\n", atoi(cevent));
|
||||
if (akeycode==atoi(cevent)){
|
||||
int astop=aStop();
|
||||
// printf("%d\n",astop);
|
||||
cstatus=0;
|
||||
}
|
||||
break;
|
||||
|
||||
case EVENT_KEY_TYPED:
|
||||
|
32
robotgo.go
32
robotgo.go
@ -615,6 +615,7 @@ func Convert(args ...interface{}) {
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
------------ --- --- ------------ ---- ---- ------------
|
||||
************ *** *** ************ ***** **** ************
|
||||
---- --- --- ---- ------ ---- ------------
|
||||
@ -623,12 +624,39 @@ func Convert(args ...interface{}) {
|
||||
**** ******** **** **** ****** ****
|
||||
------------ ------ ------------ ---- ----- ----
|
||||
************ **** ************ **** **** ****
|
||||
|
||||
*/
|
||||
|
||||
//Map a map
|
||||
type Map map[string]interface{}
|
||||
|
||||
//AddEvent Add Event
|
||||
func AddEvent(aeve string) int {
|
||||
cs := C.CString(aeve)
|
||||
keycode := Map{
|
||||
"f1": "59",
|
||||
"f2": "60",
|
||||
"f3": "61",
|
||||
"f4": "62",
|
||||
"f5": "63",
|
||||
"f6": "64",
|
||||
"f7": "65",
|
||||
"f8": "66",
|
||||
"f9": "67",
|
||||
"f10": "68",
|
||||
"f11": "69",
|
||||
"f12": "70",
|
||||
}
|
||||
|
||||
var cs *C.char
|
||||
var keve string
|
||||
|
||||
if len(aeve) > 1 {
|
||||
keve = keycode[aeve].(string)
|
||||
cs = C.CString(keve)
|
||||
} else {
|
||||
cs = C.CString(aeve)
|
||||
}
|
||||
|
||||
// cs := C.CString(aeve)
|
||||
eve := C.aEvent(cs)
|
||||
// Println("event@@", eve)
|
||||
geve := int(eve)
|
||||
|
Loading…
Reference in New Issue
Block a user