diff options
author | Kenneth Russel <[email protected]> | 2009-01-15 00:29:03 +0000 |
---|---|---|
committer | Kenneth Russel <[email protected]> | 2009-01-15 00:29:03 +0000 |
commit | 0f97f9fba0ea234be4be96a9ee7da2f8cc30879c (patch) | |
tree | 3992597a4f37c8ab871e26183b709af47f8700a7 /src | |
parent | 4e85594b41e6292bf4132e8aff5d65090c312d46 (diff) |
Changed how MacWindow computes the coordinates for mouse events sent
up to Java to improve the behavior where drag events are used to drag
the window around; behavior is better but still not perfect
git-svn-id: file:///usr/local/projects/SUN/JOGL/git-svn/svn-server-sync/jogl/branches/JOGL_2_SANDBOX@1847 232f8b59-042b-4e1e-8c03-345bb8c30851
Diffstat (limited to 'src')
-rw-r--r-- | src/native/newt/NewtMacWindow.m | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/native/newt/NewtMacWindow.m b/src/native/newt/NewtMacWindow.m index 7c3e4745b..5809c16b0 100644 --- a/src/native/newt/NewtMacWindow.m +++ b/src/native/newt/NewtMacWindow.m @@ -145,9 +145,15 @@ static jint mods2JavaMods(NSUInteger mods) - (void) sendMouseEvent: (NSEvent*) event eventType: (jint) evType { jint javaMods = mods2JavaMods([event modifierFlags]); - NSPoint location = [event locationInWindow]; NSRect frameRect = [self frame]; NSRect contentRect = [self contentRectForFrameRect: frameRect]; + // NSPoint location = [event locationInWindow]; + // The following computation improves the behavior of mouse drag + // events when they also affect the location of the window, but it + // still isn't perfect + NSPoint curLocation = [NSEvent mouseLocation]; + NSPoint location = NSMakePoint(curLocation.x - frameRect.origin.x, + curLocation.y - frameRect.origin.y); if (env == NULL) { return; |