diff --git a/robotgo.go b/robotgo.go index 056e2ea..75c6e24 100644 --- a/robotgo.go +++ b/robotgo.go @@ -518,12 +518,6 @@ func MouseToggle(togKey string, args ...interface{}) { C.free(unsafe.Pointer(down)) } -// SetMouseDelay set mouse delay -func SetMouseDelay(delay int) { - cdelay := C.size_t(delay) - C.set_mouse_delay(cdelay) -} - // ScrollMouse scroll the mouse func ScrollMouse(x int, direction string) { cx := C.size_t(x) @@ -549,6 +543,12 @@ func Scroll(x, y int, args ...int) { C.scroll(cx, cy, cz) } +// SetMouseDelay set mouse delay +func SetMouseDelay(delay int) { + cdelay := C.size_t(delay) + C.set_mouse_delay(cdelay) +} + /* __ ___ ___________ ____ .______ ______ ___ .______ _______ | |/ / | ____\ \ / / | _ \ / __ \ / \ | _ \ | \ @@ -717,6 +717,12 @@ func CharCodeAt(s string, n int) rune { return 0 } +// UnicodeType tap uint32 unicode +func UnicodeType(str uint32) { + cstr := C.uint(str) + C.unicodeType(cstr) +} + func toUC(text string) []string { var uc []string @@ -779,12 +785,6 @@ func TypeStr(str string, args ...float64) { } } -// UnicodeType tap uint32 unicode -func UnicodeType(str uint32) { - cstr := C.uint(str) - C.unicodeType(cstr) -} - // PasteStr paste a string, support UTF-8 func PasteStr(str string) string { clipboard.WriteAll(str) @@ -829,6 +829,17 @@ func SetKeyboardDelay(delay int) { SetKeyDelay(delay) } +// SetDelay set the key and mouse delay +func SetDelay(d ...int) { + v := 10 + if len(d) > 0 { + v = d[0] + } + + SetMouseDelay(v) + SetKeyDelay(v) +} + /* .______ __ .___________..___ ___. ___ .______ | _ \ | | | || \/ | / \ | _ \