diff --git a/keycode.go b/keycode.go index c18a3d0..38daae3 100644 --- a/keycode.go +++ b/keycode.go @@ -10,7 +10,8 @@ package robotgo -var mouseMap = Map{ +// MouseMap robotgo hook mouse's code map +var MouseMap = Map{ "left": 1, "right": 2, "center": 3, @@ -20,7 +21,8 @@ var mouseMap = Map{ "wheelRight": 7, } -var keycode = Map{ +// Keycode robotgo hook key's code map +var Keycode = Map{ "`": 41, "1": 2, "2": 3, diff --git a/robotgo.go b/robotgo.go index d4f4462..c1cc9ce 100644 --- a/robotgo.go +++ b/robotgo.go @@ -1281,7 +1281,7 @@ func AddEvent(key string) bool { } if len(key) > 1 && !mouseBool { - key = strconv.Itoa(keycode[key].(int)) + key = strconv.Itoa(Keycode[key].(int)) } geve := hook.AddEvent(key) @@ -1327,7 +1327,7 @@ func AddEvents(key string, arr ...string) bool { l := len(arr) if l > 0 { for i := 0; i < l; i++ { - ukey := uint16(keycode[arr[i]].(int)) + ukey := uint16(Keycode[arr[i]].(int)) if e.Kind == hook.KeyHold && e.Keycode == ukey { k++ @@ -1349,7 +1349,7 @@ func AddEvents(key string, arr ...string) bool { ct = true } - if ct && e.Kind == hook.KeyUp && e.Keycode == uint16(keycode[key].(int)) { + if ct && e.Kind == hook.KeyUp && e.Keycode == uint16(Keycode[key].(int)) { hook.End() // k = 0 break @@ -1368,7 +1368,7 @@ func AddEvents(key string, arr ...string) bool { // robotgo.AddMouse("left", 100, 100) func AddMouse(btn string, x ...int16) bool { s := hook.Start() - ukey := mouseMap[btn] + ukey := MouseMap[btn] ct := false for {