aboutsummaryrefslogtreecommitdiffstats
path: root/src/newt/native
diff options
context:
space:
mode:
authorChristopher Campbell <[email protected]>2009-05-26 18:52:23 +0000
committerChristopher Campbell <[email protected]>2009-05-26 18:52:23 +0000
commit6aaddcca9dcefd240eb616e58ecffc1371d8f19b (patch)
treea504737d30c5f291a00562c85d4e2cf4cbd35068 /src/newt/native
parent448a9dce8d46d95b003da0742fab3471d0691307 (diff)
Fixed NEWT mouse events on Mac OS X to be consistent with Windows implementation (0==none, 1==left, 2==middle, 3==right).
git-svn-id: file:///usr/local/projects/SUN/JOGL/git-svn/svn-server-sync/jogl/branches/JOGL_2_SANDBOX@1915 232f8b59-042b-4e1e-8c03-345bb8c30851
Diffstat (limited to 'src/newt/native')
-rw-r--r--src/newt/native/NewtMacWindow.m26
1 files changed, 24 insertions, 2 deletions
diff --git a/src/newt/native/NewtMacWindow.m b/src/newt/native/NewtMacWindow.m
index e97d8b9ca..75d0a8e62 100644
--- a/src/newt/native/NewtMacWindow.m
+++ b/src/newt/native/NewtMacWindow.m
@@ -157,6 +157,29 @@ static jint mods2JavaMods(NSUInteger mods)
NSPoint location = NSMakePoint(curLocation.x - frameRect.origin.x,
curLocation.y - frameRect.origin.y);
+ // convert to 1-based button number (or use zero if no button is involved)
+ jint javaButtonNum;
+ switch ([event type]) {
+ case NSLeftMouseDown:
+ case NSLeftMouseUp:
+ case NSLeftMouseDragged:
+ javaButtonNum = 1;
+ break;
+ case NSRightMouseDown:
+ case NSRightMouseUp:
+ case NSRightMouseDragged:
+ javaButtonNum = 3;
+ break;
+ case NSOtherMouseDown:
+ case NSOtherMouseUp:
+ case NSOtherMouseDragged:
+ javaButtonNum = 2;
+ break;
+ default:
+ javaButtonNum = 0;
+ break;
+ }
+
if (env == NULL) {
return;
}
@@ -165,12 +188,11 @@ static jint mods2JavaMods(NSUInteger mods)
return;
}
- // 1-base the button number
(*env)->CallVoidMethod(env, javaWindowObject, sendMouseEventID,
evType, javaMods,
(jint) location.x,
(jint) (contentRect.size.height - location.y),
- (jint) (1 + [event buttonNumber]), 0);
+ javaButtonNum, 0);
}
- (void) mouseEntered: (NSEvent*) theEvent