Skip to content
This repository was archived by the owner on Jun 19, 2021. It is now read-only.

Commit 42c3d6f

Browse files
author
Simon Hofmann
committed
Added event source to mouse toggle
1 parent 3166a7f commit 42c3d6f

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/mouse.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,12 +187,14 @@ void toggleMouse(bool down, MMMouseButton button)
187187
#if defined(IS_MACOSX)
188188
const CGPoint currentPos = CGPointFromMMPoint(getMousePos());
189189
const CGEventType mouseType = MMMouseToCGEventType(down, button);
190-
CGEventRef event = CGEventCreateMouseEvent(NULL,
190+
CGEventSourceRef src = CGEventSourceCreate(kCGEventSourceStateHIDSystemState);
191+
CGEventRef event = CGEventCreateMouseEvent(src,
191192
mouseType,
192193
currentPos,
193194
(CGMouseButton)button);
194195
CGEventPost(kCGSessionEventTap, event);
195196
CFRelease(event);
197+
CFRelease(src);
196198
#elif defined(USE_X11)
197199
Display *display = XGetMainDisplay();
198200
XTestFakeButtonEvent(display, button, down ? True : False, CurrentTime);

0 commit comments

Comments
 (0)