aboutsummaryrefslogtreecommitdiffstats
path: root/src/native
diff options
context:
space:
mode:
authorKenneth Russel <[email protected]>2009-03-13 18:20:11 +0000
committerKenneth Russel <[email protected]>2009-03-13 18:20:11 +0000
commit78ff34edd75db5cd7f3055466d992ca7be3a70a6 (patch)
tree9d9de98a76a33a36d33e0d03400d1c3cae7c3e89 /src/native
parentbc22942c74885f804cc38b34fa5493da9596b5b8 (diff)
Worked around problem on Mac OS X where right mouse button down events
were not being received by Newt window git-svn-id: file:///usr/local/projects/SUN/JOGL/git-svn/svn-server-sync/jogl/branches/JOGL_2_SANDBOX@1866 232f8b59-042b-4e1e-8c03-345bb8c30851
Diffstat (limited to 'src/native')
-rw-r--r--src/native/newt/MacWindow.m25
1 files changed, 24 insertions, 1 deletions
diff --git a/src/native/newt/MacWindow.m b/src/native/newt/MacWindow.m
index aa09486bf..701187b2a 100644
--- a/src/native/newt/MacWindow.m
+++ b/src/native/newt/MacWindow.m
@@ -44,6 +44,25 @@
#import <stdio.h>
+// For some reason, rightMouseDown isn't automatically being passed
+// from the NSView to the containing NSWindow
+
+@interface NewtView : NSView
+{
+}
+
+@end
+
+@implementation NewtView
+- (void) rightMouseDown: (NSEvent*) theEvent
+{
+ NSResponder* next = [self nextResponder];
+ if (next != nil) {
+ [next rightMouseDown: theEvent];
+ }
+}
+@end
+
NSString* jstringToNSString(JNIEnv* env, jstring jstr)
{
const jchar* jstrChars = (*env)->GetStringChars(env, jstr, NULL);
@@ -121,7 +140,7 @@ JNIEXPORT jlong JNICALL Java_com_sun_javafx_newt_macosx_MacWindow_createWindow
setFrameTopLeftPoint(window, x, y);
// Allocate an NSView
- NSView* view = [[NSView alloc] initWithFrame: rect];
+ NSView* view = [[NewtView alloc] initWithFrame: rect];
// specify we want mouse-moved events
[window setAcceptsMouseMovedEvents:YES];
@@ -129,6 +148,10 @@ JNIEXPORT jlong JNICALL Java_com_sun_javafx_newt_macosx_MacWindow_createWindow
// Set the content view
[window setContentView: view];
+ // Set the next responder to be the window so that we can forward
+ // right mouse button down events
+ [view setNextResponder: window];
+
[pool release];
return (jlong) ((intptr_t) window);