mirror of
https://github.com/go-vgo/robotgo.git
synced 2025-05-29 21:43:55 +00:00
Update: add CFRelease source
This commit is contained in:
parent
5c2864485d
commit
02c668a946
@ -189,6 +189,7 @@ void toggleKeyCode(MMKeyCode code, const bool down, MMKeyFlags flags, uintptr pi
|
|||||||
}
|
}
|
||||||
|
|
||||||
SendTo(pid, keyEvent);
|
SendTo(pid, keyEvent);
|
||||||
|
CFRelease(source);
|
||||||
}
|
}
|
||||||
#elif defined(IS_WINDOWS)
|
#elif defined(IS_WINDOWS)
|
||||||
const DWORD dwFlags = down ? 0 : KEYEVENTF_KEYUP;
|
const DWORD dwFlags = down ? 0 : KEYEVENTF_KEYUP;
|
||||||
@ -284,6 +285,7 @@ void toggleKey(char c, const bool down, MMKeyFlags flags, uintptr pid) {
|
|||||||
CGEventKeyboardSetUnicodeString(keyEvent, 1, &ch);
|
CGEventKeyboardSetUnicodeString(keyEvent, 1, &ch);
|
||||||
|
|
||||||
SendTo(pid, keyEvent);
|
SendTo(pid, keyEvent);
|
||||||
|
CFRelease(source);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
#define toggleUniKey(c, down) toggleKey(c, down, MOD_NONE, 0)
|
#define toggleUniKey(c, down) toggleKey(c, down, MOD_NONE, 0)
|
||||||
|
@ -91,6 +91,7 @@ void moveMouse(MMPointInt32 point){
|
|||||||
|
|
||||||
CGEventPost(kCGHIDEventTap, move);
|
CGEventPost(kCGHIDEventTap, move);
|
||||||
CFRelease(move);
|
CFRelease(move);
|
||||||
|
CFRelease(source);
|
||||||
#elif defined(USE_X11)
|
#elif defined(USE_X11)
|
||||||
Display *display = XGetMainDisplay();
|
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);
|
||||||
@ -112,6 +113,7 @@ void dragMouse(MMPointInt32 point, const MMMouseButton button){
|
|||||||
|
|
||||||
CGEventPost(kCGHIDEventTap, drag);
|
CGEventPost(kCGHIDEventTap, drag);
|
||||||
CFRelease(drag);
|
CFRelease(drag);
|
||||||
|
CFRelease(source);
|
||||||
#else
|
#else
|
||||||
moveMouse(point);
|
moveMouse(point);
|
||||||
#endif
|
#endif
|
||||||
@ -152,6 +154,7 @@ void toggleMouse(bool down, MMMouseButton button) {
|
|||||||
|
|
||||||
CGEventPost(kCGHIDEventTap, event);
|
CGEventPost(kCGHIDEventTap, event);
|
||||||
CFRelease(event);
|
CFRelease(event);
|
||||||
|
CFRelease(source);
|
||||||
#elif defined(USE_X11)
|
#elif defined(USE_X11)
|
||||||
Display *display = XGetMainDisplay();
|
Display *display = XGetMainDisplay();
|
||||||
XTestFakeButtonEvent(display, button, down ? True : False, CurrentTime);
|
XTestFakeButtonEvent(display, button, down ? True : False, CurrentTime);
|
||||||
|
Loading…
Reference in New Issue
Block a user