aboutsummaryrefslogtreecommitdiffstats
path: root/src/nativewindow/classes/jogamp
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2014-05-26 18:54:27 +0200
committerSven Gothel <[email protected]>2014-05-26 18:54:27 +0200
commit56d60b36798fa8dae48bf2aa5e2de6f3178ab0d1 (patch)
tree4c86190128414205d0b768780e3272e32bd1e81a /src/nativewindow/classes/jogamp
parent98ed02cdb7b325d8afde596a5ef04f97be2018d4 (diff)
Bug 741 HiDPI: Refine Monitor/Screen [virtual] Viewport Definition / Add NEWT Support / Fix JAWT getPixelScale deadlock
- NativeWindow/Surface/NEWT API DOC: Define Coordinate System of Window and Screen - OSXUtil: Add getPixelScale(..) via Screen index and 'windowOrView' - JAWTWindow/JAWTUtil.getPixelScale(..): Use pre-fetched AWT GraphicsConfiguration to solve AWT-TreeLock (deadlock) - [Virtual] Viewport of MonitorDevice and Screen: - Properly calculate and expose [virtual] viewport in window and pixel units - OSX Monitor viewports in pixel units are 'reconstructed' - Window/Viewport to Monitor selection shall be perfomed via window units (unique) - OSX NEWT Window create/init (native): Use given size and coordinates even in fullscreen mode Don't override by quering NSScreen coordinates, trust given values. - Fix test cases, i.e. usage of pixel- and window-units
Diffstat (limited to 'src/nativewindow/classes/jogamp')
-rw-r--r--src/nativewindow/classes/jogamp/nativewindow/jawt/JAWTUtil.java20
-rw-r--r--src/nativewindow/classes/jogamp/nativewindow/macosx/OSXUtil.java10
2 files changed, 21 insertions, 9 deletions
diff --git a/src/nativewindow/classes/jogamp/nativewindow/jawt/JAWTUtil.java b/src/nativewindow/classes/jogamp/nativewindow/jawt/JAWTUtil.java
index 387f40f89..92ec27b69 100644
--- a/src/nativewindow/classes/jogamp/nativewindow/jawt/JAWTUtil.java
+++ b/src/nativewindow/classes/jogamp/nativewindow/jawt/JAWTUtil.java
@@ -37,7 +37,6 @@
package jogamp.nativewindow.jawt;
-import java.awt.Component;
import java.awt.EventQueue;
import java.awt.GraphicsConfiguration;
import java.awt.GraphicsDevice;
@@ -560,10 +559,9 @@ public class JAWTUtil {
}
/**
- * Returns the pixel scale factor of the given {@link Component}'s {@link GraphicsDevice}, if supported.
+ * Returns the pixel scale factor of the given {@link GraphicsConfiguration}'s {@link GraphicsDevice}, if supported.
* <p>
- * If the component is not yet {@link Component#isDisplayable() displayable},
- * <code>zero</code> is returned.
+ * If the {@link GraphicsDevice} is <code>null</code>, <code>zero</code> is returned.
* </p>
* <p>
* If the component does not support pixel scaling the default
@@ -572,17 +570,21 @@ public class JAWTUtil {
* <p>
* Note: Currently only supported on OSX since 1.7.0_40 for HiDPI retina displays
* </p>
- * @param component the {@link Component} instance used to query the pixel scale
+ * @param gc the {@link GraphicsConfiguration} instance used to query the pixel scale
* @return the pixel scale factor
*/
- public static final int getPixelScale(final Component component) {
- final GraphicsConfiguration gc = component.getGraphicsConfiguration();
+ public static final int getPixelScale(final GraphicsConfiguration gc) {
final GraphicsDevice device = null != gc ? gc.getDevice() : null;
+ final int ps;
if( null == device ) {
- return 0;
+ ps = 0;
} else {
- return JAWTUtil.getPixelScale(device);
+ ps = JAWTUtil.getPixelScale(device);
}
+ if( DEBUG ) {
+ System.err.println("JAWTWindow.updatePixelScale: Fetched "+ps);
+ }
+ return ps;
}
}
diff --git a/src/nativewindow/classes/jogamp/nativewindow/macosx/OSXUtil.java b/src/nativewindow/classes/jogamp/nativewindow/macosx/OSXUtil.java
index 88ba531d1..31b06d360 100644
--- a/src/nativewindow/classes/jogamp/nativewindow/macosx/OSXUtil.java
+++ b/src/nativewindow/classes/jogamp/nativewindow/macosx/OSXUtil.java
@@ -122,6 +122,14 @@ public class OSXUtil implements ToolkitProperties {
return (Insets) GetInsets0(windowOrView);
}
+ public static double GetPixelScale(int screenIndex) {
+ return GetPixelScale0(screenIndex);
+ }
+
+ public static double GetPixelScale(long windowOrView) {
+ return GetPixelScale1(windowOrView);
+ }
+
public static long CreateNSWindow(int x, int y, int width, int height) {
return CreateNSWindow0(x, y, width, height);
}
@@ -365,6 +373,8 @@ public class OSXUtil implements ToolkitProperties {
private static native boolean isNSWindow0(long object);
private static native Object GetLocationOnScreen0(long windowOrView, int src_x, int src_y);
private static native Object GetInsets0(long windowOrView);
+ private static native double GetPixelScale0(int screenIndex);
+ private static native double GetPixelScale1(long windowOrView);
private static native long CreateNSWindow0(int x, int y, int width, int height);
private static native void DestroyNSWindow0(long nsWindow);
private static native long GetNSView0(long nsWindow);