aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDmitri Trembovetski <[email protected]>2009-05-26 16:50:14 +0000
committerDmitri Trembovetski <[email protected]>2009-05-26 16:50:14 +0000
commit448a9dce8d46d95b003da0742fab3471d0691307 (patch)
treee062113a6cfd8997fb952b2d3e5aafed3f4f0f66
parentbeaa6d5d02d747c2eda1a3a81ba5e4030c9c5587 (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
-rwxr-xr-xsrc/newt/native/WindowsWindow.c13
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,