1
0
Fork 0
mirror of https://github.com/gwm17/glfw.git synced 2024-11-23 02:38:52 -05:00

Added Win32 implementation of two-dimensional scrolling.

This commit is contained in:
Camilla Berglund 2010-09-27 02:32:41 +02:00
parent f93801c221
commit 7b938c6b08
2 changed files with 16 additions and 6 deletions

View File

@ -120,6 +120,9 @@ typedef struct tagKBDLLHOOKSTRUCT {
#ifndef WHEEL_DELTA
#define WHEEL_DELTA 120
#endif
#ifndef WM_MOUSEHWHEEL
#define WM_MOUSEHWHEEL 0x020E
#endif
#ifndef WM_XBUTTONDOWN
#define WM_XBUTTONDOWN 0x020B

19
src/win32/win32_window.c Normal file → Executable file
View File

@ -622,8 +622,6 @@ static void translateChar(_GLFWwindow* window, DWORD wParam, DWORD lParam)
static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg,
WPARAM wParam, LPARAM lParam)
{
int wheelDelta;
_GLFWwindow* window = (_GLFWwindow*) GetWindowLongPtr(hWnd, 0);
switch (uMsg)
@ -880,12 +878,15 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg,
case WM_MOUSEWHEEL:
{
wheelDelta = (((int)wParam) >> 16) / WHEEL_DELTA;
window->wheelPos += wheelDelta;
_glfwInputScroll(window, 0, (((int) wParam) >> 16) / WHEEL_DELTA);
return 0;
}
if (window->mouseWheelCallback)
window->mouseWheelCallback(window, window->wheelPos);
case WM_MOUSEHWHEEL:
{
// This message is only sent on Windows Vista and later
_glfwInputScroll(window, (((int) wParam) >> 16) / WHEEL_DELTA, 0);
return 0;
}
@ -1635,6 +1636,12 @@ void _glfwPlatformPollEvents(void)
MSG msg;
_GLFWwindow* window;
for (window = _glfwLibrary.windowListHead; window; window = window->next)
{
window->scrollX = 0;
window->scrollY = 0;
}
window = _glfwLibrary.cursorLockWindow;
if (window)
{