aboutsummaryrefslogtreecommitdiffstats
path: root/src/newt/classes/jogamp
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2012-10-30 17:39:31 +0100
committerSven Gothel <[email protected]>2012-10-30 17:39:31 +0100
commit6f2f5cc9fca5d36b11744ab4d69c3177b0271f22 (patch)
treecb696e1bbb6f618f403d74cf49199761b3fc00b1 /src/newt/classes/jogamp
parent24d5fa1241e17f596ae93dff1656a9317daf6fb3 (diff)
NEWT/OSX getLocationOnScreenImpl(..): Use real OSXUtil.GetLocationOnScreen(..) if onscreen and surface available.
Diffstat (limited to 'src/newt/classes/jogamp')
-rw-r--r--src/newt/classes/jogamp/newt/driver/macosx/WindowDriver.java18
1 files changed, 12 insertions, 6 deletions
diff --git a/src/newt/classes/jogamp/newt/driver/macosx/WindowDriver.java b/src/newt/classes/jogamp/newt/driver/macosx/WindowDriver.java
index bc83f9540..121c3fa99 100644
--- a/src/newt/classes/jogamp/newt/driver/macosx/WindowDriver.java
+++ b/src/newt/classes/jogamp/newt/driver/macosx/WindowDriver.java
@@ -45,6 +45,7 @@ import javax.media.nativewindow.util.InsetsImmutable;
import javax.media.nativewindow.util.Point;
import javax.media.nativewindow.util.PointImmutable;
+import jogamp.nativewindow.macosx.OSXUtil;
import jogamp.newt.WindowImpl;
import jogamp.newt.driver.DriverClearFocus;
import jogamp.newt.driver.DriverUpdatePosition;
@@ -149,7 +150,7 @@ public class WindowDriver extends WindowImpl implements MutableSurface, DriverCl
public final void clearFocus() {
if(DEBUG_IMPLEMENTATION) {
- System.err.println("MacWindow: clearFocus() - requestFocusParent, isOffscreenInstance "+isOffscreenInstance);
+ System.err.println("MacWindow: clearFocus(), isOffscreenInstance "+isOffscreenInstance);
}
if(!isOffscreenInstance) {
resignFocus0(getWindowHandle());
@@ -236,16 +237,21 @@ public class WindowDriver extends WindowImpl implements MutableSurface, DriverCl
}
protected Point getLocationOnScreenImpl(int x, int y) {
- Point p = new Point(x, y);
+ final NativeWindow parent = getParent();
+ final boolean useParent = null != parent && 0 != parent.getWindowHandle() ;
+
+ if( !useParent && !isOffscreenInstance && 0 != surfaceHandle) {
+ return OSXUtil.GetLocationOnScreen(surfaceHandle, true, x, y);
+ }
+
+ final Point p = new Point(x, y);
// min val is 0
p.setX(Math.max(p.getX(), 0));
p.setY(Math.max(p.getY(), 0));
-
- final NativeWindow parent = getParent();
- if( null != parent && 0 != parent.getWindowHandle() ) {
+ if( useParent ) {
p.translate(parent.getLocationOnScreen(null));
}
- return p;
+ return p;
}
private Point getTopLevelLocationOnScreen(int x, int y) {