add drag mouse other button support

This commit is contained in:
vcaesar 2018-12-27 12:44:38 -04:00
parent 0a380045a3
commit ad85cfd792
2 changed files with 18 additions and 10 deletions

View File

@ -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);

View File

@ -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,