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:
parent
f93801c221
commit
7b938c6b08
|
@ -120,6 +120,9 @@ typedef struct tagKBDLLHOOKSTRUCT {
|
||||||
#ifndef WHEEL_DELTA
|
#ifndef WHEEL_DELTA
|
||||||
#define WHEEL_DELTA 120
|
#define WHEEL_DELTA 120
|
||||||
#endif
|
#endif
|
||||||
|
#ifndef WM_MOUSEHWHEEL
|
||||||
|
#define WM_MOUSEHWHEEL 0x020E
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef WM_XBUTTONDOWN
|
#ifndef WM_XBUTTONDOWN
|
||||||
#define WM_XBUTTONDOWN 0x020B
|
#define WM_XBUTTONDOWN 0x020B
|
||||||
|
|
19
src/win32/win32_window.c
Normal file → Executable file
19
src/win32/win32_window.c
Normal file → Executable file
|
@ -622,8 +622,6 @@ static void translateChar(_GLFWwindow* window, DWORD wParam, DWORD lParam)
|
||||||
static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg,
|
static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg,
|
||||||
WPARAM wParam, LPARAM lParam)
|
WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
int wheelDelta;
|
|
||||||
|
|
||||||
_GLFWwindow* window = (_GLFWwindow*) GetWindowLongPtr(hWnd, 0);
|
_GLFWwindow* window = (_GLFWwindow*) GetWindowLongPtr(hWnd, 0);
|
||||||
|
|
||||||
switch (uMsg)
|
switch (uMsg)
|
||||||
|
@ -880,12 +878,15 @@ static LRESULT CALLBACK windowProc(HWND hWnd, UINT uMsg,
|
||||||
|
|
||||||
case WM_MOUSEWHEEL:
|
case WM_MOUSEWHEEL:
|
||||||
{
|
{
|
||||||
wheelDelta = (((int)wParam) >> 16) / WHEEL_DELTA;
|
_glfwInputScroll(window, 0, (((int) wParam) >> 16) / WHEEL_DELTA);
|
||||||
window->wheelPos += wheelDelta;
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
if (window->mouseWheelCallback)
|
case WM_MOUSEHWHEEL:
|
||||||
window->mouseWheelCallback(window, window->wheelPos);
|
{
|
||||||
|
// This message is only sent on Windows Vista and later
|
||||||
|
|
||||||
|
_glfwInputScroll(window, (((int) wParam) >> 16) / WHEEL_DELTA, 0);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1635,6 +1636,12 @@ void _glfwPlatformPollEvents(void)
|
||||||
MSG msg;
|
MSG msg;
|
||||||
_GLFWwindow* window;
|
_GLFWwindow* window;
|
||||||
|
|
||||||
|
for (window = _glfwLibrary.windowListHead; window; window = window->next)
|
||||||
|
{
|
||||||
|
window->scrollX = 0;
|
||||||
|
window->scrollY = 0;
|
||||||
|
}
|
||||||
|
|
||||||
window = _glfwLibrary.cursorLockWindow;
|
window = _glfwLibrary.cursorLockWindow;
|
||||||
if (window)
|
if (window)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue
Block a user