mirror of
https://github.com/go-vgo/robotgo
synced 2026-05-24 02:08:33 +00:00
Merge pull request #759 from go-vgo/bitmap-pr
Update: optimize the func Click() code
This commit is contained in:
commit
9601698246
1 changed files with 6 additions and 8 deletions
14
robotgo.go
14
robotgo.go
|
|
@ -735,16 +735,14 @@ func Click(args ...interface{}) error {
|
|||
if code := C.toggleMouse(true, button); code != 0 {
|
||||
return formatClickError(int(code), button, "down", count)
|
||||
}
|
||||
|
||||
MilliSleep(5)
|
||||
if code := C.toggleMouse(false, button); code != 0 {
|
||||
return formatClickError(int(code), button, "up", count)
|
||||
}
|
||||
} else {
|
||||
if code := C.doubleClick(button, 2); code != 0 {
|
||||
return formatClickError(int(code), button, "double", 2)
|
||||
}
|
||||
code := C.toggleMouse(false, button)
|
||||
return formatClickError(int(code), button, "up", count)
|
||||
}
|
||||
return nil
|
||||
|
||||
code := C.doubleClick(button, 2)
|
||||
return formatClickError(int(code), button, "double", 2)
|
||||
}
|
||||
|
||||
// MultiClick performs multiple clicks and returns error
|
||||
|
|
|
|||
Loading…
Reference in a new issue