Skip to content

Commit

Permalink
#276 #240 copy event rather than retain
Browse files Browse the repository at this point in the history
  • Loading branch information
koekeishiya committed Oct 9, 2019
1 parent 2aadf6e commit 1ee6b79
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/event_tap.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ static EVENT_TAP_CALLBACK(mouse_handler)
volatile int result = EVENT_SUCCESS;

struct event *event;
event_create(event, MOUSE_DOWN, (void *) CFRetain(cgevent));
event_create(event, MOUSE_DOWN, (void *) CGEventCreateCopy(cgevent));
event->status = &status;
event->result = &result;
event_loop_post(&g_event_loop, event);
Expand All @@ -29,18 +29,18 @@ static EVENT_TAP_CALLBACK(mouse_handler)
case kCGEventLeftMouseUp:
case kCGEventRightMouseUp: {
struct event *event;
event_create(event, MOUSE_UP, (void *) CFRetain(cgevent));
event_create(event, MOUSE_UP, (void *) CGEventCreateCopy(cgevent));
event_loop_post(&g_event_loop, event);
} break;
case kCGEventLeftMouseDragged:
case kCGEventRightMouseDragged: {
struct event *event;
event_create(event, MOUSE_DRAGGED, (void *) CFRetain(cgevent));
event_create(event, MOUSE_DRAGGED, (void *) CGEventCreateCopy(cgevent));
event_loop_post(&g_event_loop, event);
} break;
case kCGEventMouseMoved: {
struct event *event;
event_create(event, MOUSE_MOVED, (void *) CFRetain(cgevent));
event_create(event, MOUSE_MOVED, (void *) CGEventCreateCopy(cgevent));
event_loop_post(&g_event_loop, event);
} break;
}
Expand Down

0 comments on commit 1ee6b79

Please sign in to comment.