mirror of
https://github.com/go-vgo/robotgo.git
synced 2025-06-01 14:43:55 +00:00
add drag mouse other button support
This commit is contained in:
parent
0a380045a3
commit
ad85cfd792
@ -16,8 +16,8 @@ int mouseDelay = 10;
|
|||||||
// int keyboardDelay = 10;
|
// int keyboardDelay = 10;
|
||||||
|
|
||||||
|
|
||||||
// int CheckMouseButton(const char * const b,
|
// int CheckMouseButton(const char * const b,
|
||||||
// MMMouseButton * const button){
|
// MMMouseButton * const button){
|
||||||
// if (!button) return -1;
|
// if (!button) return -1;
|
||||||
|
|
||||||
// if (strcmp(b, "left") == 0) {
|
// if (strcmp(b, "left") == 0) {
|
||||||
@ -37,18 +37,19 @@ int mouseDelay = 10;
|
|||||||
|
|
||||||
int move_mouse(size_t x, size_t y){
|
int move_mouse(size_t x, size_t y){
|
||||||
MMPoint point;
|
MMPoint point;
|
||||||
//int x = 103;
|
// int x = 103;
|
||||||
//int y = 104;
|
// int y = 104;
|
||||||
point = MMPointMake(x, y);
|
point = MMPointMake(x, y);
|
||||||
moveMouse(point);
|
moveMouse(point);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int drag_mouse(size_t x, size_t y){
|
|
||||||
|
int drag_mouse(size_t x, size_t y, MMMouseButton button){
|
||||||
// const size_t x = 10;
|
// const size_t x = 10;
|
||||||
// const size_t y = 20;
|
// const size_t y = 20;
|
||||||
MMMouseButton button = LEFT_BUTTON;
|
// MMMouseButton button = LEFT_BUTTON;
|
||||||
|
|
||||||
MMPoint point;
|
MMPoint point;
|
||||||
point = MMPointMake(x, y);
|
point = MMPointMake(x, y);
|
||||||
|
15
robotgo.go
15
robotgo.go
@ -353,15 +353,22 @@ func Move(x, y int) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// DragMouse drag the mouse
|
// DragMouse drag the mouse
|
||||||
func DragMouse(x, y int) {
|
func DragMouse(x, y int, args ...string) {
|
||||||
Drag(x, y)
|
Drag(x, y, args...)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Drag drag the mouse
|
// Drag drag the mouse
|
||||||
func Drag(x, y int) {
|
func Drag(x, y int, args ...string) {
|
||||||
|
var button C.MMMouseButton = C.LEFT_BUTTON
|
||||||
|
|
||||||
cx := C.size_t(x)
|
cx := C.size_t(x)
|
||||||
cy := C.size_t(y)
|
cy := C.size_t(y)
|
||||||
C.drag_mouse(cx, cy)
|
|
||||||
|
if len(args) > 0 {
|
||||||
|
button = CheckMouse(args[0])
|
||||||
|
}
|
||||||
|
|
||||||
|
C.drag_mouse(cx, cy, button)
|
||||||
}
|
}
|
||||||
|
|
||||||
// MoveMouseSmooth move the mouse smooth,
|
// MoveMouseSmooth move the mouse smooth,
|
||||||
|
Loading…
Reference in New Issue
Block a user