mirror of
https://github.com/go-vgo/robotgo.git
synced 2025-06-02 23:23:55 +00:00
update code style
This commit is contained in:
parent
178d876f8d
commit
c8f5ed84ba
@ -105,12 +105,17 @@ void moveMouse(MMPoint point){
|
|||||||
Display *display = XGetMainDisplay();
|
Display *display = XGetMainDisplay();
|
||||||
XWarpPointer(display, None, DefaultRootWindow(display),
|
XWarpPointer(display, None, DefaultRootWindow(display),
|
||||||
0, 0, 0, 0, point.x, point.y);
|
0, 0, 0, 0, point.x, point.y);
|
||||||
|
|
||||||
XSync(display, false);
|
XSync(display, false);
|
||||||
#elif defined(IS_WINDOWS)
|
#elif defined(IS_WINDOWS)
|
||||||
//Mouse motion is now done using SendInput with MOUSEINPUT. We use Absolute mouse positioning
|
// Mouse motion is now done using SendInput with MOUSEINPUT.
|
||||||
#define MOUSE_COORD_TO_ABS(coord, width_or_height) (((65536 * coord) / width_or_height) + (coord < 0 ? -1 : 1))
|
// We use Absolute mouse positioning
|
||||||
|
#define MOUSE_COORD_TO_ABS(coord, width_or_height) (
|
||||||
|
((65536 * coord) / width_or_height) + (coord < 0 ? -1 : 1))
|
||||||
|
|
||||||
point.x = MOUSE_COORD_TO_ABS(point.x, GetSystemMetrics(SM_CXSCREEN));
|
point.x = MOUSE_COORD_TO_ABS(point.x, GetSystemMetrics(SM_CXSCREEN));
|
||||||
point.y = MOUSE_COORD_TO_ABS(point.y, GetSystemMetrics(SM_CYSCREEN));
|
point.y = MOUSE_COORD_TO_ABS(point.y, GetSystemMetrics(SM_CYSCREEN));
|
||||||
|
|
||||||
INPUT mouseInput;
|
INPUT mouseInput;
|
||||||
mouseInput.type = INPUT_MOUSE;
|
mouseInput.type = INPUT_MOUSE;
|
||||||
mouseInput.mi.dx = point.x;
|
mouseInput.mi.dx = point.x;
|
||||||
@ -206,7 +211,8 @@ void doubleClick(MMMouseButton button){
|
|||||||
const CGEventType mouseTypeDown = MMMouseToCGEventType(true, button);
|
const CGEventType mouseTypeDown = MMMouseToCGEventType(true, button);
|
||||||
const CGEventType mouseTypeUP = MMMouseToCGEventType(false, button);
|
const CGEventType mouseTypeUP = MMMouseToCGEventType(false, button);
|
||||||
|
|
||||||
CGEventRef event = CGEventCreateMouseEvent(NULL, mouseTypeDown, currentPos, kCGMouseButtonLeft);
|
CGEventRef event = CGEventCreateMouseEvent(
|
||||||
|
NULL, mouseTypeDown, currentPos, kCGMouseButtonLeft);
|
||||||
|
|
||||||
/* Set event to double click. */
|
/* Set event to double click. */
|
||||||
CGEventSetIntegerValueField(event, kCGMouseEventClickState, 2);
|
CGEventSetIntegerValueField(event, kCGMouseEventClickState, 2);
|
||||||
@ -265,13 +271,11 @@ void scrollMouse(int scrollMagnitude, MMMouseWheelDirection scrollDirection){
|
|||||||
int dir = 4; /* Button 4 is up, 5 is down. */
|
int dir = 4; /* Button 4 is up, 5 is down. */
|
||||||
Display *display = XGetMainDisplay();
|
Display *display = XGetMainDisplay();
|
||||||
|
|
||||||
if (scrollDirection == DIRECTION_DOWN)
|
if (scrollDirection == DIRECTION_DOWN) {
|
||||||
{
|
|
||||||
dir = 5;
|
dir = 5;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (x = 0; x < cleanScrollMagnitude; x++)
|
for (x = 0; x < cleanScrollMagnitude; x++) {
|
||||||
{
|
|
||||||
XTestFakeButtonEvent(display, dir, 1, CurrentTime);
|
XTestFakeButtonEvent(display, dir, 1, CurrentTime);
|
||||||
XTestFakeButtonEvent(display, dir, 0, CurrentTime);
|
XTestFakeButtonEvent(display, dir, 0, CurrentTime);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user