diff options
author | Kenneth Russel <[email protected]> | 2009-03-13 18:20:11 +0000 |
---|---|---|
committer | Kenneth Russel <[email protected]> | 2009-03-13 18:20:11 +0000 |
commit | 78ff34edd75db5cd7f3055466d992ca7be3a70a6 (patch) | |
tree | 9d9de98a76a33a36d33e0d03400d1c3cae7c3e89 | |
parent | bc22942c74885f804cc38b34fa5493da9596b5b8 (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
-rw-r--r-- | src/native/newt/MacWindow.m | 25 |
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); |