Compare commits

..

No commits in common. "023426ab13b151d0995f6eb38a0a8f61f3938a34" and "c431c8f974e499f80ff0835be91c0bbfdee48861" have entirely different histories.

8
key.go
View File

@ -486,7 +486,7 @@ func toErr(str *C.char) error {
return errors.New(gstr) return errors.New(gstr)
} }
func appendShift(key string, len1 int, args ...interface{}) (string, []interface{}) { func appendShift(key string, len1 int, args ...interface{}) []interface{} {
if len(key) > 0 && unicode.IsUpper([]rune(key)[0]) { if len(key) > 0 && unicode.IsUpper([]rune(key)[0]) {
args = append(args, "shift") args = append(args, "shift")
} }
@ -499,7 +499,7 @@ func appendShift(key string, len1 int, args ...interface{}) (string, []interface
} }
} }
return key, args return args
} }
// KeyTap taps the keyboard code; // KeyTap taps the keyboard code;
@ -520,7 +520,7 @@ func appendShift(key string, len1 int, args ...interface{}) (string, []interface
// robotgo.KeyTap("k", pid int) // robotgo.KeyTap("k", pid int)
func KeyTap(key string, args ...interface{}) error { func KeyTap(key string, args ...interface{}) error {
var keyArr []string var keyArr []string
key, args = appendShift(key, 0, args...) args = appendShift(key, 0, args...)
pid := 0 pid := 0
if len(args) > 0 { if len(args) > 0 {
@ -563,7 +563,7 @@ func getToggleArgs(args ...interface{}) (pid int, keyArr []string) {
// robotgo.KeyToggle("a", "up", "alt", "cmd") // robotgo.KeyToggle("a", "up", "alt", "cmd")
// robotgo.KeyToggle("k", pid int) // robotgo.KeyToggle("k", pid int)
func KeyToggle(key string, args ...interface{}) error { func KeyToggle(key string, args ...interface{}) error {
key, args = appendShift(key, 1, args...) args = appendShift(key, 1, args...)
pid, keyArr := getToggleArgs(args...) pid, keyArr := getToggleArgs(args...)
return keyToggles(key, keyArr, pid) return keyToggles(key, keyArr, pid)
} }