summaryrefslogtreecommitdiffstats
path: root/src/nativewindow/classes
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2014-05-26 19:04:41 +0200
committerSven Gothel <[email protected]>2014-05-26 19:04:41 +0200
commit759d90674d977bae24ba58684fad3830f7f0d40f (patch)
tree16c402b0cc667e7d4d7899f9be92756465a372db /src/nativewindow/classes
parent56d60b36798fa8dae48bf2aa5e2de6f3178ab0d1 (diff)
Bug 1012: Fix erroneous handling of multiple monitor coordinates on OSX with NEWT
To properly convert Top-Left (TL) from/to Bottom-Left (BL) coordinates we need to utilize the given CGDisplay viewport (TL) and NSScreen (BL) to perform the y-flip. This is especially true for the case of having multiple monitors covering different viewports (mixed resolution).
Diffstat (limited to 'src/nativewindow/classes')
-rw-r--r--src/nativewindow/classes/javax/media/nativewindow/NativeWindowFactory.java6
-rw-r--r--src/nativewindow/classes/jogamp/nativewindow/macosx/OSXUtil.java24
2 files changed, 8 insertions, 22 deletions
diff --git a/src/nativewindow/classes/javax/media/nativewindow/NativeWindowFactory.java b/src/nativewindow/classes/javax/media/nativewindow/NativeWindowFactory.java
index 1546bd909..5ef32a5aa 100644
--- a/src/nativewindow/classes/javax/media/nativewindow/NativeWindowFactory.java
+++ b/src/nativewindow/classes/javax/media/nativewindow/NativeWindowFactory.java
@@ -686,6 +686,10 @@ public abstract class NativeWindowFactory {
return new WrappedWindow(config, surfaceHandle, hook, true, windowHandle);
}
+ /**
+ * @param nw
+ * @return top-left client-area position in window units
+ */
public static PointImmutable getLocationOnScreen(NativeWindow nw) {
final String nwt = NativeWindowFactory.getNativeWindowType(true);
if( NativeWindowFactory.TYPE_X11 == nwt ) {
@@ -693,7 +697,7 @@ public abstract class NativeWindowFactory {
} else if( NativeWindowFactory.TYPE_WINDOWS == nwt ) {
return GDIUtil.GetRelativeLocation(nw.getWindowHandle(), 0, 0, 0);
} else if( NativeWindowFactory.TYPE_MACOSX == nwt ) {
- return OSXUtil.GetLocationOnScreen(nw.getWindowHandle(), null == nw.getParent(), 0, 0);
+ return OSXUtil.GetLocationOnScreen(nw.getWindowHandle(), 0, 0);
/**
* FIXME: Needs service provider interface (SPI) for TK dependent implementation
} else if( NativeWindowFactory.TYPE_BCM_VC_IV == nwt ) {
diff --git a/src/nativewindow/classes/jogamp/nativewindow/macosx/OSXUtil.java b/src/nativewindow/classes/jogamp/nativewindow/macosx/OSXUtil.java
index 31b06d360..12e574ced 100644
--- a/src/nativewindow/classes/jogamp/nativewindow/macosx/OSXUtil.java
+++ b/src/nativewindow/classes/jogamp/nativewindow/macosx/OSXUtil.java
@@ -91,31 +91,13 @@ public class OSXUtil implements ToolkitProperties {
}
/**
- * In case the <code>windowOrView</code> is top-level,
- * you shall set <code>topLevel</code> to true where
- * insets gets into account to compute the client position as follows:
- * <pre>
- if(topLevel) {
- // top-level position -> client window position
- final Insets insets = GetInsets(windowOrView);
- los.setX(los.getX() + insets.getLeftWidth());
- los.setY(los.getY() + insets.getTopHeight());
- }
- * </pre>
* @param windowOrView
- * @param topLevel
* @param src_x
* @param src_y
- * @return the client position
+ * @return top-left client-area position in window units
*/
- public static Point GetLocationOnScreen(long windowOrView, boolean topLevel, int src_x, int src_y) {
- final Point los = (Point) GetLocationOnScreen0(windowOrView, src_x, src_y);
- if(topLevel) {
- // top-level position -> client window position
- final Insets insets = GetInsets(windowOrView);
- los.set(los.getX() + insets.getLeftWidth(), los.getY() + insets.getTopHeight());
- }
- return los;
+ public static Point GetLocationOnScreen(long windowOrView, int src_x, int src_y) {
+ return (Point) GetLocationOnScreen0(windowOrView, src_x, src_y);
}
public static Insets GetInsets(long windowOrView) {