mirror of
https://github.com/go-vgo/robotgo.git
synced 2025-06-20 06:43:55 +00:00
add move smooth multiple screens support
This commit is contained in:
parent
6417b546fe
commit
a5f566e505
@ -60,10 +60,11 @@ int drag_mouse(int32_t x, int32_t y, MMMouseButton button){
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool move_mouse_smooth(size_t x, size_t y, double lowSpeed,
|
bool move_mouse_smooth(int32_t x, int32_t y, double lowSpeed,
|
||||||
double highSpeed, int msDelay){
|
double highSpeed, int msDelay){
|
||||||
MMPoint point;
|
MMPointInt32 point;
|
||||||
point = MMPointMake(x, y);
|
point = MMPointInt32Make(x, y);
|
||||||
|
|
||||||
bool cbool = smoothlyMoveMouse(point, lowSpeed, highSpeed);
|
bool cbool = smoothlyMoveMouse(point, lowSpeed, highSpeed);
|
||||||
microsleep(msDelay);
|
microsleep(msDelay);
|
||||||
|
|
||||||
|
@ -78,7 +78,7 @@ void dragMouse(MMPointInt32 point, const MMMouseButton button);
|
|||||||
*
|
*
|
||||||
* Returns false if unsuccessful (i.e. a point was hit that is outside of the
|
* Returns false if unsuccessful (i.e. a point was hit that is outside of the
|
||||||
* screen boundaries), or true if successful. */
|
* screen boundaries), or true if successful. */
|
||||||
bool smoothlyMoveMouse(MMPoint endPoint, double lowSpeed, double highSpeed);
|
bool smoothlyMoveMouse(MMPointInt32 endPoint, double lowSpeed, double highSpeed);
|
||||||
// bool smoothlyMoveMouse(MMPoint point);
|
// bool smoothlyMoveMouse(MMPoint point);
|
||||||
|
|
||||||
/* Returns the coordinates of the mouse on the current screen. */
|
/* Returns the coordinates of the mouse on the current screen. */
|
||||||
|
@ -402,7 +402,7 @@ static double crude_hypot(double x, double y){
|
|||||||
return ((M_SQRT2 - 1.0) * small) + big;
|
return ((M_SQRT2 - 1.0) * small) + big;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool smoothlyMoveMouse(MMPoint endPoint, double lowSpeed, double highSpeed){
|
bool smoothlyMoveMouse(MMPointInt32 endPoint, double lowSpeed, double highSpeed){
|
||||||
MMPointInt32 pos = getMousePos();
|
MMPointInt32 pos = getMousePos();
|
||||||
MMSizeInt32 screenSize = getMainDisplaySize();
|
MMSizeInt32 screenSize = getMainDisplaySize();
|
||||||
double velo_x = 0.0, velo_y = 0.0;
|
double velo_x = 0.0, velo_y = 0.0;
|
||||||
@ -432,7 +432,7 @@ bool smoothlyMoveMouse(MMPoint endPoint, double lowSpeed, double highSpeed){
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
moveMouse(MMPointInt32Make((int32_t)pos.x, (int32_t)pos.y));
|
moveMouse(pos);
|
||||||
|
|
||||||
/* Wait 1 - 3 milliseconds. */
|
/* Wait 1 - 3 milliseconds. */
|
||||||
microsleep(DEADBEEF_UNIFORM(lowSpeed, highSpeed));
|
microsleep(DEADBEEF_UNIFORM(lowSpeed, highSpeed));
|
||||||
|
@ -401,8 +401,8 @@ func MoveMouseSmooth(x, y int, args ...interface{}) bool {
|
|||||||
//
|
//
|
||||||
// robotgo.MoveSmooth(x, y int, low, high float64, mouseDelay int)
|
// robotgo.MoveSmooth(x, y int, low, high float64, mouseDelay int)
|
||||||
func MoveSmooth(x, y int, args ...interface{}) bool {
|
func MoveSmooth(x, y int, args ...interface{}) bool {
|
||||||
cx := C.size_t(x)
|
cx := C.int32_t(x)
|
||||||
cy := C.size_t(y)
|
cy := C.int32_t(y)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
mouseDelay = 10
|
mouseDelay = 10
|
||||||
|
Loading…
Reference in New Issue
Block a user