mirror of
https://github.com/go-vgo/robotgo.git
synced 2025-06-01 06:33:56 +00:00
Fix MouseToggle
This commit is contained in:
parent
08d245f08f
commit
4ea8a5eea5
@ -86,10 +86,19 @@ int aMouseClick(){
|
||||
return 0;
|
||||
}
|
||||
|
||||
int aMouseToggle(){
|
||||
MMMouseButton button = LEFT_BUTTON;
|
||||
int aMouseToggle(char* d,MMMouseButton button){
|
||||
// MMMouseButton button = LEFT_BUTTON;
|
||||
bool down = false;
|
||||
if (strcmp(d, "down") == 0){
|
||||
down = true;
|
||||
}else if (strcmp(d, "up") == 0){
|
||||
down = false;
|
||||
}else{
|
||||
return 1;
|
||||
}
|
||||
|
||||
toggleMouse(down, button);
|
||||
microsleep(mouseDelay);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
12
robotgo.go
12
robotgo.go
@ -138,8 +138,16 @@ func MouseClick() {
|
||||
C.aMouseClick()
|
||||
}
|
||||
|
||||
func MouseToggle() {
|
||||
C.aMouseToggle()
|
||||
func MouseToggle(args ...interface{}) {
|
||||
var button C.MMMouseButton
|
||||
Try(func() {
|
||||
button = args[1].(C.MMMouseButton)
|
||||
}, func(e interface{}) {
|
||||
Println("err:::", e)
|
||||
button = C.LEFT_BUTTON
|
||||
})
|
||||
down := C.CString(args[0].(string))
|
||||
C.aMouseToggle(down, button)
|
||||
}
|
||||
|
||||
func SetMouseDelay(x int) {
|
||||
|
Loading…
Reference in New Issue
Block a user