mirror of
https://github.com/go-vgo/robotgo.git
synced 2025-06-01 14:43:55 +00:00
update and fix code style
This commit is contained in:
parent
c8f5ed84ba
commit
5c29507018
@ -110,7 +110,7 @@ void moveMouse(MMPoint point){
|
|||||||
#elif defined(IS_WINDOWS)
|
#elif defined(IS_WINDOWS)
|
||||||
// Mouse motion is now done using SendInput with MOUSEINPUT.
|
// Mouse motion is now done using SendInput with MOUSEINPUT.
|
||||||
// We use Absolute mouse positioning
|
// We use Absolute mouse positioning
|
||||||
#define MOUSE_COORD_TO_ABS(coord, width_or_height) (
|
#define MOUSE_COORD_TO_ABS(coord, width_or_height) ( \
|
||||||
((65536 * coord) / width_or_height) + (coord < 0 ? -1 : 1))
|
((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));
|
||||||
@ -133,8 +133,8 @@ void dragMouse(MMPoint point, const MMMouseButton button){
|
|||||||
#if defined(IS_MACOSX)
|
#if defined(IS_MACOSX)
|
||||||
const CGEventType dragType = MMMouseDragToCGEventType(button);
|
const CGEventType dragType = MMMouseDragToCGEventType(button);
|
||||||
CGEventRef drag = CGEventCreateMouseEvent(NULL, dragType,
|
CGEventRef drag = CGEventCreateMouseEvent(NULL, dragType,
|
||||||
CGPointFromMMPoint(point),
|
CGPointFromMMPoint(point), (CGMouseButton)button);
|
||||||
(CGMouseButton)button);
|
|
||||||
calculateDeltas(&drag, point);
|
calculateDeltas(&drag, point);
|
||||||
|
|
||||||
CGEventPost(kCGSessionEventTap, drag);
|
CGEventPost(kCGSessionEventTap, drag);
|
||||||
@ -180,9 +180,8 @@ void toggleMouse(bool down, MMMouseButton button){
|
|||||||
const CGPoint currentPos = CGPointFromMMPoint(getMousePos());
|
const CGPoint currentPos = CGPointFromMMPoint(getMousePos());
|
||||||
const CGEventType mouseType = MMMouseToCGEventType(down, button);
|
const CGEventType mouseType = MMMouseToCGEventType(down, button);
|
||||||
CGEventRef event = CGEventCreateMouseEvent(NULL,
|
CGEventRef event = CGEventCreateMouseEvent(NULL,
|
||||||
mouseType,
|
mouseType, currentPos, (CGMouseButton)button);
|
||||||
currentPos,
|
|
||||||
(CGMouseButton)button);
|
|
||||||
CGEventPost(kCGSessionEventTap, event);
|
CGEventPost(kCGSessionEventTap, event);
|
||||||
CFRelease(event);
|
CFRelease(event);
|
||||||
#elif defined(USE_X11)
|
#elif defined(USE_X11)
|
||||||
|
Loading…
Reference in New Issue
Block a user