mirror of
https://github.com/go-vgo/robotgo.git
synced 2025-05-31 06:13: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 CheckMouseButton(const char * const b,
|
||||
// MMMouseButton * const button){
|
||||
// int CheckMouseButton(const char * const b,
|
||||
// MMMouseButton * const button){
|
||||
// if (!button) return -1;
|
||||
|
||||
// if (strcmp(b, "left") == 0) {
|
||||
@ -37,18 +37,19 @@ int mouseDelay = 10;
|
||||
|
||||
int move_mouse(size_t x, size_t y){
|
||||
MMPoint point;
|
||||
//int x = 103;
|
||||
//int y = 104;
|
||||
// int x = 103;
|
||||
// int y = 104;
|
||||
point = MMPointMake(x, y);
|
||||
moveMouse(point);
|
||||
|
||||
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