Skip to content

Commit

Permalink
Merge pull request octalmage#508 from gera2ld/fix/scrolling
Browse files Browse the repository at this point in the history
fix: scrolling on Windows
  • Loading branch information
oktapodia authored Jan 16, 2020
2 parents 99021d8 + 9dc6ff3 commit 24231df
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/mouse.c
Original file line number Diff line number Diff line change
Expand Up @@ -325,24 +325,25 @@ void scrollMouse(int x, int y)

#elif defined(IS_WINDOWS)

// Must send y first, otherwise we get stuck when scrolling on y axis
mouseScrollInputs[0].type = INPUT_MOUSE;
mouseScrollInputs[0].mi.dx = 0;
mouseScrollInputs[0].mi.dy = 0;
mouseScrollInputs[0].mi.dwFlags = MOUSEEVENTF_HWHEEL;
mouseScrollInputs[0].mi.dwFlags = MOUSEEVENTF_WHEEL;
mouseScrollInputs[0].mi.time = 0;
mouseScrollInputs[0].mi.dwExtraInfo = 0;
// Flip x to match other platforms.
mouseScrollInputs[0].mi.mouseData = -x;
mouseScrollInputs[0].mi.mouseData = y;

mouseScrollInputs[1].type = INPUT_MOUSE;
mouseScrollInputs[1].mi.dx = 0;
mouseScrollInputs[1].mi.dy = 0;
mouseScrollInputs[1].mi.dwFlags = MOUSEEVENTF_WHEEL;
mouseScrollInputs[1].mi.dwFlags = MOUSEEVENTF_HWHEEL;
mouseScrollInputs[1].mi.time = 0;
mouseScrollInputs[1].mi.dwExtraInfo = 0;
mouseScrollInputs[1].mi.mouseData = y;
// Flip x to match other platforms.
mouseScrollInputs[1].mi.mouseData = -x;

SendInput(2, mouseScrollInputs, sizeof(mouseScrollInputs));
SendInput(2, mouseScrollInputs, sizeof(INPUT));
#endif
}

Expand Down

0 comments on commit 24231df

Please sign in to comment.