mirror of
https://github.com/go-vgo/robotgo.git
synced 2025-06-02 23:23:55 +00:00
Fix MouseToggle
This commit is contained in:
parent
08d245f08f
commit
4ea8a5eea5
@ -86,10 +86,19 @@ int aMouseClick(){
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int aMouseToggle(){
|
int aMouseToggle(char* d,MMMouseButton button){
|
||||||
MMMouseButton button = LEFT_BUTTON;
|
// MMMouseButton button = LEFT_BUTTON;
|
||||||
bool down = false;
|
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;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
12
robotgo.go
12
robotgo.go
@ -138,8 +138,16 @@ func MouseClick() {
|
|||||||
C.aMouseClick()
|
C.aMouseClick()
|
||||||
}
|
}
|
||||||
|
|
||||||
func MouseToggle() {
|
func MouseToggle(args ...interface{}) {
|
||||||
C.aMouseToggle()
|
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) {
|
func SetMouseDelay(x int) {
|
||||||
|
Loading…
Reference in New Issue
Block a user