Skip to content

Commit

Permalink
Linux scrollMouse implementation.
Browse files Browse the repository at this point in the history
  • Loading branch information
octalmage committed Aug 21, 2015
1 parent 13a5e15 commit 0403623
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion src/mouse.c
Expand Up @@ -153,7 +153,24 @@ void scrollMouse(int scrollMagnitude, MMMouseWheelDirection scrollDirection)
CGEventPost(kCGHIDEventTap, event);

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

int x;
int dir = 4; /* Button 4 is up, 5 is down. */
Display *display = XGetMainDisplay();

if (scrollDirection == DIRECTION_DOWN)
{
dir = 5;
}

for (x = 0; x < cleanScrollMagnitude; x++)
{
XTestFakeButtonEvent(display, dir, 1, CurrentTime);
XTestFakeButtonEvent(display, dir, 0, CurrentTime);
}

XFlush(display);

#elif defined(IS_WINDOWS)
INPUT mouseScrollInput;
mouseScrollInput.type = INPUT_MOUSE;
Expand Down

0 comments on commit 0403623

Please sign in to comment.