diff options
author | Dmitri Trembovetski <[email protected]> | 2009-05-26 16:50:14 +0000 |
---|---|---|
committer | Dmitri Trembovetski <[email protected]> | 2009-05-26 16:50:14 +0000 |
commit | 448a9dce8d46d95b003da0742fab3471d0691307 (patch) | |
tree | e062113a6cfd8997fb952b2d3e5aafed3f4f0f66 /src/newt/native | |
parent | beaa6d5d02d747c2eda1a3a81ba5e4030c9c5587 (diff) |
Newt: fixed mouse wheel support on windows - needed to translate mouse event coordinates from screen to client
git-svn-id: file:///usr/local/projects/SUN/JOGL/git-svn/svn-server-sync/jogl/branches/JOGL_2_SANDBOX@1914 232f8b59-042b-4e1e-8c03-345bb8c30851
Diffstat (limited to 'src/newt/native')
-rwxr-xr-x | src/newt/native/WindowsWindow.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/newt/native/WindowsWindow.c b/src/newt/native/WindowsWindow.c index 8a6617645..d4de158dd 100755 --- a/src/newt/native/WindowsWindow.c +++ b/src/newt/native/WindowsWindow.c @@ -32,6 +32,7 @@ */ #include <Windows.h> +#include <Windowsx.h> #include <tchar.h> #include <stdlib.h> // NOTE: it looks like SHFullScreen and/or aygshell.dll is not available on the APX 2500 any more @@ -250,14 +251,22 @@ static LRESULT CALLBACK wndProc(HWND wnd, UINT message, useDefWindowProc = 1; break; - case WM_MOUSEWHEEL: + case WM_MOUSEWHEEL: { + // need to convert the coordinates to component-relative + int x = GET_X_LPARAM(lParam); + int y = GET_Y_LPARAM(lParam); + POINT eventPt; + eventPt.x = x; + eventPt.y = y; + ScreenToClient(wnd, &eventPt); (*env)->CallVoidMethod(env, window, sendMouseEventID, (jint) EVENT_MOUSE_WHEEL_MOVED, ConvertModifiers(wParam), - (jint) LOWORD(lParam), (jint) HIWORD(lParam), + (jint) eventPt.x, (jint) eventPt.y, (jint) 0, (jint) GET_WHEEL_DELTA_WPARAM(wParam)); useDefWindowProc = 1; break; + } case WM_MOVE: (*env)->CallVoidMethod(env, window, positionChangedID, |