Skip to content

Commit

Permalink
Implemented scrollMouse for Mac.
Browse files Browse the repository at this point in the history
  • Loading branch information
octalmage committed Aug 21, 2015
1 parent 1725c10 commit ded851c
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/mouse.c
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,16 @@ void scrollMouse(int scrollMagnitude, MMMouseWheelDirection scrollDirection)

/* Set up the OS specific solution */
#if defined(__APPLE__)
/* TODO Add Code for this platform */

CGWheelCount wheel = 1;
CGEventRef event;

/* Make scroll magnitude negative if we're scrolling down. */
cleanScrollMagnitude = cleanScrollMagnitude * scrollDirection;

event = CGEventCreateScrollWheelEvent(NULL, kCGScrollEventUnitLine, wheel, cleanScrollMagnitude, 0);
CGEventPost(kCGHIDEventTap, event);

#elif defined(USE_X11)
/* TODO Add Code for this platform */
#elif defined(IS_WINDOWS)
Expand Down

0 comments on commit ded851c

Please sign in to comment.