diff --git a/mouse/mouse_c.h b/mouse/mouse_c.h index b9c4c45e..d6da85d9 100644 --- a/mouse/mouse_c.h +++ b/mouse/mouse_c.h @@ -93,9 +93,8 @@ void calculateDeltas(CGEventRef *event, MMPointInt32 point){ */ void moveMouse(MMPointInt32 point){ #if defined(IS_MACOSX) - CGEventRef move = CGEventCreateMouseEvent(NULL, kCGEventMouseMoved, - CGPointFromMMPointInt32(point), - kCGMouseButtonLeft); + CGEventRef move = CGEventCreateMouseEvent(NULL, kCGEventMouseMoved, + CGPointFromMMPointInt32(point), kCGMouseButtonLeft); calculateDeltas(&move, point); @@ -103,8 +102,7 @@ void moveMouse(MMPointInt32 point){ CFRelease(move); #elif defined(USE_X11) Display *display = XGetMainDisplay(); - XWarpPointer(display, None, DefaultRootWindow(display), - 0, 0, 0, 0, point.x, point.y); + XWarpPointer(display, None, DefaultRootWindow(display), 0, 0, 0, 0, point.x, point.y); XSync(display, false); #elif defined(IS_WINDOWS) @@ -114,8 +112,8 @@ void moveMouse(MMPointInt32 point){ ((65536 * coord) / width_or_height) + (coord < 0 ? -1 : 1)) MMRectInt32 rect = getScreenRect(-1); - size_t x = MOUSE_COORD_TO_ABS(point.x - rect.origin.x, rect.size.w); - size_t y = MOUSE_COORD_TO_ABS(point.y - rect.origin.y, rect.size.h); + int32_t x = MOUSE_COORD_TO_ABS(point.x - rect.origin.x, rect.size.w); + int32_t y = MOUSE_COORD_TO_ABS(point.y - rect.origin.y, rect.size.h); INPUT mouseInput; mouseInput.type = INPUT_MOUSE; @@ -123,6 +121,7 @@ void moveMouse(MMPointInt32 point){ mouseInput.mi.dy = y; mouseInput.mi.dwFlags = MOUSEEVENTF_ABSOLUTE | MOUSEEVENTF_MOVE | MOUSEEVENTF_VIRTUALDESK; mouseInput.mi.time = 0; // System will provide the timestamp + mouseInput.mi.dwExtraInfo = 0; mouseInput.mi.mouseData = 0; SendInput(1, &mouseInput, sizeof(mouseInput)); @@ -133,8 +132,8 @@ void moveMouse(MMPointInt32 point){ void dragMouse(MMPointInt32 point, const MMMouseButton button){ #if defined(IS_MACOSX) const CGEventType dragType = MMMouseDragToCGEventType(button); - CGEventRef drag = CGEventCreateMouseEvent(NULL, dragType, - CGPointFromMMPoint(point), (CGMouseButton)button); + CGEventRef drag = CGEventCreateMouseEvent(NULL, dragType, + CGPointFromMMPoint(point), (CGMouseButton)button); calculateDeltas(&drag, point); @@ -181,7 +180,7 @@ void toggleMouse(bool down, MMMouseButton button){ const CGPoint currentPos = CGPointFromMMPoint(getMousePos()); const CGEventType mouseType = MMMouseToCGEventType(down, button); CGEventRef event = CGEventCreateMouseEvent(NULL, - mouseType, currentPos, (CGMouseButton)button); + mouseType, currentPos, (CGMouseButton)button); CGEventPost(kCGSessionEventTap, event); CFRelease(event); @@ -191,7 +190,6 @@ void toggleMouse(bool down, MMMouseButton button){ XSync(display, false); #elif defined(IS_WINDOWS) // mouse_event(MMMouseToMEventF(down, button), 0, 0, 0, 0); - INPUT mouseInput; mouseInput.type = INPUT_MOUSE; @@ -224,7 +222,7 @@ void doubleClick(MMMouseButton button){ const CGEventType mouseTypeUP = MMMouseToCGEventType(false, button); CGEventRef event = CGEventCreateMouseEvent( - NULL, mouseTypeDown, currentPos, kCGMouseButtonLeft); + NULL, mouseTypeDown, currentPos, kCGMouseButtonLeft); /* Set event to double click. */ CGEventSetIntegerValueField(event, kCGMouseEventClickState, 2); @@ -275,7 +273,7 @@ void scrollMouse(int scrollMagnitude, MMMouseWheelDirection scrollDirection){ cleanScrollMagnitude = cleanScrollMagnitude * scrollDirection; event = CGEventCreateScrollWheelEvent(NULL, - kCGScrollEventUnitLine, wheel, cleanScrollMagnitude, 0); + kCGScrollEventUnitLine, wheel, cleanScrollMagnitude, 0); CGEventPost(kCGHIDEventTap, event);