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
@ -45,10 +45,11 @@ int move_mouse(size_t x, size_t y){
|
||||
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 y = 20;
|
||||
MMMouseButton button = LEFT_BUTTON;
|
||||
// MMMouseButton button = LEFT_BUTTON;
|
||||
|
||||
MMPoint point;
|
||||
point = MMPointMake(x, y);
|
||||
|
15
robotgo.go
15
robotgo.go
@ -353,15 +353,22 @@ func Move(x, y int) {
|
||||
}
|
||||
|
||||
// DragMouse drag the mouse
|
||||
func DragMouse(x, y int) {
|
||||
Drag(x, y)
|
||||
func DragMouse(x, y int, args ...string) {
|
||||
Drag(x, y, args...)
|
||||
}
|
||||
|
||||
// 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)
|
||||
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,
|
||||
|
Loading…
Reference in New Issue
Block a user