summaryrefslogtreecommitdiffstats
path: root/src/newt
diff options
context:
space:
mode:
Diffstat (limited to 'src/newt')
-rw-r--r--src/newt/classes/com/jogamp/newt/Display.java14
-rw-r--r--src/newt/classes/com/jogamp/newt/MonitorDevice.java56
-rw-r--r--src/newt/classes/com/jogamp/newt/MonitorMode.java6
-rw-r--r--src/newt/classes/com/jogamp/newt/NewtFactory.java14
-rw-r--r--src/newt/classes/com/jogamp/newt/NewtVersion.java2
-rw-r--r--src/newt/classes/com/jogamp/newt/Screen.java10
-rw-r--r--src/newt/classes/com/jogamp/newt/Window.java39
-rw-r--r--src/newt/classes/com/jogamp/newt/awt/NewtCanvasAWT.java71
-rw-r--r--src/newt/classes/com/jogamp/newt/awt/applet/JOGLNewtApplet1Run.java10
-rw-r--r--src/newt/classes/com/jogamp/newt/event/PinchToZoomGesture.java2
-rw-r--r--src/newt/classes/com/jogamp/newt/event/WindowListener.java2
-rw-r--r--src/newt/classes/com/jogamp/newt/event/WindowUpdateEvent.java2
-rw-r--r--src/newt/classes/com/jogamp/newt/event/awt/AWTAdapter.java10
-rw-r--r--src/newt/classes/com/jogamp/newt/event/awt/AWTKeyAdapter.java2
-rw-r--r--src/newt/classes/com/jogamp/newt/event/awt/AWTMouseAdapter.java2
-rw-r--r--src/newt/classes/com/jogamp/newt/event/awt/AWTWindowAdapter.java2
-rw-r--r--src/newt/classes/com/jogamp/newt/opengl/GLWindow.java73
-rw-r--r--src/newt/classes/com/jogamp/newt/swt/NewtCanvasSWT.java32
-rw-r--r--src/newt/classes/com/jogamp/newt/util/MainThread.java2
-rw-r--r--src/newt/classes/com/jogamp/newt/util/MonitorModeUtil.java4
-rw-r--r--src/newt/classes/com/jogamp/newt/util/applet/JOGLNewtApplet3Run.java18
-rw-r--r--src/newt/classes/com/jogamp/newt/util/applet/JOGLNewtAppletBase.java20
-rw-r--r--src/newt/classes/com/jogamp/newt/util/applet/VersionApplet3.java14
-rw-r--r--src/newt/classes/jogamp/newt/DefaultEDTUtil.java13
-rw-r--r--src/newt/classes/jogamp/newt/DisplayImpl.java29
-rw-r--r--src/newt/classes/jogamp/newt/MonitorDeviceImpl.java22
-rw-r--r--src/newt/classes/jogamp/newt/MonitorModeProps.java40
-rw-r--r--src/newt/classes/jogamp/newt/OffscreenWindow.java18
-rw-r--r--src/newt/classes/jogamp/newt/PointerIconImpl.java10
-rw-r--r--src/newt/classes/jogamp/newt/ScreenImpl.java26
-rw-r--r--src/newt/classes/jogamp/newt/WindowImpl.java139
-rw-r--r--src/newt/classes/jogamp/newt/awt/NewtFactoryAWT.java14
-rw-r--r--src/newt/classes/jogamp/newt/awt/event/AWTNewtEventFactory.java4
-rw-r--r--src/newt/classes/jogamp/newt/awt/event/AWTParentWindowAdapter.java2
-rw-r--r--src/newt/classes/jogamp/newt/driver/android/DisplayDriver.java4
-rw-r--r--src/newt/classes/jogamp/newt/driver/android/NewtBaseActivity.java8
-rw-r--r--src/newt/classes/jogamp/newt/driver/android/NewtVersionActivity.java10
-rw-r--r--src/newt/classes/jogamp/newt/driver/android/NewtVersionActivityLauncher.java2
-rw-r--r--src/newt/classes/jogamp/newt/driver/android/ScreenDriver.java4
-rw-r--r--src/newt/classes/jogamp/newt/driver/android/WindowDriver.java39
-rw-r--r--src/newt/classes/jogamp/newt/driver/awt/AWTCanvas.java24
-rw-r--r--src/newt/classes/jogamp/newt/driver/awt/AWTEDTUtil.java7
-rw-r--r--src/newt/classes/jogamp/newt/driver/awt/DisplayDriver.java2
-rw-r--r--src/newt/classes/jogamp/newt/driver/awt/ScreenDriver.java2
-rw-r--r--src/newt/classes/jogamp/newt/driver/awt/WindowDriver.java14
-rw-r--r--src/newt/classes/jogamp/newt/driver/bcm/egl/DisplayDriver.java6
-rw-r--r--src/newt/classes/jogamp/newt/driver/bcm/egl/ScreenDriver.java6
-rw-r--r--src/newt/classes/jogamp/newt/driver/bcm/egl/WindowDriver.java14
-rw-r--r--src/newt/classes/jogamp/newt/driver/bcm/vc/iv/DisplayDriver.java8
-rw-r--r--src/newt/classes/jogamp/newt/driver/bcm/vc/iv/ScreenDriver.java6
-rw-r--r--src/newt/classes/jogamp/newt/driver/bcm/vc/iv/WindowDriver.java18
-rw-r--r--src/newt/classes/jogamp/newt/driver/intel/gdl/DisplayDriver.java2
-rw-r--r--src/newt/classes/jogamp/newt/driver/intel/gdl/ScreenDriver.java8
-rw-r--r--src/newt/classes/jogamp/newt/driver/intel/gdl/WindowDriver.java6
-rw-r--r--src/newt/classes/jogamp/newt/driver/kd/DisplayDriver.java7
-rw-r--r--src/newt/classes/jogamp/newt/driver/kd/ScreenDriver.java6
-rw-r--r--src/newt/classes/jogamp/newt/driver/kd/WindowDriver.java16
-rw-r--r--src/newt/classes/jogamp/newt/driver/macosx/DisplayDriver.java6
-rw-r--r--src/newt/classes/jogamp/newt/driver/macosx/ScreenDriver.java24
-rw-r--r--src/newt/classes/jogamp/newt/driver/macosx/WindowDriver.java137
-rw-r--r--src/newt/classes/jogamp/newt/driver/opengl/JoglUtilPNGIcon.java2
-rw-r--r--src/newt/classes/jogamp/newt/driver/windows/DisplayDriver.java6
-rw-r--r--src/newt/classes/jogamp/newt/driver/windows/ScreenDriver.java8
-rw-r--r--src/newt/classes/jogamp/newt/driver/windows/WindowDriver.java14
-rw-r--r--src/newt/classes/jogamp/newt/driver/x11/DisplayDriver.java6
-rw-r--r--src/newt/classes/jogamp/newt/driver/x11/RandR.java2
-rw-r--r--src/newt/classes/jogamp/newt/driver/x11/RandR11.java2
-rw-r--r--src/newt/classes/jogamp/newt/driver/x11/RandR13.java2
-rw-r--r--src/newt/classes/jogamp/newt/driver/x11/ScreenDriver.java10
-rw-r--r--src/newt/classes/jogamp/newt/driver/x11/WindowDriver.java13
-rw-r--r--src/newt/classes/jogamp/newt/swt/SWTEDTUtil.java9
-rw-r--r--src/newt/classes/jogamp/newt/swt/event/SWTNewtEventFactory.java4
-rw-r--r--src/newt/native/MacWindow.m6
-rw-r--r--src/newt/native/NewtMacWindow.m22
74 files changed, 699 insertions, 517 deletions
diff --git a/src/newt/classes/com/jogamp/newt/Display.java b/src/newt/classes/com/jogamp/newt/Display.java
index c4b919951..d683eb9f2 100644
--- a/src/newt/classes/com/jogamp/newt/Display.java
+++ b/src/newt/classes/com/jogamp/newt/Display.java
@@ -34,11 +34,11 @@ import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
-import javax.media.nativewindow.AbstractGraphicsDevice;
-import javax.media.nativewindow.NativeWindowException;
-import javax.media.nativewindow.util.PixelRectangle;
-import javax.media.nativewindow.util.PixelFormat;
-import javax.media.nativewindow.util.PointImmutable;
+import com.jogamp.nativewindow.AbstractGraphicsDevice;
+import com.jogamp.nativewindow.NativeWindowException;
+import com.jogamp.nativewindow.util.PixelRectangle;
+import com.jogamp.nativewindow.util.PixelFormat;
+import com.jogamp.nativewindow.util.PointImmutable;
import jogamp.newt.Debug;
@@ -235,7 +235,7 @@ public abstract class Display {
/**
* Manual trigger the native creation, if it is not done yet.<br>
- * This is useful to be able to request the {@link javax.media.nativewindow.AbstractGraphicsDevice}, via
+ * This is useful to be able to request the {@link com.jogamp.nativewindow.AbstractGraphicsDevice}, via
* {@link #getGraphicsDevice()}.<br>
* Otherwise the abstract device won't be available before the dependent components (Screen and Window) are realized.
* <p>
@@ -324,7 +324,7 @@ public abstract class Display {
public abstract String getName();
/**
- * @return the native display type, ie {@link javax.media.nativewindow.NativeWindowFactory#getNativeWindowType(boolean)}
+ * @return the native display type, ie {@link com.jogamp.nativewindow.NativeWindowFactory#getNativeWindowType(boolean)}
*/
public abstract String getType();
diff --git a/src/newt/classes/com/jogamp/newt/MonitorDevice.java b/src/newt/classes/com/jogamp/newt/MonitorDevice.java
index 126162006..4d9c6493a 100644
--- a/src/newt/classes/com/jogamp/newt/MonitorDevice.java
+++ b/src/newt/classes/com/jogamp/newt/MonitorDevice.java
@@ -30,10 +30,11 @@ package com.jogamp.newt;
import java.util.List;
-import javax.media.nativewindow.util.DimensionImmutable;
-import javax.media.nativewindow.util.Rectangle;
-import javax.media.nativewindow.util.RectangleImmutable;
-import javax.media.nativewindow.util.SurfaceSize;
+import com.jogamp.nativewindow.ScalableSurface;
+import com.jogamp.nativewindow.util.DimensionImmutable;
+import com.jogamp.nativewindow.util.Rectangle;
+import com.jogamp.nativewindow.util.RectangleImmutable;
+import com.jogamp.nativewindow.util.SurfaceSize;
import com.jogamp.common.util.ArrayHashSet;
@@ -51,6 +52,7 @@ import com.jogamp.common.util.ArrayHashSet;
* <ul>
* <li>{@link MonitorMode} current mode</li>
* <li>{@link RectangleImmutable} viewport (rotated)</li>
+ * <li>pixel-scale (rotated)</li>
* </ul></li>
* </ul>
* <p>
@@ -65,16 +67,31 @@ public abstract class MonitorDevice {
protected final ArrayHashSet<MonitorMode> supportedModes; // FIXME: May need to support mutable mode, i.e. adding modes on the fly!
protected MonitorMode currentMode;
protected boolean modeChanged;
- protected Rectangle viewportPU; // in pixel units
- protected Rectangle viewportWU; // in window units
+ protected final float[] pixelScale;
+ protected final Rectangle viewportPU; // in pixel units
+ protected final Rectangle viewportWU; // in window units
- protected MonitorDevice(final Screen screen, final int nativeId, final DimensionImmutable sizeMM, final Rectangle viewportPU, final Rectangle viewportWU, final MonitorMode currentMode, final ArrayHashSet<MonitorMode> supportedModes) {
+ /**
+ * @param screen associated {@link Screen}
+ * @param nativeId unique monitor device ID
+ * @param sizeMM size in millimeters
+ * @param currentMode
+ * @param pixelScale pre-fetched current pixel-scale, maybe {@code null} for {@link ScalableSurface#IDENTITY_PIXELSCALE}.
+ * @param viewportPU viewport in pixel-units
+ * @param viewportWU viewport in window-units
+ * @param supportedModes all supported {@link MonitorMode}s
+ */
+ protected MonitorDevice(final Screen screen, final int nativeId, final DimensionImmutable sizeMM,
+ final MonitorMode currentMode,
+ final float[] pixelScale, final Rectangle viewportPU, final Rectangle viewportWU,
+ final ArrayHashSet<MonitorMode> supportedModes) {
this.screen = screen;
this.nativeId = nativeId;
this.sizeMM = sizeMM;
this.originalMode = currentMode;
this.supportedModes = supportedModes;
this.currentMode = currentMode;
+ this.pixelScale = null != pixelScale ? pixelScale : new float[] { 1.0f, 1.0f };
this.viewportPU = viewportPU;
this.viewportWU = viewportWU;
this.modeChanged = false;
@@ -180,26 +197,40 @@ public abstract class MonitorDevice {
}
/**
- * Returns the {@link RectangleImmutable rectangular} portion
+ * Returns the current {@link RectangleImmutable rectangular} portion
* of the <b>rotated</b> virtual {@link Screen} size in pixel units
* represented by this monitor, i.e. top-left origin and size.
- * @see Screen
+ * @see #getPixelScale()
+ * @see Screen#getViewport()
*/
public final RectangleImmutable getViewport() {
return viewportPU;
}
/**
- * Returns the {@link RectangleImmutable rectangular} portion
+ * Returns the current {@link RectangleImmutable rectangular} portion
* of the <b>rotated</b> virtual {@link Screen} size in window units
* represented by this monitor, i.e. top-left origin and size.
- * @see Screen
+ * @see #getPixelScale()
+ * @see Screen#getViewportInWindowUnits()
*/
public final RectangleImmutable getViewportInWindowUnits() {
return viewportWU;
}
/**
+ * Returns the current <b>rotated</b> pixel-scale
+ * of this monitor, i.e. horizontal and vertical.
+ * @see #getViewportInWindowUnits()
+ * @see #getViewport()
+ * @see ScalableSurface#getMaximumSurfaceScale(float[])
+ */
+ public float[] getPixelScale(final float[] result) {
+ System.arraycopy(pixelScale, 0, result, 0, 2);
+ return result;
+ }
+
+ /**
* Returns <code>true</code> if given screen coordinates in pixel units
* are contained by this {@link #getViewport() viewport}, otherwise <code>false</code>.
* @param x x-coord in pixel units
@@ -292,7 +323,8 @@ public abstract class MonitorDevice {
@Override
public String toString() {
- return "Monitor[Id "+Display.toHexString(nativeId)+", "+sizeMM+" mm, viewport "+viewportPU+ " [pixels], "+viewportWU+" [window], orig "+originalMode+", curr "+currentMode+
+ return "Monitor[Id "+Display.toHexString(nativeId)+", "+sizeMM+" mm, pixelScale ["+pixelScale[0]+", "+pixelScale[1]+
+ "], viewport "+viewportPU+ " [pixels], "+viewportWU+" [window], orig "+originalMode+", curr "+currentMode+
", modeChanged "+modeChanged+", modeCount "+supportedModes.size()+"]";
}
}
diff --git a/src/newt/classes/com/jogamp/newt/MonitorMode.java b/src/newt/classes/com/jogamp/newt/MonitorMode.java
index 09bc06ebd..cd5600b48 100644
--- a/src/newt/classes/com/jogamp/newt/MonitorMode.java
+++ b/src/newt/classes/com/jogamp/newt/MonitorMode.java
@@ -30,9 +30,9 @@ package com.jogamp.newt;
import java.util.Comparator;
-import javax.media.nativewindow.util.DimensionImmutable;
-import javax.media.nativewindow.util.RectangleImmutable;
-import javax.media.nativewindow.util.SurfaceSize;
+import com.jogamp.nativewindow.util.DimensionImmutable;
+import com.jogamp.nativewindow.util.RectangleImmutable;
+import com.jogamp.nativewindow.util.SurfaceSize;
import com.jogamp.newt.util.MonitorModeUtil;
diff --git a/src/newt/classes/com/jogamp/newt/NewtFactory.java b/src/newt/classes/com/jogamp/newt/NewtFactory.java
index 9606fae08..2ed2194d8 100644
--- a/src/newt/classes/com/jogamp/newt/NewtFactory.java
+++ b/src/newt/classes/com/jogamp/newt/NewtFactory.java
@@ -38,12 +38,12 @@ import java.security.AccessController;
import java.security.PrivilegedAction;
import java.util.Arrays;
-import javax.media.nativewindow.AbstractGraphicsConfiguration;
-import javax.media.nativewindow.AbstractGraphicsDevice;
-import javax.media.nativewindow.AbstractGraphicsScreen;
-import javax.media.nativewindow.CapabilitiesImmutable;
-import javax.media.nativewindow.NativeWindow;
-import javax.media.nativewindow.NativeWindowFactory;
+import com.jogamp.nativewindow.AbstractGraphicsConfiguration;
+import com.jogamp.nativewindow.AbstractGraphicsDevice;
+import com.jogamp.nativewindow.AbstractGraphicsScreen;
+import com.jogamp.nativewindow.CapabilitiesImmutable;
+import com.jogamp.nativewindow.NativeWindow;
+import com.jogamp.nativewindow.NativeWindowFactory;
import com.jogamp.common.util.IOUtil;
import com.jogamp.common.util.PropertyAccess;
@@ -260,7 +260,7 @@ public class NewtFactory {
* you have to add an appropriate {@link com.jogamp.newt.event.WindowListener} for this use case.<br>
* The parents visibility is passed to the new Window<br></p>
* <p>
- * In case <code>parentWindowObject</code> is a different {@link javax.media.nativewindow.NativeWindow} implementation,<br>
+ * In case <code>parentWindowObject</code> is a different {@link com.jogamp.nativewindow.NativeWindow} implementation,<br>
* you have to handle all events appropriate.<br></p>
* <p>
* <p>
diff --git a/src/newt/classes/com/jogamp/newt/NewtVersion.java b/src/newt/classes/com/jogamp/newt/NewtVersion.java
index f4cdee487..f4ecdd17f 100644
--- a/src/newt/classes/com/jogamp/newt/NewtVersion.java
+++ b/src/newt/classes/com/jogamp/newt/NewtVersion.java
@@ -47,7 +47,7 @@ public class NewtVersion extends JogampVersion {
synchronized(NewtVersion.class) {
if( null == jogampCommonVersionInfo ) {
final String packageName1 = "com.jogamp.newt"; // atomic packaging - and identity
- final String packageName2 = "javax.media.opengl"; // all packaging
+ final String packageName2 = "com.jogamp.opengl"; // all packaging
final Manifest mf = VersionUtil.getManifest(NativeWindowVersion.class.getClassLoader(), new String[]{ packageName1, packageName2 } );
jogampCommonVersionInfo = new NewtVersion(packageName1, mf);
}
diff --git a/src/newt/classes/com/jogamp/newt/Screen.java b/src/newt/classes/com/jogamp/newt/Screen.java
index 0ba557972..65031a565 100644
--- a/src/newt/classes/com/jogamp/newt/Screen.java
+++ b/src/newt/classes/com/jogamp/newt/Screen.java
@@ -36,10 +36,10 @@ import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
-import javax.media.nativewindow.AbstractGraphicsScreen;
-import javax.media.nativewindow.NativeWindowException;
-import javax.media.nativewindow.util.Rectangle;
-import javax.media.nativewindow.util.RectangleImmutable;
+import com.jogamp.nativewindow.AbstractGraphicsScreen;
+import com.jogamp.nativewindow.NativeWindowException;
+import com.jogamp.nativewindow.util.Rectangle;
+import com.jogamp.nativewindow.util.RectangleImmutable;
/**
* A screen may span multiple {@link MonitorDevice}s representing their combined virtual size.
@@ -82,7 +82,7 @@ public abstract class Screen {
/**
* Manual trigger the native creation, if not done yet..<br>
- * This is useful to be able to request the {@link javax.media.nativewindow.AbstractGraphicsScreen}, via
+ * This is useful to be able to request the {@link com.jogamp.nativewindow.AbstractGraphicsScreen}, via
* {@link #getGraphicsScreen()}.<br>
* Otherwise the abstract device won't be available before the dependent component (Window) is realized.
* <p>
diff --git a/src/newt/classes/com/jogamp/newt/Window.java b/src/newt/classes/com/jogamp/newt/Window.java
index ec6d767fa..2afa464d6 100644
--- a/src/newt/classes/com/jogamp/newt/Window.java
+++ b/src/newt/classes/com/jogamp/newt/Window.java
@@ -42,14 +42,14 @@ import com.jogamp.newt.event.MouseListener;
import jogamp.newt.Debug;
import jogamp.newt.WindowImpl;
-import javax.media.nativewindow.CapabilitiesChooser;
-import javax.media.nativewindow.CapabilitiesImmutable;
-import javax.media.nativewindow.NativeWindow;
-import javax.media.nativewindow.ScalableSurface;
-import javax.media.nativewindow.WindowClosingProtocol;
-import javax.media.nativewindow.util.Rectangle;
-import javax.media.nativewindow.util.RectangleImmutable;
-import javax.media.nativewindow.util.SurfaceSize;
+import com.jogamp.nativewindow.CapabilitiesChooser;
+import com.jogamp.nativewindow.CapabilitiesImmutable;
+import com.jogamp.nativewindow.NativeWindow;
+import com.jogamp.nativewindow.ScalableSurface;
+import com.jogamp.nativewindow.WindowClosingProtocol;
+import com.jogamp.nativewindow.util.Rectangle;
+import com.jogamp.nativewindow.util.RectangleImmutable;
+import com.jogamp.nativewindow.util.SurfaceSize;
/**
* Specifying NEWT's Window functionality:
@@ -95,6 +95,17 @@ import javax.media.nativewindow.util.SurfaceSize;
* System.setProperty("newt.window.icons", "newt/data/jogamp-16x16.png newt/data/jogamp-32x32.png");
* </pre>
* </p>
+ *
+ * <a name="lifecycleHeavy"><h5>Use of Lifecycle Heavy functions</h5></a>
+ * <p>
+ * Some of the methods specified here are lifecycle-heavy. That is, they are able
+ * to destroy and/or reattach resources to/from the window. Because of this, the methods
+ * are <i>not safe</i> to be called from EDT related threads. For example, it is not
+ * safe for a method in an attached {@link KeyListener} to call {@link #setFullscreen(boolean)}
+ * on a {@link Window} directly. It is safe, however, for that method to spawn a background
+ * worker thread which calls the method directly. The documentation for individual methods
+ * indicates whether or not they are lifecycle-heavy.
+ * </p>
*/
public interface Window extends NativeWindow, WindowClosingProtocol, ScalableSurface {
public static final boolean DEBUG_MOUSE_EVENT = Debug.debug("Window.MouseEvent");
@@ -174,6 +185,7 @@ public interface Window extends NativeWindow, WindowClosingProtocol, ScalableSur
* <p>
* The Window can be recreate via {@link #setVisible(boolean) setVisible(true)}.
* </p>
+ * <p>This method is <a href="#lifecycleHeavy">lifecycle heavy</a>.</p>
* @see #destroy()
* @see #setVisible(boolean)
*/
@@ -193,6 +205,7 @@ public interface Window extends NativeWindow, WindowClosingProtocol, ScalableSur
/**
* Calls {@link #setVisible(boolean, boolean) setVisible(true, visible)},
* i.e. blocks until the window becomes visible.
+ * <p>This method is <a href="#lifecycleHeavy">lifecycle heavy</a>.</p>
* @see #setVisible(boolean, boolean)
*/
void setVisible(boolean visible);
@@ -221,11 +234,12 @@ public interface Window extends NativeWindow, WindowClosingProtocol, ScalableSur
* }
* </pre></p>
* <p>
- * In case this window is a child window and has a {@link javax.media.nativewindow.NativeWindow} parent,<br>
+ * In case this window is a child window and has a {@link com.jogamp.nativewindow.NativeWindow} parent,<br>
* <code>setVisible(wait, true)</code> has no effect as long the parent's is not valid yet,
- * i.e. {@link javax.media.nativewindow.NativeWindow#getWindowHandle()} returns <code>null</code>.<br>
+ * i.e. {@link com.jogamp.nativewindow.NativeWindow#getWindowHandle()} returns <code>null</code>.<br>
* <code>setVisible(wait, true)</code> shall be repeated when the parent becomes valid.
* </p>
+ * <p>This method is <a href="#lifecycleHeavy">lifecycle heavy</a>.</p>
*/
void setVisible(boolean wait, boolean visible);
@@ -259,7 +273,7 @@ public interface Window extends NativeWindow, WindowClosingProtocol, ScalableSur
* according to the {@link #getMainMonitor() main monitor}'s <i>current</i> {@link MonitorMode mode}'s
* {@link SurfaceSize#getResolution() surface resolution}.
* <p>
- * Method takes the {@link #getCurrentSurfaceScale(int[]) current surface-scale} and {@link #getNativeSurfaceScale(int[]) native surface-scale}
+ * Method takes the {@link #getCurrentSurfaceScale(float[]) current surface-scale} and {@link #getMaximumSurfaceScale(float[]) native surface-scale}
* into account, i.e.:
* <pre>
* surfacePpMM = monitorPpMM * currentSurfaceScale / nativeSurfaceScale,
@@ -470,6 +484,7 @@ public interface Window extends NativeWindow, WindowClosingProtocol, ScalableSur
* this window is removed from it's list of children.<br>
* In case the new parent is not null and a Window,
* this window is added to it's list of children.<br></P>
+ * <p>This method is <a href="#lifecycleHeavy">lifecycle heavy</a>.</p>
*
* @param newParent The new parent NativeWindow. If null, this Window becomes a top level window.
* @param x new top-level position in window units, use -1 for default position.
@@ -485,6 +500,7 @@ public interface Window extends NativeWindow, WindowClosingProtocol, ScalableSur
* <p>
* Fullscreen mode is established on the {@link #getMainMonitor() main monitor}.
* </p>
+ * <p>This method is <a href="#lifecycleHeavy">lifecycle heavy</a>.</p>
* @param fullscreen enable or disable fullscreen mode
* @return success
* @see #setFullscreen(List)
@@ -498,6 +514,7 @@ public interface Window extends NativeWindow, WindowClosingProtocol, ScalableSur
* <p>
* Disable fullscreen via {@link #setFullscreen(boolean)}.
* </p>
+ * <p>This method is <a href="#lifecycleHeavy">lifecycle heavy</a>.</p>
* @param monitors if <code>null</code> fullscreen will be spanned across all {@link MonitorDevice}s,
* otherwise across the given list of {@link MonitorDevice}.
* @return success
diff --git a/src/newt/classes/com/jogamp/newt/awt/NewtCanvasAWT.java b/src/newt/classes/com/jogamp/newt/awt/NewtCanvasAWT.java
index c470f6840..5920d6de8 100644
--- a/src/newt/classes/com/jogamp/newt/awt/NewtCanvasAWT.java
+++ b/src/newt/classes/com/jogamp/newt/awt/NewtCanvasAWT.java
@@ -47,17 +47,17 @@ import java.security.AccessController;
import java.security.PrivilegedAction;
import java.util.Set;
-import javax.media.nativewindow.NativeWindow;
-import javax.media.nativewindow.OffscreenLayerOption;
-import javax.media.nativewindow.WindowClosingProtocol;
-import javax.media.opengl.GLAnimatorControl;
-import javax.media.opengl.GLAutoDrawable;
-import javax.media.opengl.GLCapabilities;
-import javax.media.opengl.GLCapabilitiesImmutable;
-import javax.media.opengl.GLDrawable;
-import javax.media.opengl.GLDrawableFactory;
-import javax.media.opengl.GLException;
-import javax.media.opengl.GLOffscreenAutoDrawable;
+import com.jogamp.nativewindow.NativeWindow;
+import com.jogamp.nativewindow.OffscreenLayerOption;
+import com.jogamp.nativewindow.WindowClosingProtocol;
+import com.jogamp.opengl.GLAnimatorControl;
+import com.jogamp.opengl.GLAutoDrawable;
+import com.jogamp.opengl.GLCapabilities;
+import com.jogamp.opengl.GLCapabilitiesImmutable;
+import com.jogamp.opengl.GLDrawable;
+import com.jogamp.opengl.GLDrawableFactory;
+import com.jogamp.opengl.GLException;
+import com.jogamp.opengl.GLOffscreenAutoDrawable;
import javax.swing.MenuSelectionManager;
import jogamp.nativewindow.awt.AWTMisc;
@@ -69,6 +69,7 @@ import jogamp.newt.awt.event.AWTParentWindowAdapter;
import jogamp.newt.driver.DriverClearFocus;
import jogamp.opengl.awt.AWTTilePainter;
+import com.jogamp.common.ExceptionUtils;
import com.jogamp.common.util.awt.AWTEDTExecutor;
import com.jogamp.nativewindow.awt.AWTPrintLifecycle;
import com.jogamp.nativewindow.awt.AWTWindowClosingProtocol;
@@ -469,10 +470,17 @@ public class NewtCanvasAWT extends java.awt.Canvas implements WindowClosingProto
determineIfApplet();
if(DEBUG) {
System.err.println("NewtCanvasAWT.addNotify.0 - isApplet "+isApplet+", addedOnAWTEDT "+EventQueue.isDispatchThread()+" @ "+currentThreadName());
- Thread.dumpStack();
+ ExceptionUtils.dumpStack(System.err);
}
jawtWindow = NewtFactoryAWT.getNativeWindow(NewtCanvasAWT.this, null != newtChild ? newtChild.getRequestedCapabilities() : null);
jawtWindow.setShallUseOffscreenLayer(shallUseOffscreenLayer);
+ // enforce initial lock on AWT-EDT, allowing acquisition of pixel-scale
+ jawtWindow.lockSurface();
+ try {
+ // attachNewtChild sets surface scale!
+ } finally {
+ jawtWindow.unlockSurface();
+ }
awtWindowClosingProtocol.addClosingListener();
componentAdded = true; // Bug 910
if(DEBUG) {
@@ -485,6 +493,25 @@ public class NewtCanvasAWT extends java.awt.Canvas implements WindowClosingProto
}
}
}
+ private final boolean updatePixelScale() {
+ if( jawtWindow.updatePixelScale(true) ) {
+ final Window cWin = newtChild;
+ final Window dWin = cWin.getDelegatedWindow();
+ if( dWin instanceof WindowImpl ) {
+ final float[] maxPixelScale = jawtWindow.getMaximumSurfaceScale(new float[2]);
+ final float[] minPixelScale = jawtWindow.getMinimumSurfaceScale(new float[2]);
+ ((WindowImpl)dWin).pixelScaleChangeNotify(minPixelScale, maxPixelScale, true);
+ // ((WindowImpl)dWin).sizeChangedNotify(true /* defer */, getWidth(), getHeight(), true /* force */);
+ } else {
+ final float[] reqPixelScale = jawtWindow.getRequestedSurfaceScale(new float[2]);
+ if( jawtWindow.setSurfaceScale(reqPixelScale) ) {
+ // jawtWindow.getRequestedSurfaceScale(reqPixelScale);
+ }
+ }
+ return true;
+ }
+ return false;
+ }
@Override
public void removeNotify() {
@@ -493,7 +520,7 @@ public class NewtCanvasAWT extends java.awt.Canvas implements WindowClosingProto
} else {
if(DEBUG) {
System.err.println("NewtCanvasAWT.removeNotify.0 - isApplet "+isApplet+" @ "+currentThreadName());
- Thread.dumpStack();
+ ExceptionUtils.dumpStack(System.err);
}
componentAdded = false; // Bug 910
awtWindowClosingProtocol.removeClosingListener();
@@ -518,7 +545,7 @@ public class NewtCanvasAWT extends java.awt.Canvas implements WindowClosingProto
public final void destroy() {
if(DEBUG) {
System.err.println("NewtCanvasAWT.destroy() @ "+currentThreadName());
- Thread.dumpStack();
+ ExceptionUtils.dumpStack(System.err);
}
AWTEDTExecutor.singleton.invoke(true, new Runnable() {
@Override
@@ -587,7 +614,11 @@ public class NewtCanvasAWT extends java.awt.Canvas implements WindowClosingProto
System.err.println("NewtCanvasAWT.reshape: "+x+"/"+y+" "+width+"x"+height);
}
if( validateComponent(true) ) {
- // newtChild.setSize(width, height);
+ if( !printActive && updatePixelScale() ) {
+ // NOP
+ } else {
+ // newtChild.setSize(width, height);
+ }
}
}
}
@@ -876,18 +907,12 @@ public class NewtCanvasAWT extends java.awt.Canvas implements WindowClosingProto
}
final int w = getWidth();
final int h = getHeight();
- final boolean isNValid = newtChild.isNativeValid();
if(DEBUG) {
- System.err.println("NewtCanvasAWT.attachNewtChild.2: size "+w+"x"+h+", isNValid "+isNValid);
+ System.err.println("NewtCanvasAWT.attachNewtChild.2: size "+w+"x"+h+", isNValid "+newtChild.isNativeValid());
}
newtChild.setVisible(false);
newtChild.setSize(w, h);
- final int[] reqSurfaceScale = new int[2];
- if( isNValid ) {
- newtChild.getCurrentSurfaceScale(reqSurfaceScale);
- } else {
- newtChild.getRequestedSurfaceScale(reqSurfaceScale);
- }
+ final float[] reqSurfaceScale = newtChild.getRequestedSurfaceScale(new float[2]);
jawtWindow.setSurfaceScale(reqSurfaceScale);
newtChild.reparentWindow(jawtWindow, -1, -1, Window.REPARENT_HINT_BECOMES_VISIBLE);
newtChild.addSurfaceUpdatedListener(jawtWindow);
diff --git a/src/newt/classes/com/jogamp/newt/awt/applet/JOGLNewtApplet1Run.java b/src/newt/classes/com/jogamp/newt/awt/applet/JOGLNewtApplet1Run.java
index 72b3e43f3..cd53294a1 100644
--- a/src/newt/classes/com/jogamp/newt/awt/applet/JOGLNewtApplet1Run.java
+++ b/src/newt/classes/com/jogamp/newt/awt/applet/JOGLNewtApplet1Run.java
@@ -38,11 +38,11 @@ import java.awt.event.MouseListener;
import java.awt.event.MouseMotionListener;
import java.util.Arrays;
-import javax.media.nativewindow.WindowClosingProtocol.WindowClosingMode;
-import javax.media.opengl.FPSCounter;
-import javax.media.opengl.GLCapabilities;
-import javax.media.opengl.GLEventListener;
-import javax.media.opengl.GLProfile;
+import com.jogamp.nativewindow.WindowClosingProtocol.WindowClosingMode;
+import com.jogamp.opengl.FPSCounter;
+import com.jogamp.opengl.GLCapabilities;
+import com.jogamp.opengl.GLEventListener;
+import com.jogamp.opengl.GLProfile;
import jogamp.nativewindow.jawt.JAWTUtil;
diff --git a/src/newt/classes/com/jogamp/newt/event/PinchToZoomGesture.java b/src/newt/classes/com/jogamp/newt/event/PinchToZoomGesture.java
index 9c7a4bcb8..166f30d7c 100644
--- a/src/newt/classes/com/jogamp/newt/event/PinchToZoomGesture.java
+++ b/src/newt/classes/com/jogamp/newt/event/PinchToZoomGesture.java
@@ -27,7 +27,7 @@
*/
package com.jogamp.newt.event;
-import javax.media.nativewindow.NativeSurface;
+import com.jogamp.nativewindow.NativeSurface;
import com.jogamp.newt.event.MouseEvent.PointerClass;
diff --git a/src/newt/classes/com/jogamp/newt/event/WindowListener.java b/src/newt/classes/com/jogamp/newt/event/WindowListener.java
index e097edf23..b45a9dea7 100644
--- a/src/newt/classes/com/jogamp/newt/event/WindowListener.java
+++ b/src/newt/classes/com/jogamp/newt/event/WindowListener.java
@@ -34,7 +34,7 @@
package com.jogamp.newt.event;
-import javax.media.nativewindow.WindowClosingProtocol;
+import com.jogamp.nativewindow.WindowClosingProtocol;
/** NEWT {@link WindowEvent} listener. */
public interface WindowListener extends NEWTEventListener {
diff --git a/src/newt/classes/com/jogamp/newt/event/WindowUpdateEvent.java b/src/newt/classes/com/jogamp/newt/event/WindowUpdateEvent.java
index 4a5fecd83..dc12307ed 100644
--- a/src/newt/classes/com/jogamp/newt/event/WindowUpdateEvent.java
+++ b/src/newt/classes/com/jogamp/newt/event/WindowUpdateEvent.java
@@ -28,7 +28,7 @@
package com.jogamp.newt.event;
-import javax.media.nativewindow.util.Rectangle;
+import com.jogamp.nativewindow.util.Rectangle;
@SuppressWarnings("serial")
public class WindowUpdateEvent extends WindowEvent {
diff --git a/src/newt/classes/com/jogamp/newt/event/awt/AWTAdapter.java b/src/newt/classes/com/jogamp/newt/event/awt/AWTAdapter.java
index a49c10a1e..89fece2dc 100644
--- a/src/newt/classes/com/jogamp/newt/event/awt/AWTAdapter.java
+++ b/src/newt/classes/com/jogamp/newt/event/awt/AWTAdapter.java
@@ -28,7 +28,7 @@
package com.jogamp.newt.event.awt;
-import javax.media.nativewindow.NativeSurfaceHolder;
+import com.jogamp.nativewindow.NativeSurfaceHolder;
import jogamp.newt.Debug;
@@ -39,10 +39,10 @@ import jogamp.newt.Debug;
* it is converted to a NEWT event and the given NEWT listener is being called.<br></p>
* <p>
* This adapter fullfills three use cases. First as a plain utility to write code AWT agnostic,
- * ie write an {@link javax.media.opengl.GLEvenListener} and some appropriate NEWT {@link com.jogamp.newt.event.NEWTEventListener}.<br></p>
+ * ie write an {@link com.jogamp.opengl.GLEvenListener} and some appropriate NEWT {@link com.jogamp.newt.event.NEWTEventListener}.<br></p>
* <p>
- * Attach the {@link javax.media.opengl.GLEvenListener} to a NEWT {@link javax.media.opengl.GLAutoDrawable}, e.g. {@link com.jogamp.newt.opengl.GLWindow},<br>
- * or to an AWT {@link javax.media.opengl.GLAutoDrawable}, e.g. {@link javax.media.opengl.awt.GLCanvas}.<br>
+ * Attach the {@link com.jogamp.opengl.GLEvenListener} to a NEWT {@link com.jogamp.opengl.GLAutoDrawable}, e.g. {@link com.jogamp.newt.opengl.GLWindow},<br>
+ * or to an AWT {@link com.jogamp.opengl.GLAutoDrawable}, e.g. {@link com.jogamp.opengl.awt.GLCanvas}.<br>
* <br>
* Attach the NEWT {@link com.jogamp.newt.event.NEWTEventListener} to a NEWT component, e.g. {@link com.jogamp.newt.Window},<br>
* or to an AWT component, e.g. {@link java.awt.Component}.<br></p>
@@ -50,7 +50,7 @@ import jogamp.newt.Debug;
* Common:<br>
* <pre>
// your demo/render code
- javax.media.opengl.GLEvenListener demo1 = new javax.media.opengl.GLEvenListener() { ... } ;
+ com.jogamp.opengl.GLEvenListener demo1 = new com.jogamp.opengl.GLEvenListener() { ... } ;
// your AWT agnostic NEWT mouse listener code
com.jogamp.newt.event.MouseListener mouseListener = new com.jogamp.newt.event.MouseAdapter() { ... } ;
diff --git a/src/newt/classes/com/jogamp/newt/event/awt/AWTKeyAdapter.java b/src/newt/classes/com/jogamp/newt/event/awt/AWTKeyAdapter.java
index 4f11e8772..a69c2a9d9 100644
--- a/src/newt/classes/com/jogamp/newt/event/awt/AWTKeyAdapter.java
+++ b/src/newt/classes/com/jogamp/newt/event/awt/AWTKeyAdapter.java
@@ -28,7 +28,7 @@
package com.jogamp.newt.event.awt;
-import javax.media.nativewindow.NativeSurfaceHolder;
+import com.jogamp.nativewindow.NativeSurfaceHolder;
import jogamp.newt.awt.event.AWTNewtEventFactory;
diff --git a/src/newt/classes/com/jogamp/newt/event/awt/AWTMouseAdapter.java b/src/newt/classes/com/jogamp/newt/event/awt/AWTMouseAdapter.java
index d9531cd5f..553349201 100644
--- a/src/newt/classes/com/jogamp/newt/event/awt/AWTMouseAdapter.java
+++ b/src/newt/classes/com/jogamp/newt/event/awt/AWTMouseAdapter.java
@@ -28,7 +28,7 @@
package com.jogamp.newt.event.awt;
-import javax.media.nativewindow.NativeSurfaceHolder;
+import com.jogamp.nativewindow.NativeSurfaceHolder;
import jogamp.newt.awt.event.AWTNewtEventFactory;
diff --git a/src/newt/classes/com/jogamp/newt/event/awt/AWTWindowAdapter.java b/src/newt/classes/com/jogamp/newt/event/awt/AWTWindowAdapter.java
index a8105403d..2e5d75782 100644
--- a/src/newt/classes/com/jogamp/newt/event/awt/AWTWindowAdapter.java
+++ b/src/newt/classes/com/jogamp/newt/event/awt/AWTWindowAdapter.java
@@ -30,7 +30,7 @@ package com.jogamp.newt.event.awt;
import java.awt.Dimension;
-import javax.media.nativewindow.NativeSurfaceHolder;
+import com.jogamp.nativewindow.NativeSurfaceHolder;
import jogamp.newt.awt.event.AWTNewtEventFactory;
diff --git a/src/newt/classes/com/jogamp/newt/opengl/GLWindow.java b/src/newt/classes/com/jogamp/newt/opengl/GLWindow.java
index 2ba030f76..d638b3ae5 100644
--- a/src/newt/classes/com/jogamp/newt/opengl/GLWindow.java
+++ b/src/newt/classes/com/jogamp/newt/opengl/GLWindow.java
@@ -38,34 +38,34 @@ import java.security.AccessController;
import java.security.PrivilegedAction;
import java.util.List;
-import javax.media.nativewindow.AbstractGraphicsConfiguration;
-import javax.media.nativewindow.CapabilitiesChooser;
-import javax.media.nativewindow.CapabilitiesImmutable;
-import javax.media.nativewindow.NativeSurface;
-import javax.media.nativewindow.NativeWindow;
-import javax.media.nativewindow.NativeWindowException;
-import javax.media.nativewindow.SurfaceUpdatedListener;
-import javax.media.nativewindow.util.InsetsImmutable;
-import javax.media.nativewindow.util.Point;
-import javax.media.nativewindow.util.Rectangle;
-import javax.media.opengl.FPSCounter;
-import javax.media.opengl.GL;
-import javax.media.opengl.GL3;
-import javax.media.opengl.GL4ES3;
-import javax.media.opengl.GLAnimatorControl;
-import javax.media.opengl.GLAutoDrawable;
-import javax.media.opengl.GLCapabilities;
-import javax.media.opengl.GLCapabilitiesImmutable;
-import javax.media.opengl.GLContext;
-import javax.media.opengl.GLDrawable;
-import javax.media.opengl.GLDrawableFactory;
-import javax.media.opengl.GLES2;
-import javax.media.opengl.GLES3;
-import javax.media.opengl.GLEventListener;
-import javax.media.opengl.GLException;
-import javax.media.opengl.GLProfile;
-import javax.media.opengl.GLRunnable;
-import javax.media.opengl.GLSharedContextSetter;
+import com.jogamp.nativewindow.AbstractGraphicsConfiguration;
+import com.jogamp.nativewindow.CapabilitiesChooser;
+import com.jogamp.nativewindow.CapabilitiesImmutable;
+import com.jogamp.nativewindow.NativeSurface;
+import com.jogamp.nativewindow.NativeWindow;
+import com.jogamp.nativewindow.NativeWindowException;
+import com.jogamp.nativewindow.SurfaceUpdatedListener;
+import com.jogamp.nativewindow.util.InsetsImmutable;
+import com.jogamp.nativewindow.util.Point;
+import com.jogamp.nativewindow.util.Rectangle;
+import com.jogamp.opengl.FPSCounter;
+import com.jogamp.opengl.GL;
+import com.jogamp.opengl.GL3;
+import com.jogamp.opengl.GL4ES3;
+import com.jogamp.opengl.GLAnimatorControl;
+import com.jogamp.opengl.GLAutoDrawable;
+import com.jogamp.opengl.GLCapabilities;
+import com.jogamp.opengl.GLCapabilitiesImmutable;
+import com.jogamp.opengl.GLContext;
+import com.jogamp.opengl.GLDrawable;
+import com.jogamp.opengl.GLDrawableFactory;
+import com.jogamp.opengl.GLES2;
+import com.jogamp.opengl.GLES3;
+import com.jogamp.opengl.GLEventListener;
+import com.jogamp.opengl.GLException;
+import com.jogamp.opengl.GLProfile;
+import com.jogamp.opengl.GLRunnable;
+import com.jogamp.opengl.GLSharedContextSetter;
import jogamp.newt.WindowImpl;
import jogamp.opengl.GLAutoDrawableBase;
@@ -401,23 +401,28 @@ public class GLWindow extends GLAutoDrawableBase implements GLAutoDrawable, Wind
}
@Override
- public final void setSurfaceScale(final int[] pixelScale) {
- window.setSurfaceScale(pixelScale);
+ public final boolean setSurfaceScale(final float[] pixelScale) {
+ return window.setSurfaceScale(pixelScale);
}
@Override
- public final int[] getRequestedSurfaceScale(final int[] result) {
+ public final float[] getRequestedSurfaceScale(final float[] result) {
return window.getRequestedSurfaceScale(result);
}
@Override
- public final int[] getCurrentSurfaceScale(final int[] result) {
+ public final float[] getCurrentSurfaceScale(final float[] result) {
return window.getCurrentSurfaceScale(result);
}
@Override
- public final int[] getNativeSurfaceScale(final int[] result) {
- return window.getNativeSurfaceScale(result);
+ public final float[] getMinimumSurfaceScale(final float[] result) {
+ return window.getMinimumSurfaceScale(result);
+ }
+
+ @Override
+ public final float[] getMaximumSurfaceScale(final float[] result) {
+ return window.getMaximumSurfaceScale(result);
}
@Override
diff --git a/src/newt/classes/com/jogamp/newt/swt/NewtCanvasSWT.java b/src/newt/classes/com/jogamp/newt/swt/NewtCanvasSWT.java
index 76af2d0ec..186ffb162 100644
--- a/src/newt/classes/com/jogamp/newt/swt/NewtCanvasSWT.java
+++ b/src/newt/classes/com/jogamp/newt/swt/NewtCanvasSWT.java
@@ -28,22 +28,22 @@
package com.jogamp.newt.swt;
-import javax.media.nativewindow.AbstractGraphicsConfiguration;
-import javax.media.nativewindow.AbstractGraphicsDevice;
-import javax.media.nativewindow.AbstractGraphicsScreen;
-import javax.media.nativewindow.Capabilities;
-import javax.media.nativewindow.CapabilitiesImmutable;
-import javax.media.nativewindow.GraphicsConfigurationFactory;
-import javax.media.nativewindow.NativeSurface;
-import javax.media.nativewindow.NativeWindow;
-import javax.media.nativewindow.NativeWindowException;
-import javax.media.nativewindow.NativeWindowFactory;
-import javax.media.nativewindow.SurfaceUpdatedListener;
-import javax.media.nativewindow.WindowClosingProtocol;
-import javax.media.nativewindow.util.Insets;
-import javax.media.nativewindow.util.InsetsImmutable;
-import javax.media.nativewindow.util.Point;
-import javax.media.opengl.GLCapabilities;
+import com.jogamp.nativewindow.AbstractGraphicsConfiguration;
+import com.jogamp.nativewindow.AbstractGraphicsDevice;
+import com.jogamp.nativewindow.AbstractGraphicsScreen;
+import com.jogamp.nativewindow.Capabilities;
+import com.jogamp.nativewindow.CapabilitiesImmutable;
+import com.jogamp.nativewindow.GraphicsConfigurationFactory;
+import com.jogamp.nativewindow.NativeSurface;
+import com.jogamp.nativewindow.NativeWindow;
+import com.jogamp.nativewindow.NativeWindowException;
+import com.jogamp.nativewindow.NativeWindowFactory;
+import com.jogamp.nativewindow.SurfaceUpdatedListener;
+import com.jogamp.nativewindow.WindowClosingProtocol;
+import com.jogamp.nativewindow.util.Insets;
+import com.jogamp.nativewindow.util.InsetsImmutable;
+import com.jogamp.nativewindow.util.Point;
+import com.jogamp.opengl.GLCapabilities;
import jogamp.nativewindow.macosx.OSXUtil;
import jogamp.nativewindow.windows.GDIUtil;
diff --git a/src/newt/classes/com/jogamp/newt/util/MainThread.java b/src/newt/classes/com/jogamp/newt/util/MainThread.java
index 80da1ce3b..8bf4bc20f 100644
--- a/src/newt/classes/com/jogamp/newt/util/MainThread.java
+++ b/src/newt/classes/com/jogamp/newt/util/MainThread.java
@@ -42,7 +42,7 @@ import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
import java.util.List;
-import javax.media.nativewindow.NativeWindowFactory;
+import com.jogamp.nativewindow.NativeWindowFactory;
import com.jogamp.common.os.Platform;
import com.jogamp.common.util.PropertyAccess;
diff --git a/src/newt/classes/com/jogamp/newt/util/MonitorModeUtil.java b/src/newt/classes/com/jogamp/newt/util/MonitorModeUtil.java
index e5f8ff17c..26263770c 100644
--- a/src/newt/classes/com/jogamp/newt/util/MonitorModeUtil.java
+++ b/src/newt/classes/com/jogamp/newt/util/MonitorModeUtil.java
@@ -34,8 +34,8 @@ import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
-import javax.media.nativewindow.util.DimensionImmutable;
-import javax.media.nativewindow.util.SurfaceSize;
+import com.jogamp.nativewindow.util.DimensionImmutable;
+import com.jogamp.nativewindow.util.SurfaceSize;
/**
* Convenient {@link com.jogamp.newt.MonitorMode} utility methods,
diff --git a/src/newt/classes/com/jogamp/newt/util/applet/JOGLNewtApplet3Run.java b/src/newt/classes/com/jogamp/newt/util/applet/JOGLNewtApplet3Run.java
index 9a3e79a8f..6ea63f69c 100644
--- a/src/newt/classes/com/jogamp/newt/util/applet/JOGLNewtApplet3Run.java
+++ b/src/newt/classes/com/jogamp/newt/util/applet/JOGLNewtApplet3Run.java
@@ -34,15 +34,15 @@ import com.jogamp.plugin.applet.Applet3Context;
import com.jogamp.plugin.ui.NativeWindowDownstream;
import com.jogamp.plugin.ui.NativeWindowUpstream;
-import javax.media.nativewindow.AbstractGraphicsDevice;
-import javax.media.nativewindow.AbstractGraphicsScreen;
-import javax.media.nativewindow.NativeWindow;
-import javax.media.nativewindow.NativeWindowFactory;
-import javax.media.nativewindow.WindowClosingProtocol.WindowClosingMode;
-import javax.media.nativewindow.util.PointImmutable;
-import javax.media.opengl.FPSCounter;
-import javax.media.opengl.GLCapabilities;
-import javax.media.opengl.GLProfile;
+import com.jogamp.nativewindow.AbstractGraphicsDevice;
+import com.jogamp.nativewindow.AbstractGraphicsScreen;
+import com.jogamp.nativewindow.NativeWindow;
+import com.jogamp.nativewindow.NativeWindowFactory;
+import com.jogamp.nativewindow.WindowClosingProtocol.WindowClosingMode;
+import com.jogamp.nativewindow.util.PointImmutable;
+import com.jogamp.opengl.FPSCounter;
+import com.jogamp.opengl.GLCapabilities;
+import com.jogamp.opengl.GLProfile;
import com.jogamp.nativewindow.UpstreamWindowHookMutableSizePos;
import com.jogamp.newt.NewtFactory;
diff --git a/src/newt/classes/com/jogamp/newt/util/applet/JOGLNewtAppletBase.java b/src/newt/classes/com/jogamp/newt/util/applet/JOGLNewtAppletBase.java
index d40e09d96..cc159e6ed 100644
--- a/src/newt/classes/com/jogamp/newt/util/applet/JOGLNewtAppletBase.java
+++ b/src/newt/classes/com/jogamp/newt/util/applet/JOGLNewtAppletBase.java
@@ -31,14 +31,14 @@ import java.lang.reflect.Field;
import java.security.AccessController;
import java.security.PrivilegedAction;
-import javax.media.nativewindow.NativeWindow;
-import javax.media.nativewindow.WindowClosingProtocol.WindowClosingMode;
-import javax.media.nativewindow.util.InsetsImmutable;
-import javax.media.opengl.FPSCounter;
-import javax.media.opengl.GL;
-import javax.media.opengl.GLAutoDrawable;
-import javax.media.opengl.GLEventListener;
-import javax.media.opengl.GLPipelineFactory;
+import com.jogamp.nativewindow.NativeWindow;
+import com.jogamp.nativewindow.WindowClosingProtocol.WindowClosingMode;
+import com.jogamp.nativewindow.util.InsetsImmutable;
+import com.jogamp.opengl.FPSCounter;
+import com.jogamp.opengl.GL;
+import com.jogamp.opengl.GLAutoDrawable;
+import com.jogamp.opengl.GLEventListener;
+import com.jogamp.opengl.GLPipelineFactory;
import jogamp.newt.Debug;
@@ -281,14 +281,14 @@ public class JOGLNewtAppletBase implements KeyListener, GLEventListener {
if(glDebug) {
try {
- _gl = _gl.getContext().setGL( GLPipelineFactory.create("javax.media.opengl.Debug", null, _gl, null) );
+ _gl = _gl.getContext().setGL( GLPipelineFactory.create("com.jogamp.opengl.Debug", null, _gl, null) );
} catch (final Exception e) {e.printStackTrace();}
}
if(glTrace) {
try {
// Trace ..
- _gl = _gl.getContext().setGL( GLPipelineFactory.create("javax.media.opengl.Trace", null, _gl, new Object[] { System.err } ) );
+ _gl = _gl.getContext().setGL( GLPipelineFactory.create("com.jogamp.opengl.Trace", null, _gl, new Object[] { System.err } ) );
} catch (final Exception e) {e.printStackTrace();}
}
diff --git a/src/newt/classes/com/jogamp/newt/util/applet/VersionApplet3.java b/src/newt/classes/com/jogamp/newt/util/applet/VersionApplet3.java
index 7ec790ee2..518337d20 100644
--- a/src/newt/classes/com/jogamp/newt/util/applet/VersionApplet3.java
+++ b/src/newt/classes/com/jogamp/newt/util/applet/VersionApplet3.java
@@ -8,13 +8,13 @@ import com.jogamp.plugin.ui.NativeWindowUpstream;
import java.util.List;
import java.util.Locale;
-import javax.media.opengl.GLProfile;
-import javax.media.opengl.GL;
-import javax.media.opengl.GLAutoDrawable;
-import javax.media.opengl.GLCapabilities;
-import javax.media.opengl.GLCapabilitiesImmutable;
-import javax.media.opengl.GLDrawableFactory;
-import javax.media.opengl.GLEventListener;
+import com.jogamp.opengl.GLProfile;
+import com.jogamp.opengl.GL;
+import com.jogamp.opengl.GLAutoDrawable;
+import com.jogamp.opengl.GLCapabilities;
+import com.jogamp.opengl.GLCapabilitiesImmutable;
+import com.jogamp.opengl.GLDrawableFactory;
+import com.jogamp.opengl.GLEventListener;
import com.jogamp.common.GlueGenVersion;
import com.jogamp.common.util.VersionUtil;
diff --git a/src/newt/classes/jogamp/newt/DefaultEDTUtil.java b/src/newt/classes/jogamp/newt/DefaultEDTUtil.java
index ef8ea66b6..bf46ce609 100644
--- a/src/newt/classes/jogamp/newt/DefaultEDTUtil.java
+++ b/src/newt/classes/jogamp/newt/DefaultEDTUtil.java
@@ -39,10 +39,11 @@ package jogamp.newt;
import java.util.ArrayList;
-import javax.media.nativewindow.NativeWindowException;
+import com.jogamp.nativewindow.NativeWindowException;
import jogamp.common.util.locks.LockDebugUtil;
+import com.jogamp.common.ExceptionUtils;
import com.jogamp.common.util.RunnableTask;
import com.jogamp.common.util.locks.Lock;
import com.jogamp.newt.util.EDTUtil;
@@ -144,7 +145,7 @@ public class DefaultEDTUtil implements EDTUtil {
public final boolean invokeStop(final boolean wait, final Runnable task) {
if(DEBUG) {
System.err.println(Thread.currentThread()+": Default-EDT.invokeStop wait "+wait);
- Thread.dumpStack();
+ ExceptionUtils.dumpStack(System.err);
}
return invokeImpl(wait, task, true /* stop */, false /* provokeError */);
}
@@ -152,7 +153,7 @@ public class DefaultEDTUtil implements EDTUtil {
public final boolean invokeAndWaitError(final Runnable task) {
if(DEBUG) {
System.err.println(Thread.currentThread()+": Default-EDT.invokeAndWaitError");
- Thread.dumpStack();
+ ExceptionUtils.dumpStack(System.err);
}
return invokeImpl(true /* wait */, task, false /* stop */, true /* provokeError */);
}
@@ -177,7 +178,7 @@ public class DefaultEDTUtil implements EDTUtil {
// drop task ..
System.err.println(Thread.currentThread()+": Warning: Default-EDT about (1) to stop, won't enqueue new task: "+edt);
if(DEBUG) {
- Thread.dumpStack();
+ ExceptionUtils.dumpStack(System.err);
}
return false;
}
@@ -191,7 +192,7 @@ public class DefaultEDTUtil implements EDTUtil {
if( edt.tasks.size()>0 ) {
System.err.println(Thread.currentThread()+": Warning: Default-EDT about (2) to stop, task executed. Remaining tasks: "+edt.tasks.size()+" - "+edt);
if(DEBUG) {
- Thread.dumpStack();
+ ExceptionUtils.dumpStack(System.err);
}
}
}
@@ -204,7 +205,7 @@ public class DefaultEDTUtil implements EDTUtil {
System.err.println(Thread.currentThread()+": Warning: Default-EDT is not running, dropping task. NEDT "+edt);
}
if(DEBUG) {
- Thread.dumpStack();
+ ExceptionUtils.dumpStack(System.err);
}
}
return false;
diff --git a/src/newt/classes/jogamp/newt/DisplayImpl.java b/src/newt/classes/jogamp/newt/DisplayImpl.java
index 84ce45238..cc1f3d8e0 100644
--- a/src/newt/classes/jogamp/newt/DisplayImpl.java
+++ b/src/newt/classes/jogamp/newt/DisplayImpl.java
@@ -34,6 +34,7 @@
package jogamp.newt;
+import com.jogamp.common.ExceptionUtils;
import com.jogamp.common.nio.Buffers;
import com.jogamp.common.util.IOUtil;
import com.jogamp.common.util.ReflectionUtil;
@@ -52,14 +53,14 @@ import java.net.URLConnection;
import java.nio.ByteBuffer;
import java.util.ArrayList;
-import javax.media.nativewindow.AbstractGraphicsDevice;
-import javax.media.nativewindow.NativeWindowException;
-import javax.media.nativewindow.NativeWindowFactory;
-import javax.media.nativewindow.util.PixelFormatUtil;
-import javax.media.nativewindow.util.PixelRectangle;
-import javax.media.nativewindow.util.PixelFormat;
-import javax.media.nativewindow.util.Point;
-import javax.media.nativewindow.util.PointImmutable;
+import com.jogamp.nativewindow.AbstractGraphicsDevice;
+import com.jogamp.nativewindow.NativeWindowException;
+import com.jogamp.nativewindow.NativeWindowFactory;
+import com.jogamp.nativewindow.util.PixelFormatUtil;
+import com.jogamp.nativewindow.util.PixelRectangle;
+import com.jogamp.nativewindow.util.PixelFormat;
+import com.jogamp.nativewindow.util.Point;
+import com.jogamp.nativewindow.util.PointImmutable;
public abstract class DisplayImpl extends Display {
private static int serialno = 1;
@@ -164,7 +165,7 @@ public abstract class DisplayImpl extends Display {
final PixelRectangle fpixelrect;
if( getNativePointerIconPixelFormat() != pixelrect.getPixelformat() || pixelrect.isGLOriented() ) {
// conversion !
- fpixelrect = PixelFormatUtil.convert32(pixelrect, getNativePointerIconPixelFormat(),
+ fpixelrect = PixelFormatUtil.convert(pixelrect, getNativePointerIconPixelFormat(),
0 /* ddestStride */, false /* isGLOriented */, getNativePointerIconForceDirectNIO() );
if( DEBUG_POINTER_ICON ) {
System.err.println("createPointerIconRES.0: Conversion-FMT "+pixelrect+" -> "+fpixelrect);
@@ -398,7 +399,7 @@ public abstract class DisplayImpl extends Display {
if( DEBUG ) {
if ( !res ) {
System.err.println("Warning: invokeStop() failed");
- Thread.dumpStack();
+ ExceptionUtils.dumpStack(System.err);
}
}
}
@@ -416,7 +417,7 @@ public abstract class DisplayImpl extends Display {
if( !_edtUtil.isRunning() ) { // // volatile dbl-checked-locking OK
if( DEBUG ) {
System.err.println("Info: EDT start "+Thread.currentThread().getName()+", "+this);
- Thread.dumpStack();
+ ExceptionUtils.dumpStack(System.err);
}
_edtUtil.start();
}
@@ -428,7 +429,7 @@ public abstract class DisplayImpl extends Display {
}
if( DEBUG ) {
System.err.println("Warning: invoke(wait "+wait+", ..) on EDT failed .. invoke on current thread "+Thread.currentThread().getName());
- Thread.dumpStack();
+ ExceptionUtils.dumpStack(System.err);
}
}
task.run();
@@ -685,7 +686,7 @@ public abstract class DisplayImpl extends Display {
if(null == event) {
// Ooops ?
System.err.println("Warning: event of eventTask is NULL");
- Thread.dumpStack();
+ ExceptionUtils.dumpStack(System.err);
return;
}
dispatchMessage(event);
@@ -739,7 +740,7 @@ public abstract class DisplayImpl extends Display {
// oops .. we are already dead
if(DEBUG) {
System.err.println("Warning: EDT already stopped: wait:="+wait+", "+e);
- Thread.dumpStack();
+ ExceptionUtils.dumpStack(System.err);
}
return;
}
diff --git a/src/newt/classes/jogamp/newt/MonitorDeviceImpl.java b/src/newt/classes/jogamp/newt/MonitorDeviceImpl.java
index 72300740f..7c7d54680 100644
--- a/src/newt/classes/jogamp/newt/MonitorDeviceImpl.java
+++ b/src/newt/classes/jogamp/newt/MonitorDeviceImpl.java
@@ -28,8 +28,9 @@
package jogamp.newt;
-import javax.media.nativewindow.util.DimensionImmutable;
-import javax.media.nativewindow.util.Rectangle;
+import com.jogamp.nativewindow.ScalableSurface;
+import com.jogamp.nativewindow.util.DimensionImmutable;
+import com.jogamp.nativewindow.util.Rectangle;
import com.jogamp.common.util.ArrayHashSet;
import com.jogamp.newt.MonitorDevice;
@@ -38,8 +39,21 @@ import com.jogamp.newt.Screen;
public class MonitorDeviceImpl extends MonitorDevice {
- public MonitorDeviceImpl(final ScreenImpl screen, final int nativeId, final DimensionImmutable sizeMM, final Rectangle viewportPU, final Rectangle viewportWU, final MonitorMode currentMode, final ArrayHashSet<MonitorMode> supportedModes) {
- super(screen, nativeId, sizeMM, viewportPU, viewportWU, currentMode, supportedModes);
+ /**
+ * @param screen associated {@link Screen}
+ * @param nativeId unique monitor device ID
+ * @param sizeMM size in millimeters
+ * @param currentMode
+ * @param pixelScale pre-fetched current pixel-scale, maybe {@code null} for {@link ScalableSurface#IDENTITY_PIXELSCALE}.
+ * @param viewportPU viewport in pixel-units
+ * @param viewportWU viewport in window-units
+ * @param supportedModes all supported {@link MonitorMode}s
+ */
+ public MonitorDeviceImpl(final ScreenImpl screen, final int nativeId, final DimensionImmutable sizeMM,
+ final MonitorMode currentMode,
+ final float[] pixelScale, final Rectangle viewportPU, final Rectangle viewportWU,
+ final ArrayHashSet<MonitorMode> supportedModes) {
+ super(screen, nativeId, sizeMM, currentMode, pixelScale, viewportPU, viewportWU, supportedModes);
}
@Override
diff --git a/src/newt/classes/jogamp/newt/MonitorModeProps.java b/src/newt/classes/jogamp/newt/MonitorModeProps.java
index 6e376ce48..3f9e0be78 100644
--- a/src/newt/classes/jogamp/newt/MonitorModeProps.java
+++ b/src/newt/classes/jogamp/newt/MonitorModeProps.java
@@ -33,10 +33,11 @@ import com.jogamp.newt.MonitorDevice;
import com.jogamp.newt.MonitorMode;
import java.util.List;
-import javax.media.nativewindow.util.Dimension;
-import javax.media.nativewindow.util.DimensionImmutable;
-import javax.media.nativewindow.util.Rectangle;
-import javax.media.nativewindow.util.SurfaceSize;
+import com.jogamp.nativewindow.ScalableSurface;
+import com.jogamp.nativewindow.util.Dimension;
+import com.jogamp.nativewindow.util.DimensionImmutable;
+import com.jogamp.nativewindow.util.Rectangle;
+import com.jogamp.nativewindow.util.SurfaceSize;
import jogamp.newt.MonitorDeviceImpl;
import jogamp.newt.ScreenImpl;
@@ -256,14 +257,19 @@ public class MonitorModeProps {
* <p>
* Note: This variant only works for impl. w/ a unique mode key pair <i>modeId, rotation</i>.
* </p>
- * @param mode_idx if not null, returns the index of resulting {@link MonitorDevice} within {@link Cache#monitorDevices}.
* @param cache hash arrays of unique {@link MonitorMode} components and {@link MonitorDevice}s, allowing to avoid duplicates
- * @param modeProperties the input data
+ * @param screen the associated {@link ScreenImpl}
+ * @param pixelScale pre-fetched current pixel-scale, maybe {@code null} for {@link ScalableSurface#IDENTITY_PIXELSCALE}.
+ * @param monitorProperties the input data minus supported modes!
* @param offset the offset to the input data
+ * @param monitor_idx if not null, returns the index of resulting {@link MonitorDevice} within {@link Cache#monitorDevices}.
* @return {@link MonitorDevice} of the identical (old or new) element in {@link Cache#monitorDevices},
* matching the input <code>modeProperties</code>, or null if input could not be processed.
*/
- public static MonitorDevice streamInMonitorDevice(final int[] monitor_idx, final Cache cache, final ScreenImpl screen, final int[] monitorProperties, int offset) {
+ public static MonitorDevice streamInMonitorDevice(final Cache cache, final ScreenImpl screen,
+ final float[] pixelScale,
+ final int[] monitorProperties, int offset,
+ final int[] monitor_idx) {
// min 11: count, id, ScreenSizeMM[width, height], Viewport[x, y, width, height], currentMonitorModeId, rotation, supportedModeId+
final int count = monitorProperties[offset];
if(MIN_MONITOR_DEVICE_PROPERTIES > count) {
@@ -298,7 +304,7 @@ public class MonitorModeProps {
}
}
}
- MonitorDevice monitorDevice = new MonitorDeviceImpl(screen, id, sizeMM, viewportPU, viewportWU, currentMode, supportedModes);
+ MonitorDevice monitorDevice = new MonitorDeviceImpl(screen, id, sizeMM, currentMode, pixelScale, viewportPU, viewportWU, supportedModes);
if(null!=cache) {
monitorDevice = cache.monitorDevices.getOrAdd(monitorDevice);
}
@@ -329,17 +335,23 @@ public class MonitorModeProps {
* This variant expects <code>count</code> to be <code>{@link MIN_MONITOR_DEVICE_PROPERTIES} - 1 - {@link NUM_MONITOR_MODE_PROPERTIES}</code>,
* due to lack of supported mode and current mode.
* </p>
- *
- * @param mode_idx if not null, returns the index of resulting {@link MonitorDevice} within {@link Cache#monitorDevices}.
* @param cache hash arrays of unique {@link MonitorMode} components and {@link MonitorDevice}s, allowing to avoid duplicates
- * @param supportedModes pre-assembled list of supported {@link MonitorMode}s from cache.
+ * @param screen the associated {@link ScreenImpl}
* @param currentMode pre-fetched current {@link MonitorMode}s from cache.
- * @param modeProperties the input data minus supported modes!
+ * @param pixelScale pre-fetched current pixel-scale, maybe {@code null} for {@link ScalableSurface#IDENTITY_PIXELSCALE}.
+ * @param supportedModes pre-assembled list of supported {@link MonitorMode}s from cache.
+ * @param monitorProperties the input data minus supported modes!
* @param offset the offset to the input data
+ * @param monitor_idx if not null, returns the index of resulting {@link MonitorDevice} within {@link Cache#monitorDevices}.
* @return {@link MonitorDevice} of the identical (old or new) element in {@link Cache#monitorDevices},
* matching the input <code>modeProperties</code>, or null if input could not be processed.
*/
- public static MonitorDevice streamInMonitorDevice(final int[] monitor_idx, final Cache cache, final ScreenImpl screen, final ArrayHashSet<MonitorMode> supportedModes, final MonitorMode currentMode, final int[] monitorProperties, int offset) {
+ public static MonitorDevice streamInMonitorDevice(final Cache cache, final ScreenImpl screen,
+ final MonitorMode currentMode,
+ final float[] pixelScale,
+ final ArrayHashSet<MonitorMode> supportedModes,
+ final int[] monitorProperties, int offset,
+ final int[] monitor_idx) {
// min 11: count, id, ScreenSizeMM[width, height], Viewport[x, y, width, height], currentMonitorModeId, rotation, supportedModeId+
final int count = monitorProperties[offset];
if(MIN_MONITOR_DEVICE_PROPERTIES - 1 - NUM_MONITOR_MODE_PROPERTIES != count) {
@@ -356,7 +368,7 @@ public class MonitorModeProps {
final DimensionImmutable sizeMM = streamInResolution(monitorProperties, offset); offset+=NUM_RESOLUTION_PROPERTIES;
final Rectangle viewportPU = new Rectangle(monitorProperties[offset++], monitorProperties[offset++], monitorProperties[offset++], monitorProperties[offset++]);
final Rectangle viewportWU = new Rectangle(monitorProperties[offset++], monitorProperties[offset++], monitorProperties[offset++], monitorProperties[offset++]);
- MonitorDevice monitorDevice = new MonitorDeviceImpl(screen, id, sizeMM, viewportPU, viewportWU, currentMode, supportedModes);
+ MonitorDevice monitorDevice = new MonitorDeviceImpl(screen, id, sizeMM, currentMode, pixelScale, viewportPU, viewportWU, supportedModes);
if(null!=cache) {
monitorDevice = cache.monitorDevices.getOrAdd(monitorDevice);
}
diff --git a/src/newt/classes/jogamp/newt/OffscreenWindow.java b/src/newt/classes/jogamp/newt/OffscreenWindow.java
index 749391f1f..fa9bd21bb 100644
--- a/src/newt/classes/jogamp/newt/OffscreenWindow.java
+++ b/src/newt/classes/jogamp/newt/OffscreenWindow.java
@@ -36,14 +36,14 @@ package jogamp.newt;
import java.util.List;
-import javax.media.nativewindow.AbstractGraphicsConfiguration;
-import javax.media.nativewindow.AbstractGraphicsScreen;
-import javax.media.nativewindow.GraphicsConfigurationFactory;
-import javax.media.nativewindow.MutableSurface;
-import javax.media.nativewindow.NativeWindowException;
-import javax.media.nativewindow.VisualIDHolder;
-import javax.media.nativewindow.util.Insets;
-import javax.media.nativewindow.util.Point;
+import com.jogamp.nativewindow.AbstractGraphicsConfiguration;
+import com.jogamp.nativewindow.AbstractGraphicsScreen;
+import com.jogamp.nativewindow.GraphicsConfigurationFactory;
+import com.jogamp.nativewindow.MutableSurface;
+import com.jogamp.nativewindow.NativeWindowException;
+import com.jogamp.nativewindow.VisualIDHolder;
+import com.jogamp.nativewindow.util.Insets;
+import com.jogamp.nativewindow.util.Point;
import com.jogamp.newt.MonitorDevice;
@@ -71,7 +71,7 @@ public class OffscreenWindow extends WindowImpl implements MutableSurface {
setGraphicsConfiguration(cfg);
synchronized(OffscreenWindow.class) {
- setWindowHandle(nextWindowHandle++);
+ setWindowHandle(nextWindowHandle++); // just a marker
}
visibleChanged(false, true);
}
diff --git a/src/newt/classes/jogamp/newt/PointerIconImpl.java b/src/newt/classes/jogamp/newt/PointerIconImpl.java
index 546a463de..da72752fa 100644
--- a/src/newt/classes/jogamp/newt/PointerIconImpl.java
+++ b/src/newt/classes/jogamp/newt/PointerIconImpl.java
@@ -29,10 +29,10 @@ package jogamp.newt;
import java.nio.ByteBuffer;
-import javax.media.nativewindow.util.DimensionImmutable;
-import javax.media.nativewindow.util.PixelFormat;
-import javax.media.nativewindow.util.PixelRectangle;
-import javax.media.nativewindow.util.PointImmutable;
+import com.jogamp.nativewindow.util.DimensionImmutable;
+import com.jogamp.nativewindow.util.PixelFormat;
+import com.jogamp.nativewindow.util.PixelRectangle;
+import com.jogamp.nativewindow.util.PointImmutable;
import com.jogamp.newt.Display;
import com.jogamp.newt.Display.PointerIcon;
@@ -154,7 +154,7 @@ public class PointerIconImpl implements PointerIcon {
}
@Override
public final int getStride() {
- return size.getWidth() * pixelformat.bytesPerPixel();
+ return size.getWidth() * pixelformat.comp.bytesPerPixel();
}
@Override
public final boolean isGLOriented() {
diff --git a/src/newt/classes/jogamp/newt/ScreenImpl.java b/src/newt/classes/jogamp/newt/ScreenImpl.java
index e73e153ad..b8383b631 100644
--- a/src/newt/classes/jogamp/newt/ScreenImpl.java
+++ b/src/newt/classes/jogamp/newt/ScreenImpl.java
@@ -38,11 +38,11 @@ import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
-import javax.media.nativewindow.AbstractGraphicsScreen;
-import javax.media.nativewindow.NativeWindowException;
-import javax.media.nativewindow.util.Dimension;
-import javax.media.nativewindow.util.Rectangle;
-import javax.media.nativewindow.util.RectangleImmutable;
+import com.jogamp.nativewindow.AbstractGraphicsScreen;
+import com.jogamp.nativewindow.NativeWindowException;
+import com.jogamp.nativewindow.util.Dimension;
+import com.jogamp.nativewindow.util.Rectangle;
+import com.jogamp.nativewindow.util.RectangleImmutable;
import com.jogamp.common.util.ArrayHashSet;
import com.jogamp.common.util.PropertyAccess;
@@ -364,8 +364,8 @@ public abstract class ScreenImpl extends Screen implements MonitorModeListener {
* <li>{@link MonitorModeProps#MIN_MONITOR_DEVICE_PROPERTIES}</li>
* </ul>, i.e.
* <ul>
- * <li>{@link MonitorModeProps#streamInMonitorDevice(int[], jogamp.newt.MonitorModeProps.Cache, ScreenImpl, int[], int)}</li>
- * <li>{@link MonitorModeProps#streamInMonitorDevice(int[], jogamp.newt.MonitorModeProps.Cache, ScreenImpl, ArrayHashSet, int[], int)}</li>
+ * <li>{@link MonitorModeProps#streamInMonitorDevice(jogamp.newt.MonitorModeProps.Cache, ScreenImpl, double[], int[], int, int[])}</li>
+ * <li>{@link MonitorModeProps#streamInMonitorDevice(int[], jogamp.newt.MonitorModeProps.Cache, ArrayHashSet, int[], int, ScreenImpl)}</li>
* <li>{@link MonitorModeProps#streamInMonitorMode(int[], jogamp.newt.MonitorModeProps.Cache, int[], int)}</li>
* </ul>
* @param cache memory pool caching the result
@@ -373,6 +373,7 @@ public abstract class ScreenImpl extends Screen implements MonitorModeListener {
protected abstract void collectNativeMonitorModesAndDevicesImpl(MonitorModeProps.Cache cache);
protected boolean updateNativeMonitorDeviceViewportImpl(final MonitorDevice monitor,
+ final float[] pixelScale,
final Rectangle viewportPU, final Rectangle viewportWU) {
return false;
}
@@ -428,9 +429,14 @@ public abstract class ScreenImpl extends Screen implements MonitorModeListener {
final List<MonitorDevice> monitors = getMonitorDevices();
for(int i=monitors.size()-1; i>=0; i--) {
final MonitorDeviceImpl monitor = (MonitorDeviceImpl) monitors.get(i);
- final boolean viewportUpdated = updateNativeMonitorDeviceViewportImpl(monitor, monitor.getMutuableViewportPU(), monitor.getMutuableViewportWU());
+ final float[] pixelScale = monitor.getPixelScale(new float[2]);
+ final boolean viewportUpdated = updateNativeMonitorDeviceViewportImpl(monitor, pixelScale,
+ monitor.getMutuableViewportPU(),
+ monitor.getMutuableViewportWU());
if( DEBUG ) {
- System.err.println("Screen.updateMonitorViewport["+i+"] @ "+Thread.currentThread().getName()+": updated: "+viewportUpdated+", PU "+monitor.getViewport()+", WU "+monitor.getViewportInWindowUnits());
+ System.err.println("Screen.updateMonitorViewport["+i+"] @ "+Thread.currentThread().getName()+": updated: "+viewportUpdated+
+ ", PU "+monitor.getViewport()+", WU "+monitor.getViewportInWindowUnits()+
+ ", pixelScale ["+pixelScale[0]+", "+pixelScale[1]+"]");
}
}
}
@@ -510,7 +516,7 @@ public abstract class ScreenImpl extends Screen implements MonitorModeListener {
if( MonitorModeProps.MIN_MONITOR_DEVICE_PROPERTIES != i ) {
throw new InternalError("XX");
}
- return MonitorModeProps.streamInMonitorDevice(null, cache, this, props, 0);
+ return MonitorModeProps.streamInMonitorDevice(cache, this, null, props, 0, null);
}
/**
diff --git a/src/newt/classes/jogamp/newt/WindowImpl.java b/src/newt/classes/jogamp/newt/WindowImpl.java
index b62628962..49fa1da4b 100644
--- a/src/newt/classes/jogamp/newt/WindowImpl.java
+++ b/src/newt/classes/jogamp/newt/WindowImpl.java
@@ -39,30 +39,31 @@ import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.List;
-import javax.media.nativewindow.AbstractGraphicsConfiguration;
-import javax.media.nativewindow.AbstractGraphicsDevice;
-import javax.media.nativewindow.CapabilitiesChooser;
-import javax.media.nativewindow.CapabilitiesImmutable;
-import javax.media.nativewindow.NativeSurface;
-import javax.media.nativewindow.NativeWindow;
-import javax.media.nativewindow.NativeWindowException;
-import javax.media.nativewindow.NativeWindowFactory;
-import javax.media.nativewindow.OffscreenLayerSurface;
-import javax.media.nativewindow.ScalableSurface;
-import javax.media.nativewindow.SurfaceUpdatedListener;
-import javax.media.nativewindow.WindowClosingProtocol;
-import javax.media.nativewindow.util.DimensionImmutable;
-import javax.media.nativewindow.util.Insets;
-import javax.media.nativewindow.util.InsetsImmutable;
-import javax.media.nativewindow.util.PixelRectangle;
-import javax.media.nativewindow.util.Point;
-import javax.media.nativewindow.util.PointImmutable;
-import javax.media.nativewindow.util.Rectangle;
-import javax.media.nativewindow.util.RectangleImmutable;
+import com.jogamp.nativewindow.AbstractGraphicsConfiguration;
+import com.jogamp.nativewindow.AbstractGraphicsDevice;
+import com.jogamp.nativewindow.CapabilitiesChooser;
+import com.jogamp.nativewindow.CapabilitiesImmutable;
+import com.jogamp.nativewindow.NativeSurface;
+import com.jogamp.nativewindow.NativeWindow;
+import com.jogamp.nativewindow.NativeWindowException;
+import com.jogamp.nativewindow.NativeWindowFactory;
+import com.jogamp.nativewindow.OffscreenLayerSurface;
+import com.jogamp.nativewindow.ScalableSurface;
+import com.jogamp.nativewindow.SurfaceUpdatedListener;
+import com.jogamp.nativewindow.WindowClosingProtocol;
+import com.jogamp.nativewindow.util.DimensionImmutable;
+import com.jogamp.nativewindow.util.Insets;
+import com.jogamp.nativewindow.util.InsetsImmutable;
+import com.jogamp.nativewindow.util.PixelRectangle;
+import com.jogamp.nativewindow.util.Point;
+import com.jogamp.nativewindow.util.PointImmutable;
+import com.jogamp.nativewindow.util.Rectangle;
+import com.jogamp.nativewindow.util.RectangleImmutable;
import jogamp.nativewindow.SurfaceScaleUtils;
import jogamp.nativewindow.SurfaceUpdatedHelper;
+import com.jogamp.common.ExceptionUtils;
import com.jogamp.common.util.ArrayHashSet;
import com.jogamp.common.util.IntBitfield;
import com.jogamp.common.util.PropertyAccess;
@@ -153,9 +154,10 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
private volatile boolean hasFocus = false;
private volatile int pixWidth = 128, pixHeight = 128; // client-area size w/o insets in pixel units, default: may be overwritten by user
private volatile int winWidth = 128, winHeight = 128; // client-area size w/o insets in window units, default: may be overwritten by user
- protected final int[] nativePixelScale = new int[] { ScalableSurface.IDENTITY_PIXELSCALE, ScalableSurface.IDENTITY_PIXELSCALE };
- protected final int[] hasPixelScale = new int[] { ScalableSurface.IDENTITY_PIXELSCALE, ScalableSurface.IDENTITY_PIXELSCALE };
- protected final int[] reqPixelScale = new int[] { ScalableSurface.AUTOMAX_PIXELSCALE, ScalableSurface.AUTOMAX_PIXELSCALE };
+ protected final float[] minPixelScale = new float[] { ScalableSurface.IDENTITY_PIXELSCALE, ScalableSurface.IDENTITY_PIXELSCALE };
+ protected final float[] maxPixelScale = new float[] { ScalableSurface.IDENTITY_PIXELSCALE, ScalableSurface.IDENTITY_PIXELSCALE };
+ protected final float[] hasPixelScale = new float[] { ScalableSurface.IDENTITY_PIXELSCALE, ScalableSurface.IDENTITY_PIXELSCALE };
+ protected final float[] reqPixelScale = new float[] { ScalableSurface.AUTOMAX_PIXELSCALE, ScalableSurface.AUTOMAX_PIXELSCALE };
private volatile int x = 64, y = 64; // client-area pos w/o insets in window units
private volatile Insets insets = new Insets(); // insets of decoration (if top-level && decorated)
@@ -722,7 +724,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
* </p>
* <p>
* May return <code>null</code>, in which case the caller shall traverse through the NativeWindow tree
- * as demonstrated in {@link #getLocationOnScreen(javax.media.nativewindow.util.Point)}.
+ * as demonstrated in {@link #getLocationOnScreen(com.jogamp.nativewindow.util.Point)}.
* </p>
*
* @return if not null, the screen location of the given coordinates
@@ -1086,8 +1088,8 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
}
@Override
public final void setSurfaceSize(final int pixelWidth, final int pixelHeight) {
- // FIXME HiDPI: Shortcut, may need to adjust if we change scaling methodology
- setSize(pixelWidth / getPixelScaleX(), pixelHeight / getPixelScaleY());
+ setSize( SurfaceScaleUtils.scaleInv(pixelWidth, getPixelScaleX()),
+ SurfaceScaleUtils.scaleInv(pixelHeight, getPixelScaleY()) );
}
@Override
public final void setTopLevelSize(final int width, final int height) {
@@ -1180,8 +1182,10 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
parentWindowHandle = 0;
hasPixelScale[0] = ScalableSurface.IDENTITY_PIXELSCALE;
hasPixelScale[1] = ScalableSurface.IDENTITY_PIXELSCALE;
- nativePixelScale[0] = ScalableSurface.IDENTITY_PIXELSCALE;
- nativePixelScale[1] = ScalableSurface.IDENTITY_PIXELSCALE;
+ minPixelScale[0] = ScalableSurface.IDENTITY_PIXELSCALE;
+ minPixelScale[1] = ScalableSurface.IDENTITY_PIXELSCALE;
+ maxPixelScale[0] = ScalableSurface.IDENTITY_PIXELSCALE;
+ maxPixelScale[1] = ScalableSurface.IDENTITY_PIXELSCALE;
_lock.unlock();
}
@@ -1925,16 +1929,12 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
@Override
public final int[] convertToWindowUnits(final int[] pixelUnitsAndResult) {
- pixelUnitsAndResult[0] /= getPixelScaleX();
- pixelUnitsAndResult[1] /= getPixelScaleY();
- return pixelUnitsAndResult;
+ return SurfaceScaleUtils.scaleInv(pixelUnitsAndResult, pixelUnitsAndResult, hasPixelScale);
}
@Override
public final int[] convertToPixelUnits(final int[] windowUnitsAndResult) {
- windowUnitsAndResult[0] *= getPixelScaleX();
- windowUnitsAndResult[1] *= getPixelScaleY();
- return windowUnitsAndResult;
+ return SurfaceScaleUtils.scale(windowUnitsAndResult, windowUnitsAndResult, hasPixelScale);
}
protected final Point convertToWindowUnits(final Point pixelUnitsAndResult) {
@@ -1946,43 +1946,50 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
}
/** HiDPI: We currently base scaling of window units to pixel units on an integer scale factor per component. */
- protected final int getPixelScaleX() {
+ protected final float getPixelScaleX() {
return hasPixelScale[0];
}
/** HiDPI: We currently base scaling of window units to pixel units on an integer scale factor per component. */
- protected final int getPixelScaleY() {
+ protected final float getPixelScaleY() {
return hasPixelScale[1];
}
@Override
- public void setSurfaceScale(final int[] pixelScale) {
- SurfaceScaleUtils.validateReqPixelScale(reqPixelScale, pixelScale, DEBUG_IMPLEMENTATION ? getClass().getSimpleName() : null);
+ public boolean setSurfaceScale(final float[] pixelScale) {
+ System.arraycopy(pixelScale, 0, reqPixelScale, 0, 2);
+ return false;
}
@Override
- public final int[] getRequestedSurfaceScale(final int[] result) {
+ public final float[] getRequestedSurfaceScale(final float[] result) {
System.arraycopy(reqPixelScale, 0, result, 0, 2);
return result;
}
@Override
- public final int[] getCurrentSurfaceScale(final int[] result) {
+ public final float[] getCurrentSurfaceScale(final float[] result) {
System.arraycopy(hasPixelScale, 0, result, 0, 2);
return result;
}
@Override
- public final int[] getNativeSurfaceScale(final int[] result) {
- System.arraycopy(nativePixelScale, 0, result, 0, 2);
+ public final float[] getMinimumSurfaceScale(final float[] result) {
+ System.arraycopy(minPixelScale, 0, result, 0, 2);
+ return result;
+ }
+
+ @Override
+ public final float[] getMaximumSurfaceScale(final float[] result) {
+ System.arraycopy(maxPixelScale, 0, result, 0, 2);
return result;
}
@Override
public final float[] getPixelsPerMM(final float[] ppmmStore) {
getMainMonitor().getPixelsPerMM(ppmmStore);
- ppmmStore[0] *= (float)hasPixelScale[0] / (float)nativePixelScale[0];
- ppmmStore[1] *= (float)hasPixelScale[1] / (float)nativePixelScale[1];
+ ppmmStore[0] *= hasPixelScale[0] / maxPixelScale[0];
+ ppmmStore[1] *= hasPixelScale[1] / maxPixelScale[1];
return ppmmStore;
}
@@ -1992,7 +1999,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
protected final void definePosition(final int x, final int y) {
if(DEBUG_IMPLEMENTATION) {
System.err.println("definePosition: "+this.x+"/"+this.y+" -> "+x+"/"+y);
- // Thread.dumpStack();
+ // ExceptionUtils.dumpStackTrace(System.err);
}
autoPosition = false;
this.x = x; this.y = y;
@@ -2003,12 +2010,13 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
* and {@link #pixWidth} and {@link #pixHeight} in pixel units according to {@link #convertToPixelUnits(int[])}.
*/
protected final void defineSize(final int winWidth, final int winHeight) {
- final int pixWidth = winWidth * getPixelScaleX(); // FIXME HiDPI: Shortcut, may need to adjust if we change scaling methodology
- final int pixHeight = winHeight * getPixelScaleY();
+ final int pixWidth = SurfaceScaleUtils.scale(winWidth, getPixelScaleX()); // FIXME HiDPI: Shortcut, may need to adjust if we change scaling methodology
+ final int pixHeight = SurfaceScaleUtils.scale(winHeight, getPixelScaleY());
+
if(DEBUG_IMPLEMENTATION) {
System.err.println("defineSize: win["+this.winWidth+"x"+this.winHeight+" -> "+winWidth+"x"+winHeight+
"], pixel["+this.pixWidth+"x"+this.pixHeight+" -> "+pixWidth+"x"+pixHeight+"]");
- // Thread.dumpStack();
+ // ExceptionUtils.dumpStackTrace(System.err);
}
this.winWidth = winWidth; this.winHeight = winHeight;
this.pixWidth = pixWidth; this.pixHeight = pixHeight;
@@ -2630,14 +2638,14 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
// special repaint treatment
case WindowEvent.EVENT_WINDOW_REPAINT:
// queue repaint event in case window is locked, ie in operation
- if( null != windowLock.getOwner() ) {
+ if( windowLock.isLockedByOtherThread() ) {
// make sure only one repaint event is queued
if(!repaintQueued) {
repaintQueued=true;
final boolean discardTO = QUEUED_EVENT_TO <= System.currentTimeMillis()-e.getWhen();
if(DEBUG_IMPLEMENTATION) {
- System.err.println("Window.consumeEvent: REPAINT "+Thread.currentThread().getName()+" - queued "+e+", discard-to "+discardTO);
- // Thread.dumpStack();
+ System.err.println("Window.consumeEvent: REPAINT [me "+Thread.currentThread().getName()+", owner "+windowLock.getOwner()+"] - queued "+e+", discard-to "+discardTO);
+ // ExceptionUtils.dumpStackTrace(System.err);
}
return discardTO; // discardTO:=true -> consumed
}
@@ -2649,11 +2657,11 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
// common treatment
case WindowEvent.EVENT_WINDOW_RESIZED:
// queue event in case window is locked, ie in operation
- if( null != windowLock.getOwner() ) {
+ if( windowLock.isLockedByOtherThread() ) {
final boolean discardTO = QUEUED_EVENT_TO <= System.currentTimeMillis()-e.getWhen();
if(DEBUG_IMPLEMENTATION) {
- System.err.println("Window.consumeEvent: RESIZED "+Thread.currentThread().getName()+" - queued "+e+", discard-to "+discardTO);
- // Thread.dumpStack();
+ System.err.println("Window.consumeEvent: RESIZED [me "+Thread.currentThread().getName()+", owner "+windowLock.getOwner()+"] - queued "+e+", discard-to "+discardTO);
+ // ExceptionUtils.dumpStackTrace(System.err);
}
return discardTO; // discardTO:=true -> consumed
}
@@ -3745,7 +3753,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
throw new NativeWindowException(msg);
} else if (DEBUG_IMPLEMENTATION) {
System.err.println(msg);
- Thread.dumpStack();
+ ExceptionUtils.dumpStack(System.err);
}
return -1;
} else if( 0 < remaining ){
@@ -3755,6 +3763,21 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
}
}
+ /**
+ * Notify to update the pixel-scale values.
+ * @param minPixelScale
+ * @param maxPixelScale
+ * @param reset if {@code true} {@link #setSurfaceScale(float[]) reset pixel-scale} w/ {@link #getRequestedSurfaceScale(float[]) requested values}
+ * value to reflect the new minimum and maximum values.
+ */
+ public final void pixelScaleChangeNotify(final float[] minPixelScale, final float[] maxPixelScale, final boolean reset) {
+ System.arraycopy(minPixelScale, 0, this.minPixelScale, 0, 2);
+ System.arraycopy(maxPixelScale, 0, this.maxPixelScale, 0, 2);
+ if( reset ) {
+ setSurfaceScale(reqPixelScale);
+ }
+ }
+
/** Triggered by implementation's WM events to update the client-area size in window units w/o insets/decorations. */
protected void sizeChanged(final boolean defer, final int newWidth, final int newHeight, final boolean force) {
if(force || getWidth() != newWidth || getHeight() != newHeight) {
@@ -3791,7 +3814,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
throw new NativeWindowException(msg);
} else if (DEBUG_IMPLEMENTATION) {
System.err.println(msg);
- Thread.dumpStack();
+ ExceptionUtils.dumpStack(System.err);
}
return false;
} else {
@@ -3851,7 +3874,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
} else {
System.err.println("Auto position not reached within timeout, has "+getX()+"/"+getY()+", autoPosition "+autoPosition+", remaining "+remaining);
}
- Thread.dumpStack();
+ ExceptionUtils.dumpStack(System.err);
}
}
return ok;
@@ -3892,7 +3915,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
final WindowClosingMode mode = force ? WindowClosingMode.DISPOSE_ON_CLOSE : defMode;
if(DEBUG_IMPLEMENTATION) {
System.err.println("Window.windowDestroyNotify(isNativeValid: "+isNativeValid()+", force: "+force+", mode "+defMode+" -> "+mode+") "+getThreadName()+": "+this);
- // Thread.dumpStack();
+ // ExceptionUtils.dumpStackTrace(System.err);
}
final boolean destroyed;
diff --git a/src/newt/classes/jogamp/newt/awt/NewtFactoryAWT.java b/src/newt/classes/jogamp/newt/awt/NewtFactoryAWT.java
index 682313ef4..23e9c4370 100644
--- a/src/newt/classes/jogamp/newt/awt/NewtFactoryAWT.java
+++ b/src/newt/classes/jogamp/newt/awt/NewtFactoryAWT.java
@@ -28,11 +28,11 @@
package jogamp.newt.awt;
-import javax.media.nativewindow.AbstractGraphicsConfiguration;
-import javax.media.nativewindow.CapabilitiesImmutable;
-import javax.media.nativewindow.NativeWindow;
-import javax.media.nativewindow.NativeWindowException;
-import javax.media.nativewindow.NativeWindowFactory;
+import com.jogamp.nativewindow.AbstractGraphicsConfiguration;
+import com.jogamp.nativewindow.CapabilitiesImmutable;
+import com.jogamp.nativewindow.NativeWindow;
+import com.jogamp.nativewindow.NativeWindowException;
+import com.jogamp.nativewindow.NativeWindowFactory;
import jogamp.newt.Debug;
@@ -44,8 +44,8 @@ public class NewtFactoryAWT extends NewtFactory {
public static final boolean DEBUG_IMPLEMENTATION = Debug.debug("Window");
/**
- * Wraps an AWT component into a {@link javax.media.nativewindow.NativeWindow} utilizing the {@link javax.media.nativewindow.NativeWindowFactory},<br>
- * using a configuration agnostic dummy {@link javax.media.nativewindow.DefaultGraphicsConfiguration}.<br>
+ * Wraps an AWT component into a {@link com.jogamp.nativewindow.NativeWindow} utilizing the {@link com.jogamp.nativewindow.NativeWindowFactory},<br>
+ * using a configuration agnostic dummy {@link com.jogamp.nativewindow.DefaultGraphicsConfiguration}.<br>
* <p>
* The actual wrapping implementation is {@link com.jogamp.nativewindow.awt.JAWTWindow}.<br></p>
* <p>
diff --git a/src/newt/classes/jogamp/newt/awt/event/AWTNewtEventFactory.java b/src/newt/classes/jogamp/newt/awt/event/AWTNewtEventFactory.java
index 31ee92ca4..86f0ba20e 100644
--- a/src/newt/classes/jogamp/newt/awt/event/AWTNewtEventFactory.java
+++ b/src/newt/classes/jogamp/newt/awt/event/AWTNewtEventFactory.java
@@ -28,8 +28,8 @@
package jogamp.newt.awt.event;
-import javax.media.nativewindow.NativeSurface;
-import javax.media.nativewindow.NativeSurfaceHolder;
+import com.jogamp.nativewindow.NativeSurface;
+import com.jogamp.nativewindow.NativeSurfaceHolder;
import com.jogamp.newt.event.MouseEvent;
diff --git a/src/newt/classes/jogamp/newt/awt/event/AWTParentWindowAdapter.java b/src/newt/classes/jogamp/newt/awt/event/AWTParentWindowAdapter.java
index 93cdd7e56..1cd4f654e 100644
--- a/src/newt/classes/jogamp/newt/awt/event/AWTParentWindowAdapter.java
+++ b/src/newt/classes/jogamp/newt/awt/event/AWTParentWindowAdapter.java
@@ -30,7 +30,7 @@ package jogamp.newt.awt.event;
import java.awt.KeyboardFocusManager;
-import javax.media.nativewindow.NativeWindow;
+import com.jogamp.nativewindow.NativeWindow;
import jogamp.newt.driver.DriverUpdatePosition;
diff --git a/src/newt/classes/jogamp/newt/driver/android/DisplayDriver.java b/src/newt/classes/jogamp/newt/driver/android/DisplayDriver.java
index a5f4fc769..216dccb2b 100644
--- a/src/newt/classes/jogamp/newt/driver/android/DisplayDriver.java
+++ b/src/newt/classes/jogamp/newt/driver/android/DisplayDriver.java
@@ -31,7 +31,9 @@ package jogamp.newt.driver.android;
import jogamp.newt.*;
import jogamp.opengl.egl.*;
-import javax.media.nativewindow.*;
+import com.jogamp.nativewindow.*;
+
+import com.jogamp.opengl.egl.EGL;
public class DisplayDriver extends jogamp.newt.DisplayImpl {
static {
diff --git a/src/newt/classes/jogamp/newt/driver/android/NewtBaseActivity.java b/src/newt/classes/jogamp/newt/driver/android/NewtBaseActivity.java
index 68d43ac75..486257ee9 100644
--- a/src/newt/classes/jogamp/newt/driver/android/NewtBaseActivity.java
+++ b/src/newt/classes/jogamp/newt/driver/android/NewtBaseActivity.java
@@ -30,10 +30,10 @@ package jogamp.newt.driver.android;
import java.util.ArrayList;
import java.util.List;
-import javax.media.nativewindow.CapabilitiesImmutable;
-import javax.media.opengl.FPSCounter;
-import javax.media.opengl.GLAnimatorControl;
-import javax.media.opengl.GLAutoDrawable;
+import com.jogamp.nativewindow.CapabilitiesImmutable;
+import com.jogamp.opengl.FPSCounter;
+import com.jogamp.opengl.GLAnimatorControl;
+import com.jogamp.opengl.GLAutoDrawable;
import com.jogamp.newt.Window;
import com.jogamp.opengl.GLEventListenerState;
diff --git a/src/newt/classes/jogamp/newt/driver/android/NewtVersionActivity.java b/src/newt/classes/jogamp/newt/driver/android/NewtVersionActivity.java
index 4dd96c9a0..e9b4e494c 100644
--- a/src/newt/classes/jogamp/newt/driver/android/NewtVersionActivity.java
+++ b/src/newt/classes/jogamp/newt/driver/android/NewtVersionActivity.java
@@ -27,11 +27,11 @@
*/
package jogamp.newt.driver.android;
-import javax.media.opengl.GL;
-import javax.media.opengl.GLAutoDrawable;
-import javax.media.opengl.GLCapabilities;
-import javax.media.opengl.GLEventListener;
-import javax.media.opengl.GLProfile;
+import com.jogamp.opengl.GL;
+import com.jogamp.opengl.GLAutoDrawable;
+import com.jogamp.opengl.GLCapabilities;
+import com.jogamp.opengl.GLEventListener;
+import com.jogamp.opengl.GLProfile;
import jogamp.common.os.PlatformPropsImpl;
diff --git a/src/newt/classes/jogamp/newt/driver/android/NewtVersionActivityLauncher.java b/src/newt/classes/jogamp/newt/driver/android/NewtVersionActivityLauncher.java
index 190f55e71..2aecb54b9 100644
--- a/src/newt/classes/jogamp/newt/driver/android/NewtVersionActivityLauncher.java
+++ b/src/newt/classes/jogamp/newt/driver/android/NewtVersionActivityLauncher.java
@@ -11,7 +11,7 @@ public class NewtVersionActivityLauncher extends Activity {
public void onCreate(final Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
- final Uri uri = Uri.parse("launch://jogamp.org/jogamp.newt.driver.android.NewtVersionActivity?sys=com.jogamp.common&sys=javax.media.opengl&pkg=com.jogamp.opengl.test&jogamp.debug=all&nativewindow.debug=all&jogl.debug=all&newt.debug=all");
+ final Uri uri = Uri.parse("launch://jogamp.org/jogamp.newt.driver.android.NewtVersionActivity?sys=com.jogamp.common&sys=com.jogamp.opengl&pkg=com.jogamp.opengl.test&jogamp.debug=all&nativewindow.debug=all&jogl.debug=all&newt.debug=all");
final Intent intent = new Intent("org.jogamp.launcher.action.LAUNCH_ACTIVITY_NORMAL", uri);
Log.d(getClass().getSimpleName(), "Launching Activity: "+intent);
startActivity (intent);
diff --git a/src/newt/classes/jogamp/newt/driver/android/ScreenDriver.java b/src/newt/classes/jogamp/newt/driver/android/ScreenDriver.java
index b28cdcbed..273ff2b45 100644
--- a/src/newt/classes/jogamp/newt/driver/android/ScreenDriver.java
+++ b/src/newt/classes/jogamp/newt/driver/android/ScreenDriver.java
@@ -28,7 +28,7 @@
package jogamp.newt.driver.android;
-import javax.media.nativewindow.DefaultGraphicsScreen;
+import com.jogamp.nativewindow.DefaultGraphicsScreen;
import jogamp.newt.MonitorModeProps;
import jogamp.newt.MonitorModeProps.Cache;
@@ -113,7 +113,7 @@ public class ScreenDriver extends jogamp.newt.ScreenImpl {
props[i++] = 0; // rotated viewport y window-units
props[i++] = outMetrics.widthPixels; // rotated viewport width window-units
props[i++] = outMetrics.heightPixels; // rotated viewport height window-units
- MonitorModeProps.streamInMonitorDevice(null, cache, this, cache.monitorModes, currentMode, props, 0);
+ MonitorModeProps.streamInMonitorDevice(cache, this, currentMode, null, cache.monitorModes, props, 0, null);
}
@Override
diff --git a/src/newt/classes/jogamp/newt/driver/android/WindowDriver.java b/src/newt/classes/jogamp/newt/driver/android/WindowDriver.java
index 786ebb31c..1cee1b45d 100644
--- a/src/newt/classes/jogamp/newt/driver/android/WindowDriver.java
+++ b/src/newt/classes/jogamp/newt/driver/android/WindowDriver.java
@@ -33,26 +33,27 @@ import jogamp.newt.WindowImpl;
import jogamp.newt.driver.android.event.AndroidNewtEventFactory;
import jogamp.newt.driver.android.event.AndroidNewtEventTranslator;
-import javax.media.nativewindow.AbstractGraphicsScreen;
-import javax.media.nativewindow.Capabilities;
-import javax.media.nativewindow.CapabilitiesImmutable;
-import javax.media.nativewindow.DefaultGraphicsScreen;
-import javax.media.nativewindow.NativeWindowException;
-import javax.media.nativewindow.VisualIDHolder;
-import javax.media.nativewindow.util.Insets;
-import javax.media.nativewindow.util.Point;
-import javax.media.nativewindow.util.Rectangle;
-import javax.media.nativewindow.util.RectangleImmutable;
-import javax.media.opengl.GLCapabilitiesChooser;
-import javax.media.opengl.GLCapabilitiesImmutable;
-import javax.media.opengl.GLException;
-
+import com.jogamp.nativewindow.AbstractGraphicsScreen;
+import com.jogamp.nativewindow.Capabilities;
+import com.jogamp.nativewindow.CapabilitiesImmutable;
+import com.jogamp.nativewindow.DefaultGraphicsScreen;
+import com.jogamp.nativewindow.NativeWindowException;
+import com.jogamp.nativewindow.VisualIDHolder;
+import com.jogamp.nativewindow.util.Insets;
+import com.jogamp.nativewindow.util.Point;
+import com.jogamp.nativewindow.util.Rectangle;
+import com.jogamp.nativewindow.util.RectangleImmutable;
+import com.jogamp.opengl.GLCapabilitiesChooser;
+import com.jogamp.opengl.GLCapabilitiesImmutable;
+import com.jogamp.opengl.GLException;
+
+import com.jogamp.common.ExceptionUtils;
import com.jogamp.common.os.AndroidVersion;
import com.jogamp.nativewindow.egl.EGLGraphicsDevice;
import com.jogamp.newt.MonitorDevice;
import com.jogamp.newt.Window;
+import com.jogamp.opengl.egl.EGL;
-import jogamp.opengl.egl.EGL;
import jogamp.opengl.egl.EGLDisplayUtil;
import jogamp.opengl.egl.EGLGraphicsConfiguration;
import jogamp.opengl.egl.EGLGraphicsConfigurationFactory;
@@ -282,7 +283,7 @@ public class WindowDriver extends jogamp.newt.WindowImpl implements Callback2 {
protected final boolean canCreateNativeImpl() {
Log.d(MD.TAG, "canCreateNativeImpl.0: surfaceHandle ready "+(0!=surfaceHandle)+" - on thread "+Thread.currentThread().getName());
if(Window.DEBUG_IMPLEMENTATION) {
- Thread.dumpStack();
+ ExceptionUtils.dumpStack(System.err);
}
if( isFullscreen() ) {
@@ -386,7 +387,7 @@ public class WindowDriver extends jogamp.newt.WindowImpl implements Callback2 {
"], pixel["+getSurfaceWidth()+"x"+getSurfaceHeight()+"],"+
" - on thread "+Thread.currentThread().getName());
if(Window.DEBUG_IMPLEMENTATION) {
- Thread.dumpStack();
+ ExceptionUtils.dumpStack(System.err);
}
setupInputListener(false);
@@ -557,7 +558,7 @@ public class WindowDriver extends jogamp.newt.WindowImpl implements Callback2 {
public final void surfaceChanged(final SurfaceHolder aHolder, final int aFormat, final int aWidth, final int aHeight) {
Log.d(MD.TAG, "surfaceChanged: f "+nativeFormat+" -> "+aFormat+", "+aWidth+"x"+aHeight+", current surfaceHandle: 0x"+Long.toHexString(surfaceHandle)+" - on thread "+Thread.currentThread().getName());
if(Window.DEBUG_IMPLEMENTATION) {
- Thread.dumpStack();
+ ExceptionUtils.dumpStack(System.err);
}
if(0!=surfaceHandle && androidFormat != aFormat ) {
// re-create
@@ -611,7 +612,7 @@ public class WindowDriver extends jogamp.newt.WindowImpl implements Callback2 {
public final void surfaceDestroyed(final SurfaceHolder holder) {
Log.d(MD.TAG, "surfaceDestroyed - on thread "+Thread.currentThread().getName());
windowDestroyNotify(true); // actually too late .. however ..
- Thread.dumpStack();
+ ExceptionUtils.dumpStack(System.err);
}
@Override
diff --git a/src/newt/classes/jogamp/newt/driver/awt/AWTCanvas.java b/src/newt/classes/jogamp/newt/driver/awt/AWTCanvas.java
index eccdd63cf..40e3bf85a 100644
--- a/src/newt/classes/jogamp/newt/driver/awt/AWTCanvas.java
+++ b/src/newt/classes/jogamp/newt/driver/awt/AWTCanvas.java
@@ -42,15 +42,15 @@ import java.lang.reflect.Method;
import java.security.AccessController;
import java.security.PrivilegedAction;
-import javax.media.nativewindow.AbstractGraphicsDevice;
-import javax.media.nativewindow.AbstractGraphicsScreen;
-import javax.media.nativewindow.CapabilitiesChooser;
-import javax.media.nativewindow.CapabilitiesImmutable;
-import javax.media.nativewindow.GraphicsConfigurationFactory;
-import javax.media.nativewindow.NativeWindow;
-import javax.media.nativewindow.NativeWindowException;
-import javax.media.nativewindow.NativeWindowFactory;
-import javax.media.nativewindow.VisualIDHolder;
+import com.jogamp.nativewindow.AbstractGraphicsDevice;
+import com.jogamp.nativewindow.AbstractGraphicsScreen;
+import com.jogamp.nativewindow.CapabilitiesChooser;
+import com.jogamp.nativewindow.CapabilitiesImmutable;
+import com.jogamp.nativewindow.GraphicsConfigurationFactory;
+import com.jogamp.nativewindow.NativeWindow;
+import com.jogamp.nativewindow.NativeWindowException;
+import com.jogamp.nativewindow.NativeWindowFactory;
+import com.jogamp.nativewindow.VisualIDHolder;
import com.jogamp.nativewindow.awt.AWTGraphicsConfiguration;
import com.jogamp.nativewindow.awt.AWTGraphicsDevice;
@@ -69,8 +69,8 @@ public class AWTCanvas extends Canvas {
private final UpstreamScalable upstreamScale;
public static interface UpstreamScalable {
- int[] getReqPixelScale();
- void setHasPixelScale(final int[] pixelScale);
+ float[] getReqPixelScale();
+ void setHasPixelScale(final float[] pixelScale);
}
private boolean displayConfigChanged=false;
@@ -148,7 +148,7 @@ public class AWTCanvas extends Canvas {
// trigger initialization cycle
jawtWindow.setSurfaceScale(upstreamScale.getReqPixelScale() );
jawtWindow.lockSurface();
- upstreamScale.setHasPixelScale(jawtWindow.getCurrentSurfaceScale(new int[2]));
+ upstreamScale.setHasPixelScale(jawtWindow.getCurrentSurfaceScale(new float[2]));
jawtWindow.unlockSurface();
}
diff --git a/src/newt/classes/jogamp/newt/driver/awt/AWTEDTUtil.java b/src/newt/classes/jogamp/newt/driver/awt/AWTEDTUtil.java
index 39e68e48c..9d3121635 100644
--- a/src/newt/classes/jogamp/newt/driver/awt/AWTEDTUtil.java
+++ b/src/newt/classes/jogamp/newt/driver/awt/AWTEDTUtil.java
@@ -30,8 +30,9 @@ package jogamp.newt.driver.awt;
import java.awt.EventQueue;
-import javax.media.nativewindow.NativeWindowException;
+import com.jogamp.nativewindow.NativeWindowException;
+import com.jogamp.common.ExceptionUtils;
import com.jogamp.common.util.RunnableTask;
import com.jogamp.common.util.awt.AWTEDTExecutor;
import com.jogamp.newt.util.EDTUtil;
@@ -140,7 +141,7 @@ public class AWTEDTUtil implements EDTUtil {
// drop task ..
System.err.println(Thread.currentThread()+": Warning: AWT-EDT about (1) to stop, won't enqueue new task: "+nedt);
if(DEBUG) {
- Thread.dumpStack();
+ ExceptionUtils.dumpStack(System.err);
}
return false;
}
@@ -161,7 +162,7 @@ public class AWTEDTUtil implements EDTUtil {
System.err.println(Thread.currentThread()+": Warning: AWT-EDT is not running, dropping task. NEDT "+nedt);
}
if(DEBUG) {
- Thread.dumpStack();
+ ExceptionUtils.dumpStack(System.err);
}
}
return false;
diff --git a/src/newt/classes/jogamp/newt/driver/awt/DisplayDriver.java b/src/newt/classes/jogamp/newt/driver/awt/DisplayDriver.java
index 23da69dba..f0e481471 100644
--- a/src/newt/classes/jogamp/newt/driver/awt/DisplayDriver.java
+++ b/src/newt/classes/jogamp/newt/driver/awt/DisplayDriver.java
@@ -34,7 +34,7 @@
package jogamp.newt.driver.awt;
-import javax.media.nativewindow.AbstractGraphicsDevice;
+import com.jogamp.nativewindow.AbstractGraphicsDevice;
import com.jogamp.nativewindow.awt.AWTGraphicsDevice;
import com.jogamp.newt.NewtFactory;
diff --git a/src/newt/classes/jogamp/newt/driver/awt/ScreenDriver.java b/src/newt/classes/jogamp/newt/driver/awt/ScreenDriver.java
index 57948cfc3..eb92e0d13 100644
--- a/src/newt/classes/jogamp/newt/driver/awt/ScreenDriver.java
+++ b/src/newt/classes/jogamp/newt/driver/awt/ScreenDriver.java
@@ -119,7 +119,7 @@ public class ScreenDriver extends ScreenImpl {
props[i++] = 0; // rotated viewport y window-units
props[i++] = currentMode.getRotatedWidth(); // rotated viewport width window-units
props[i++] = currentMode.getRotatedHeight(); // rotated viewport height window-units
- MonitorModeProps.streamInMonitorDevice(null, cache, this, cache.monitorModes, currentMode, props, 0);
+ MonitorModeProps.streamInMonitorDevice(cache, this, currentMode, null, cache.monitorModes, props, 0, null);
}
@Override
diff --git a/src/newt/classes/jogamp/newt/driver/awt/WindowDriver.java b/src/newt/classes/jogamp/newt/driver/awt/WindowDriver.java
index 06dcb8ff5..9f776ef22 100644
--- a/src/newt/classes/jogamp/newt/driver/awt/WindowDriver.java
+++ b/src/newt/classes/jogamp/newt/driver/awt/WindowDriver.java
@@ -40,10 +40,10 @@ import java.awt.Dimension;
import java.awt.Frame;
import java.awt.Insets;
-import javax.media.nativewindow.NativeSurface;
-import javax.media.nativewindow.NativeWindow;
-import javax.media.nativewindow.NativeWindowException;
-import javax.media.nativewindow.util.Point;
+import com.jogamp.nativewindow.NativeSurface;
+import com.jogamp.nativewindow.NativeWindow;
+import com.jogamp.nativewindow.NativeWindowException;
+import com.jogamp.nativewindow.util.Point;
import jogamp.nativewindow.awt.AWTMisc;
import jogamp.newt.WindowImpl;
@@ -100,12 +100,12 @@ public class WindowDriver extends WindowImpl {
private final AWTCanvas.UpstreamScalable upstreamScalable = new AWTCanvas.UpstreamScalable() {
@Override
- public int[] getReqPixelScale() {
+ public float[] getReqPixelScale() {
return WindowDriver.this.reqPixelScale;
}
@Override
- public void setHasPixelScale(final int[] pixelScale) {
+ public void setHasPixelScale(final float[] pixelScale) {
System.arraycopy(pixelScale, 0, WindowDriver.this.hasPixelScale, 0, 2);
}
};
@@ -192,7 +192,7 @@ public class WindowDriver extends WindowImpl {
}
@Override
- protected void updateInsetsImpl(final javax.media.nativewindow.util.Insets insets) {
+ protected void updateInsetsImpl(final com.jogamp.nativewindow.util.Insets insets) {
final Insets contInsets = awtContainer.getInsets();
insets.set(contInsets.left, contInsets.right, contInsets.top, contInsets.bottom);
}
diff --git a/src/newt/classes/jogamp/newt/driver/bcm/egl/DisplayDriver.java b/src/newt/classes/jogamp/newt/driver/bcm/egl/DisplayDriver.java
index ceb337150..cd801e59a 100644
--- a/src/newt/classes/jogamp/newt/driver/bcm/egl/DisplayDriver.java
+++ b/src/newt/classes/jogamp/newt/driver/bcm/egl/DisplayDriver.java
@@ -34,13 +34,13 @@
package jogamp.newt.driver.bcm.egl;
-import javax.media.nativewindow.AbstractGraphicsDevice;
-import javax.media.nativewindow.NativeWindowException;
+import com.jogamp.nativewindow.AbstractGraphicsDevice;
+import com.jogamp.nativewindow.NativeWindowException;
import jogamp.newt.NEWTJNILibLoader;
-import jogamp.opengl.egl.EGL;
import com.jogamp.nativewindow.egl.EGLGraphicsDevice;
+import com.jogamp.opengl.egl.EGL;
public class DisplayDriver extends jogamp.newt.DisplayImpl {
diff --git a/src/newt/classes/jogamp/newt/driver/bcm/egl/ScreenDriver.java b/src/newt/classes/jogamp/newt/driver/bcm/egl/ScreenDriver.java
index 2cd47313a..e65d79e2a 100644
--- a/src/newt/classes/jogamp/newt/driver/bcm/egl/ScreenDriver.java
+++ b/src/newt/classes/jogamp/newt/driver/bcm/egl/ScreenDriver.java
@@ -34,8 +34,8 @@
package jogamp.newt.driver.bcm.egl;
-import javax.media.nativewindow.DefaultGraphicsScreen;
-import javax.media.nativewindow.util.Rectangle;
+import com.jogamp.nativewindow.DefaultGraphicsScreen;
+import com.jogamp.nativewindow.util.Rectangle;
import jogamp.newt.MonitorModeProps;
import jogamp.newt.ScreenImpl;
@@ -94,7 +94,7 @@ public class ScreenDriver extends jogamp.newt.ScreenImpl {
props[i++] = 0; // rotated viewport y window-units
props[i++] = fixedWidth; // FIXME rotated viewport width window-units
props[i++] = fixedHeight; // FIXME rotated viewport height window-units
- MonitorModeProps.streamInMonitorDevice(null, cache, this, cache.monitorModes, currentMode, props, 0);
+ MonitorModeProps.streamInMonitorDevice(cache, this, currentMode, null, cache.monitorModes, props, 0, null);
}
@Override
diff --git a/src/newt/classes/jogamp/newt/driver/bcm/egl/WindowDriver.java b/src/newt/classes/jogamp/newt/driver/bcm/egl/WindowDriver.java
index aec85f875..d737dbf75 100644
--- a/src/newt/classes/jogamp/newt/driver/bcm/egl/WindowDriver.java
+++ b/src/newt/classes/jogamp/newt/driver/bcm/egl/WindowDriver.java
@@ -34,13 +34,13 @@
package jogamp.newt.driver.bcm.egl;
-import javax.media.nativewindow.AbstractGraphicsConfiguration;
-import javax.media.nativewindow.GraphicsConfigurationFactory;
-import javax.media.nativewindow.NativeWindowException;
-import javax.media.nativewindow.VisualIDHolder;
-import javax.media.nativewindow.util.Insets;
-import javax.media.nativewindow.util.Point;
-import javax.media.opengl.GLCapabilitiesImmutable;
+import com.jogamp.nativewindow.AbstractGraphicsConfiguration;
+import com.jogamp.nativewindow.GraphicsConfigurationFactory;
+import com.jogamp.nativewindow.NativeWindowException;
+import com.jogamp.nativewindow.VisualIDHolder;
+import com.jogamp.nativewindow.util.Insets;
+import com.jogamp.nativewindow.util.Point;
+import com.jogamp.opengl.GLCapabilitiesImmutable;
import jogamp.opengl.egl.EGLGraphicsConfiguration;
diff --git a/src/newt/classes/jogamp/newt/driver/bcm/vc/iv/DisplayDriver.java b/src/newt/classes/jogamp/newt/driver/bcm/vc/iv/DisplayDriver.java
index 1b67fa755..3d3fde4d7 100644
--- a/src/newt/classes/jogamp/newt/driver/bcm/vc/iv/DisplayDriver.java
+++ b/src/newt/classes/jogamp/newt/driver/bcm/vc/iv/DisplayDriver.java
@@ -32,19 +32,19 @@ import java.net.URLConnection;
import java.nio.Buffer;
import java.nio.ByteBuffer;
-import javax.media.nativewindow.AbstractGraphicsDevice;
-import javax.media.nativewindow.NativeWindowException;
-import javax.media.nativewindow.util.PixelFormat;
+import com.jogamp.nativewindow.AbstractGraphicsDevice;
+import com.jogamp.nativewindow.NativeWindowException;
+import com.jogamp.nativewindow.util.PixelFormat;
import com.jogamp.common.nio.Buffers;
import com.jogamp.common.util.IOUtil;
+import com.jogamp.opengl.egl.EGL;
import com.jogamp.opengl.util.PNGPixelRect;
import jogamp.newt.DisplayImpl;
import jogamp.newt.NEWTJNILibLoader;
import jogamp.newt.PointerIconImpl;
import jogamp.newt.driver.linux.LinuxMouseTracker;
-import jogamp.opengl.egl.EGL;
import jogamp.opengl.egl.EGLDisplayUtil;
public class DisplayDriver extends DisplayImpl {
diff --git a/src/newt/classes/jogamp/newt/driver/bcm/vc/iv/ScreenDriver.java b/src/newt/classes/jogamp/newt/driver/bcm/vc/iv/ScreenDriver.java
index 64cae75f6..42a63f91e 100644
--- a/src/newt/classes/jogamp/newt/driver/bcm/vc/iv/ScreenDriver.java
+++ b/src/newt/classes/jogamp/newt/driver/bcm/vc/iv/ScreenDriver.java
@@ -28,8 +28,8 @@
package jogamp.newt.driver.bcm.vc.iv;
-import javax.media.nativewindow.DefaultGraphicsScreen;
-import javax.media.nativewindow.util.Rectangle;
+import com.jogamp.nativewindow.DefaultGraphicsScreen;
+import com.jogamp.nativewindow.util.Rectangle;
import com.jogamp.newt.MonitorDevice;
import com.jogamp.newt.MonitorMode;
@@ -87,7 +87,7 @@ public class ScreenDriver extends ScreenImpl {
props[i++] = 0; // rotated viewport y window-units
props[i++] = cachedWidth; // rotated viewport width window-units
props[i++] = cachedWidth; // rotated viewport height window-units
- MonitorModeProps.streamInMonitorDevice(null, cache, this, cache.monitorModes, currentMode, props, 0);
+ MonitorModeProps.streamInMonitorDevice(cache, this, currentMode, null, cache.monitorModes, props, 0, null);
}
@Override
diff --git a/src/newt/classes/jogamp/newt/driver/bcm/vc/iv/WindowDriver.java b/src/newt/classes/jogamp/newt/driver/bcm/vc/iv/WindowDriver.java
index ad6d0b688..29c7f9898 100644
--- a/src/newt/classes/jogamp/newt/driver/bcm/vc/iv/WindowDriver.java
+++ b/src/newt/classes/jogamp/newt/driver/bcm/vc/iv/WindowDriver.java
@@ -28,15 +28,15 @@
package jogamp.newt.driver.bcm.vc.iv;
-import javax.media.nativewindow.AbstractGraphicsConfiguration;
-import javax.media.nativewindow.AbstractGraphicsScreen;
-import javax.media.nativewindow.Capabilities;
-import javax.media.nativewindow.DefaultGraphicsScreen;
-import javax.media.nativewindow.GraphicsConfigurationFactory;
-import javax.media.nativewindow.NativeWindowException;
-import javax.media.nativewindow.VisualIDHolder;
-import javax.media.nativewindow.util.Insets;
-import javax.media.nativewindow.util.Point;
+import com.jogamp.nativewindow.AbstractGraphicsConfiguration;
+import com.jogamp.nativewindow.AbstractGraphicsScreen;
+import com.jogamp.nativewindow.Capabilities;
+import com.jogamp.nativewindow.DefaultGraphicsScreen;
+import com.jogamp.nativewindow.GraphicsConfigurationFactory;
+import com.jogamp.nativewindow.NativeWindowException;
+import com.jogamp.nativewindow.VisualIDHolder;
+import com.jogamp.nativewindow.util.Insets;
+import com.jogamp.nativewindow.util.Point;
import com.jogamp.common.util.IntBitfield;
import com.jogamp.nativewindow.egl.EGLGraphicsDevice;
diff --git a/src/newt/classes/jogamp/newt/driver/intel/gdl/DisplayDriver.java b/src/newt/classes/jogamp/newt/driver/intel/gdl/DisplayDriver.java
index 1d43017c3..33712e35d 100644
--- a/src/newt/classes/jogamp/newt/driver/intel/gdl/DisplayDriver.java
+++ b/src/newt/classes/jogamp/newt/driver/intel/gdl/DisplayDriver.java
@@ -35,7 +35,7 @@
package jogamp.newt.driver.intel.gdl;
import jogamp.newt.*;
-import javax.media.nativewindow.*;
+import com.jogamp.nativewindow.*;
public class DisplayDriver extends jogamp.newt.DisplayImpl {
static int initCounter = 0;
diff --git a/src/newt/classes/jogamp/newt/driver/intel/gdl/ScreenDriver.java b/src/newt/classes/jogamp/newt/driver/intel/gdl/ScreenDriver.java
index 2ce835c52..bd99fd18c 100644
--- a/src/newt/classes/jogamp/newt/driver/intel/gdl/ScreenDriver.java
+++ b/src/newt/classes/jogamp/newt/driver/intel/gdl/ScreenDriver.java
@@ -34,9 +34,9 @@
package jogamp.newt.driver.intel.gdl;
-import javax.media.nativewindow.AbstractGraphicsDevice;
-import javax.media.nativewindow.DefaultGraphicsScreen;
-import javax.media.nativewindow.util.Rectangle;
+import com.jogamp.nativewindow.AbstractGraphicsDevice;
+import com.jogamp.nativewindow.DefaultGraphicsScreen;
+import com.jogamp.nativewindow.util.Rectangle;
import jogamp.newt.MonitorModeProps;
import jogamp.newt.ScreenImpl;
@@ -96,7 +96,7 @@ public class ScreenDriver extends jogamp.newt.ScreenImpl {
props[i++] = 0; // rotated viewport y window-units
props[i++] = cachedWidth; // rotated viewport width window-units
props[i++] = cachedWidth; // rotated viewport height window-units
- MonitorModeProps.streamInMonitorDevice(null, cache, this, cache.monitorModes, currentMode, props, 0);
+ MonitorModeProps.streamInMonitorDevice(cache, this, currentMode, null, cache.monitorModes, props, 0, null);
}
@Override
diff --git a/src/newt/classes/jogamp/newt/driver/intel/gdl/WindowDriver.java b/src/newt/classes/jogamp/newt/driver/intel/gdl/WindowDriver.java
index d7bd17e42..69a8ccd37 100644
--- a/src/newt/classes/jogamp/newt/driver/intel/gdl/WindowDriver.java
+++ b/src/newt/classes/jogamp/newt/driver/intel/gdl/WindowDriver.java
@@ -34,9 +34,9 @@
package jogamp.newt.driver.intel.gdl;
-import javax.media.nativewindow.*;
-import javax.media.nativewindow.util.Insets;
-import javax.media.nativewindow.util.Point;
+import com.jogamp.nativewindow.*;
+import com.jogamp.nativewindow.util.Insets;
+import com.jogamp.nativewindow.util.Point;
public class WindowDriver extends jogamp.newt.WindowImpl {
static {
diff --git a/src/newt/classes/jogamp/newt/driver/kd/DisplayDriver.java b/src/newt/classes/jogamp/newt/driver/kd/DisplayDriver.java
index e72ddbc11..6b28e94df 100644
--- a/src/newt/classes/jogamp/newt/driver/kd/DisplayDriver.java
+++ b/src/newt/classes/jogamp/newt/driver/kd/DisplayDriver.java
@@ -34,12 +34,13 @@
package jogamp.newt.driver.kd;
-import javax.media.nativewindow.AbstractGraphicsDevice;
-import javax.media.nativewindow.NativeWindowException;
+import com.jogamp.nativewindow.AbstractGraphicsDevice;
+import com.jogamp.nativewindow.NativeWindowException;
+
+import com.jogamp.opengl.egl.EGL;
import jogamp.newt.DisplayImpl;
import jogamp.newt.NEWTJNILibLoader;
-import jogamp.opengl.egl.EGL;
import jogamp.opengl.egl.EGLDisplayUtil;
public class DisplayDriver extends DisplayImpl {
diff --git a/src/newt/classes/jogamp/newt/driver/kd/ScreenDriver.java b/src/newt/classes/jogamp/newt/driver/kd/ScreenDriver.java
index d4113561a..975e0f96e 100644
--- a/src/newt/classes/jogamp/newt/driver/kd/ScreenDriver.java
+++ b/src/newt/classes/jogamp/newt/driver/kd/ScreenDriver.java
@@ -34,8 +34,8 @@
package jogamp.newt.driver.kd;
-import javax.media.nativewindow.DefaultGraphicsScreen;
-import javax.media.nativewindow.util.Rectangle;
+import com.jogamp.nativewindow.DefaultGraphicsScreen;
+import com.jogamp.nativewindow.util.Rectangle;
import com.jogamp.newt.MonitorDevice;
import com.jogamp.newt.MonitorMode;
@@ -92,7 +92,7 @@ public class ScreenDriver extends ScreenImpl {
props[i++] = 0; // rotated viewport y window-units
props[i++] = cachedWidth; // rotated viewport width window-units
props[i++] = cachedWidth; // rotated viewport height window-units
- MonitorModeProps.streamInMonitorDevice(null, cache, this, cache.monitorModes, currentMode, props, 0);
+ MonitorModeProps.streamInMonitorDevice(cache, this, currentMode, null, cache.monitorModes, props, 0, null);
}
@Override
diff --git a/src/newt/classes/jogamp/newt/driver/kd/WindowDriver.java b/src/newt/classes/jogamp/newt/driver/kd/WindowDriver.java
index d53ef00cd..01173007c 100644
--- a/src/newt/classes/jogamp/newt/driver/kd/WindowDriver.java
+++ b/src/newt/classes/jogamp/newt/driver/kd/WindowDriver.java
@@ -34,14 +34,14 @@
package jogamp.newt.driver.kd;
-import javax.media.nativewindow.AbstractGraphicsConfiguration;
-import javax.media.nativewindow.GraphicsConfigurationFactory;
-import javax.media.nativewindow.NativeWindowException;
-import javax.media.nativewindow.VisualIDHolder;
-import javax.media.nativewindow.VisualIDHolder.VIDType;
-import javax.media.nativewindow.util.Insets;
-import javax.media.nativewindow.util.Point;
-import javax.media.opengl.GLCapabilitiesImmutable;
+import com.jogamp.nativewindow.AbstractGraphicsConfiguration;
+import com.jogamp.nativewindow.GraphicsConfigurationFactory;
+import com.jogamp.nativewindow.NativeWindowException;
+import com.jogamp.nativewindow.VisualIDHolder;
+import com.jogamp.nativewindow.VisualIDHolder.VIDType;
+import com.jogamp.nativewindow.util.Insets;
+import com.jogamp.nativewindow.util.Point;
+import com.jogamp.opengl.GLCapabilitiesImmutable;
import jogamp.newt.WindowImpl;
import jogamp.opengl.egl.EGLGraphicsConfiguration;
diff --git a/src/newt/classes/jogamp/newt/driver/macosx/DisplayDriver.java b/src/newt/classes/jogamp/newt/driver/macosx/DisplayDriver.java
index 051294dce..c8146b85d 100644
--- a/src/newt/classes/jogamp/newt/driver/macosx/DisplayDriver.java
+++ b/src/newt/classes/jogamp/newt/driver/macosx/DisplayDriver.java
@@ -38,9 +38,9 @@ import java.net.URLConnection;
import java.nio.Buffer;
import java.nio.ByteBuffer;
-import javax.media.nativewindow.AbstractGraphicsDevice;
-import javax.media.nativewindow.NativeWindowException;
-import javax.media.nativewindow.util.PixelFormat;
+import com.jogamp.nativewindow.AbstractGraphicsDevice;
+import com.jogamp.nativewindow.NativeWindowException;
+import com.jogamp.nativewindow.util.PixelFormat;
import com.jogamp.common.nio.Buffers;
import com.jogamp.common.util.IOUtil;
diff --git a/src/newt/classes/jogamp/newt/driver/macosx/ScreenDriver.java b/src/newt/classes/jogamp/newt/driver/macosx/ScreenDriver.java
index 5f458e2c9..f493bdc95 100644
--- a/src/newt/classes/jogamp/newt/driver/macosx/ScreenDriver.java
+++ b/src/newt/classes/jogamp/newt/driver/macosx/ScreenDriver.java
@@ -34,8 +34,8 @@
package jogamp.newt.driver.macosx;
-import javax.media.nativewindow.DefaultGraphicsScreen;
-import javax.media.nativewindow.util.Rectangle;
+import com.jogamp.nativewindow.DefaultGraphicsScreen;
+import com.jogamp.nativewindow.util.Rectangle;
import jogamp.nativewindow.macosx.OSXUtil;
import jogamp.newt.MonitorModeProps;
@@ -77,7 +77,7 @@ public class ScreenDriver extends ScreenImpl {
private class CrtProps {
CrtProps() {
count = getMonitorCount0();
- pixelScaleArray = new int[count];
+ pixelScaleArray = new float[count];
propsOrigArray = new int[count][];
propsFixedArray = new int[count][];
@@ -85,8 +85,8 @@ public class ScreenDriver extends ScreenImpl {
// Gather whole topology of monitors (NSScreens)
//
for(int crtIdx=0; crtIdx<count; crtIdx++) {
- final float pixelScaleRaw = (float) OSXUtil.GetPixelScale(crtIdx);
- pixelScaleArray[crtIdx] = FloatUtil.isZero(pixelScaleRaw, FloatUtil.EPSILON) ? 1 : (int)pixelScaleRaw;
+ final float pixelScaleRaw = (float)OSXUtil.GetPixelScaleByScreenIdx(crtIdx);
+ pixelScaleArray[crtIdx] = FloatUtil.isZero(pixelScaleRaw, FloatUtil.EPSILON) ? 1.0f : pixelScaleRaw;
propsOrigArray[crtIdx] = getMonitorProps0(crtIdx);
if ( null == propsOrigArray[crtIdx] ) {
throw new InternalError("Could not gather device props "+crtIdx+"/"+count);
@@ -105,7 +105,7 @@ public class ScreenDriver extends ScreenImpl {
final int[] thisMonitorProps = propsFixedArray[crtIdx];
final int x = thisMonitorProps[MonitorModeProps.IDX_MONITOR_DEVICE_VIEWPORT+0];
final int y = thisMonitorProps[MonitorModeProps.IDX_MONITOR_DEVICE_VIEWPORT+1];
- final int thisPixelScale = pixelScaleArray[crtIdx];
+ final float thisPixelScale = pixelScaleArray[crtIdx];
thisMonitorProps[MonitorModeProps.IDX_MONITOR_DEVICE_VIEWPORT+2] *= thisPixelScale; // fix width
thisMonitorProps[MonitorModeProps.IDX_MONITOR_DEVICE_VIEWPORT+3] *= thisPixelScale; // fix height
if( 0 != x ) {
@@ -129,7 +129,7 @@ public class ScreenDriver extends ScreenImpl {
}
}
final int count;
- final int[] pixelScaleArray;
+ final float[] pixelScaleArray;
final int[][] propsOrigArray;
final int[][] propsFixedArray;
}
@@ -167,12 +167,15 @@ public class ScreenDriver extends ScreenImpl {
throw new InternalError("Could not gather current mode of device "+crtIdx+"/"+crtProps.count+", but gathered "+modeIdx+" modes");
}
// merge monitor-props + supported modes
- MonitorModeProps.streamInMonitorDevice(null, cache, this, supportedModes, currentMode, crtProps.propsFixedArray[crtIdx], 0);
+ final float pixelScale = crtProps.pixelScaleArray[crtIdx];
+ MonitorModeProps.streamInMonitorDevice(cache, this, currentMode,
+ new float[] { pixelScale, pixelScale },
+ supportedModes, crtProps.propsFixedArray[crtIdx], 0, null);
}
}
@Override
- protected boolean updateNativeMonitorDeviceViewportImpl(final MonitorDevice monitor, final Rectangle viewportPU, final Rectangle viewportWU) {
+ protected boolean updateNativeMonitorDeviceViewportImpl(final MonitorDevice monitor, final float[] pixelScale, final Rectangle viewportPU, final Rectangle viewportWU) {
final CrtProps crtProps = new CrtProps();
final int crtIdx = monitor.getId();
if( 0 > crtIdx || crtIdx >= crtProps.count ) {
@@ -182,6 +185,9 @@ public class ScreenDriver extends ScreenImpl {
int offset = MonitorModeProps.IDX_MONITOR_DEVICE_VIEWPORT;
viewportPU.set(fixedMonitorProps[offset++], fixedMonitorProps[offset++], fixedMonitorProps[offset++], fixedMonitorProps[offset++]);
viewportWU.set(fixedMonitorProps[offset++], fixedMonitorProps[offset++], fixedMonitorProps[offset++], fixedMonitorProps[offset++]);
+ final float _pixelScale = crtProps.pixelScaleArray[crtIdx];
+ pixelScale[0] = _pixelScale;
+ pixelScale[1] = _pixelScale;
return true;
}
diff --git a/src/newt/classes/jogamp/newt/driver/macosx/WindowDriver.java b/src/newt/classes/jogamp/newt/driver/macosx/WindowDriver.java
index c0f7d3859..7f3a53626 100644
--- a/src/newt/classes/jogamp/newt/driver/macosx/WindowDriver.java
+++ b/src/newt/classes/jogamp/newt/driver/macosx/WindowDriver.java
@@ -34,16 +34,16 @@
package jogamp.newt.driver.macosx;
-import javax.media.nativewindow.AbstractGraphicsConfiguration;
-import javax.media.nativewindow.GraphicsConfigurationFactory;
-import javax.media.nativewindow.NativeWindow;
-import javax.media.nativewindow.NativeWindowException;
-import javax.media.nativewindow.MutableSurface;
-import javax.media.nativewindow.ScalableSurface;
-import javax.media.nativewindow.VisualIDHolder;
-import javax.media.nativewindow.util.Insets;
-import javax.media.nativewindow.util.Point;
-import javax.media.nativewindow.util.PointImmutable;
+import com.jogamp.nativewindow.AbstractGraphicsConfiguration;
+import com.jogamp.nativewindow.GraphicsConfigurationFactory;
+import com.jogamp.nativewindow.NativeWindow;
+import com.jogamp.nativewindow.NativeWindowException;
+import com.jogamp.nativewindow.MutableSurface;
+import com.jogamp.nativewindow.ScalableSurface;
+import com.jogamp.nativewindow.VisualIDHolder;
+import com.jogamp.nativewindow.util.Insets;
+import com.jogamp.nativewindow.util.Point;
+import com.jogamp.nativewindow.util.PointImmutable;
import jogamp.nativewindow.SurfaceScaleUtils;
import jogamp.nativewindow.macosx.OSXUtil;
@@ -67,20 +67,26 @@ public class WindowDriver extends WindowImpl implements MutableSurface, DriverCl
public WindowDriver() {
}
- private boolean updatePixelScale(final boolean sendEvent, final boolean defer, final float newPixelScaleRaw, final float nativePixelScaleRaw) {
- final int[] newPixelScale = new int[2];
+ private boolean updatePixelScale(final boolean sendEvent, final boolean defer, final boolean deferOffThread,
+ final float newPixelScaleRaw, final float maxPixelScaleRaw) {
+ final float[] newPixelScale = new float[2];
{
- final int _newPixelScale = FloatUtil.isZero(newPixelScaleRaw, FloatUtil.EPSILON) ? ScalableSurface.IDENTITY_PIXELSCALE : (int) newPixelScaleRaw;
+ final float _newPixelScale = FloatUtil.isZero(newPixelScaleRaw, FloatUtil.EPSILON) ? ScalableSurface.IDENTITY_PIXELSCALE : newPixelScaleRaw;
newPixelScale[0]= _newPixelScale;
newPixelScale[1]= _newPixelScale;
- final int _nativePixelScale = FloatUtil.isZero(nativePixelScaleRaw, FloatUtil.EPSILON) ? ScalableSurface.IDENTITY_PIXELSCALE : (int) nativePixelScaleRaw;
- nativePixelScale[0]= _nativePixelScale;
- nativePixelScale[1]= _nativePixelScale;
+ final float _maxPixelScale = FloatUtil.isZero(maxPixelScaleRaw, FloatUtil.EPSILON) ? ScalableSurface.IDENTITY_PIXELSCALE : maxPixelScaleRaw;
+ maxPixelScale[0]= _maxPixelScale;
+ maxPixelScale[1]= _maxPixelScale;
}
+ // We keep minPixelScale at [1f, 1f]!
- if( SurfaceScaleUtils.computePixelScale(hasPixelScale, hasPixelScale, reqPixelScale, newPixelScale, DEBUG_IMPLEMENTATION ? getClass().getName() : null) ) {
+ if( SurfaceScaleUtils.setNewPixelScale(hasPixelScale, hasPixelScale, newPixelScale, minPixelScale, maxPixelScale, DEBUG_IMPLEMENTATION ? getClass().getName() : null) ) {
if( sendEvent ) {
- super.sizeChanged(defer, getWidth(), getHeight(), true);
+ if( deferOffThread ) {
+ superSizeChangedOffThread(defer, getWidth(), getHeight(), true);
+ } else {
+ super.sizeChanged(defer, getWidth(), getHeight(), true);
+ }
} else {
defineSize(getWidth(), getHeight());
}
@@ -91,34 +97,34 @@ public class WindowDriver extends WindowImpl implements MutableSurface, DriverCl
}
private boolean updatePixelScaleByScreenIdx(final boolean sendEvent) {
- final float nativePixelScaleRaw = (float) OSXUtil.GetPixelScale(getScreen().getIndex());
+ final float maxPixelScaleRaw = (float) OSXUtil.GetPixelScaleByScreenIdx(getScreen().getIndex());
if( DEBUG_IMPLEMENTATION ) {
- System.err.println("WindowDriver.updatePixelScale.1: "+hasPixelScale[0]+", "+nativePixelScaleRaw+" (native)");
+ System.err.println("WindowDriver.updatePixelScale.1: "+hasPixelScale[0]+", "+maxPixelScaleRaw+" (max)");
}
- return updatePixelScale(sendEvent, true /* defer */, nativePixelScaleRaw, nativePixelScaleRaw);
+ return updatePixelScale(sendEvent, true /* defer */, false /*offthread */, maxPixelScaleRaw, maxPixelScaleRaw);
}
private boolean updatePixelScaleByWindowHandle(final boolean sendEvent) {
final long handle = getWindowHandle();
if( 0 != handle ) {
- final float nativePixelScaleRaw = (float)OSXUtil.GetPixelScale(handle);
+ final float maxPixelScaleRaw = (float)OSXUtil.GetPixelScale(handle);
if( DEBUG_IMPLEMENTATION ) {
- System.err.println("WindowDriver.updatePixelScale.2: "+hasPixelScale[0]+", "+nativePixelScaleRaw+" (native)");
+ System.err.println("WindowDriver.updatePixelScale.2: "+hasPixelScale[0]+", "+maxPixelScaleRaw+" (max)");
}
- return updatePixelScale(sendEvent, true /* defer */, nativePixelScaleRaw, nativePixelScaleRaw);
+ return updatePixelScale(sendEvent, true /* defer */, false /*offthread */, maxPixelScaleRaw, maxPixelScaleRaw);
} else {
return false;
}
}
/** Called from native code */
- protected void updatePixelScale(final boolean defer, final float newPixelScaleRaw, final float nativePixelScaleRaw) {
+ protected void updatePixelScale(final boolean defer, final float newPixelScaleRaw, final float maxPixelScaleRaw) {
final long handle = getWindowHandle();
if( DEBUG_IMPLEMENTATION ) {
- System.err.println("WindowDriver.updatePixelScale.3: "+hasPixelScale[0]+" (has) -> "+newPixelScaleRaw+" (raw), "+nativePixelScaleRaw+" (native), drop "+(0==handle));
+ System.err.println("WindowDriver.updatePixelScale.3: "+hasPixelScale[0]+" (has) -> "+newPixelScaleRaw+" (new), "+maxPixelScaleRaw+" (max), drop "+(0==handle));
}
if( 0 != handle ) {
- updatePixelScale(true /* sendEvent*/, defer, newPixelScaleRaw, nativePixelScaleRaw);
+ updatePixelScale(true /* sendEvent*/, defer, true /*offthread */, newPixelScaleRaw, maxPixelScaleRaw);
}
}
@@ -139,44 +145,47 @@ public class WindowDriver extends WindowImpl implements MutableSurface, DriverCl
}
@Override
- public final void setSurfaceScale(final int[] pixelScale) {
- SurfaceScaleUtils.validateReqPixelScale(reqPixelScale, pixelScale, DEBUG_IMPLEMENTATION ? getClass().getName() : null);
+ public final boolean setSurfaceScale(final float[] pixelScale) {
+ super.setSurfaceScale(pixelScale);
- final int[] resPixelScale;
+ boolean changed = false;
if( isNativeValid() ) {
if( isOffscreenInstance ) {
final NativeWindow pWin = getParent();
if( pWin instanceof ScalableSurface ) {
final ScalableSurface sSurf = (ScalableSurface)pWin;
sSurf.setSurfaceScale(reqPixelScale);
- final int[] pPixelScale = sSurf.getCurrentSurfaceScale(new int[2]);
- sSurf.getNativeSurfaceScale(nativePixelScale);
- updatePixelScale(true /* sendEvent */, true /* defer */, pPixelScale[0], nativePixelScale[0]); // HiDPI: uniformPixelScale
+ sSurf.getMaximumSurfaceScale(maxPixelScale);
+ sSurf.getMinimumSurfaceScale(minPixelScale);
+ final float[] pPixelScale = sSurf.getCurrentSurfaceScale(new float[2]);
+ changed = updatePixelScale(true /* sendEvent */, true /* defer */, true /*offthread */, pPixelScale[0], maxPixelScale[0]); // HiDPI: uniformPixelScale
} else {
// just notify updated pixelScale if offscreen
- SurfaceScaleUtils.replaceAutoMaxWithPlatformMax(reqPixelScale);
- updatePixelScale(true /* sendEvent */, true /* defer */, reqPixelScale[0], nativePixelScale[0]); // HiDPI: uniformPixelScale
+ changed = updatePixelScale(true /* sendEvent */, true /* defer */, true /*offthread */, reqPixelScale[0], maxPixelScale[0]); // HiDPI: uniformPixelScale
}
} else {
- // set pixelScale in native code, will issue an update PixelScale
- OSXUtil.RunOnMainThread(true, false, new Runnable() {
- @Override
- public void run() {
- setPixelScale0(getWindowHandle(), surfaceHandle, reqPixelScale[0]); // HiDPI: uniformPixelScale
- }
- } );
+ // set pixelScale in native code, will issue an update updatePixelScale(..)
+ // hence we pre-query whether pixel-scale will change, without affecting current state 'hasPixelScale'!
+ final float[] _hasPixelScale = new float[2];
+ System.arraycopy(hasPixelScale, 0, _hasPixelScale, 0, 2);
+ if( SurfaceScaleUtils.setNewPixelScale(_hasPixelScale, _hasPixelScale, reqPixelScale, minPixelScale, maxPixelScale, DEBUG_IMPLEMENTATION ? getClass().getName() : null) ) {
+ OSXUtil.RunOnMainThread(true, false, new Runnable() {
+ @Override
+ public void run() {
+ setPixelScale0(getWindowHandle(), surfaceHandle, _hasPixelScale[0]); // HiDPI: uniformPixelScale
+ }
+ } );
+ changed = true;
+ }
}
- resPixelScale = hasPixelScale;
- } else {
- hasPixelScale[0] = ScalableSurface.IDENTITY_PIXELSCALE;
- hasPixelScale[1] = ScalableSurface.IDENTITY_PIXELSCALE;
- resPixelScale = reqPixelScale;
}
if( DEBUG_IMPLEMENTATION ) {
- System.err.println("WindowDriver.setPixelScale: "+pixelScale[0]+"x"+pixelScale[1]+" (req) -> "+
- reqPixelScale[0]+"x"+reqPixelScale[1]+" (validated) -> "+
- resPixelScale[0]+"x"+resPixelScale[1]+" (result) - realized "+isNativeValid());
+ System.err.println("WindowDriver.setPixelScale: min["+minPixelScale[0]+", "+minPixelScale[1]+"], max["+
+ maxPixelScale[0]+", "+maxPixelScale[1]+"], req["+
+ reqPixelScale[0]+", "+reqPixelScale[1]+"] -> result["+
+ hasPixelScale[0]+", "+hasPixelScale[1]+"] - changed "+changed+", realized "+isNativeValid());
}
+ return changed;
}
@Override
@@ -360,13 +369,23 @@ public class WindowDriver extends WindowImpl implements MutableSurface, DriverCl
System.err.println("MacWindow: sizeChanged() parent["+useParent+" "+x+"/"+y+"] "+getX()+"/"+getY()+" "+newWidth+"x"+newHeight+" -> "+p0S+" screen-client-pos");
}
OSXUtil.RunOnMainThread(false, false, new Runnable() {
- @Override
- public void run() {
- setWindowClientTopLeftPoint0(getWindowHandle(), p0S.getX(), p0S.getY(), isVisible());
- } } );
+ @Override
+ public void run() {
+ setWindowClientTopLeftPoint0(getWindowHandle(), p0S.getX(), p0S.getY(), isVisible());
+ } } );
}
}
- super.sizeChanged(defer, newWidth, newHeight, force);
+ superSizeChangedOffThread(defer, newWidth, newHeight, force);
+ }
+ private void superSizeChangedOffThread(final boolean defer, final int newWidth, final int newHeight, final boolean force) {
+ if( defer ) {
+ new Thread() {
+ public void run() {
+ WindowDriver.super.sizeChanged(false /* defer */, newWidth, newHeight, force);
+ } }.start();
+ } else {
+ WindowDriver.super.sizeChanged(false /* defer */, newWidth, newHeight, force);
+ }
}
@Override
@@ -556,14 +575,18 @@ public class WindowDriver extends WindowImpl implements MutableSurface, DriverCl
@Override
protected void warpPointerImpl(final int x, final int y) {
if( !isOffscreenInstance ) {
- warpPointer0(getWindowHandle(), x / getPixelScaleX(), y / getPixelScaleY());
+ warpPointer0(getWindowHandle(),
+ SurfaceScaleUtils.scaleInv(x, getPixelScaleX()),
+ SurfaceScaleUtils.scaleInv(y, getPixelScaleY()));
} // else may need offscreen solution ? FIXME
}
@Override
protected final void doMouseEvent(final boolean enqueue, final boolean wait, final short eventType, final int modifiers,
final int x, final int y, final short button, final float[] rotationXYZ, final float rotationScale) {
- super.doMouseEvent(enqueue, wait, eventType, modifiers, x * getPixelScaleX(), y * getPixelScaleY(), button, rotationXYZ, rotationScale);
+ super.doMouseEvent(enqueue, wait, eventType, modifiers,
+ SurfaceScaleUtils.scale(x, getPixelScaleX()),
+ SurfaceScaleUtils.scale(y, getPixelScaleY()), button, rotationXYZ, rotationScale);
}
@Override
diff --git a/src/newt/classes/jogamp/newt/driver/opengl/JoglUtilPNGIcon.java b/src/newt/classes/jogamp/newt/driver/opengl/JoglUtilPNGIcon.java
index 5e703f690..f9f1f13ad 100644
--- a/src/newt/classes/jogamp/newt/driver/opengl/JoglUtilPNGIcon.java
+++ b/src/newt/classes/jogamp/newt/driver/opengl/JoglUtilPNGIcon.java
@@ -32,7 +32,7 @@ import java.net.MalformedURLException;
import java.net.URLConnection;
import java.nio.ByteBuffer;
-import javax.media.nativewindow.util.PixelFormat;
+import com.jogamp.nativewindow.util.PixelFormat;
import com.jogamp.common.nio.Buffers;
import com.jogamp.common.os.Platform;
diff --git a/src/newt/classes/jogamp/newt/driver/windows/DisplayDriver.java b/src/newt/classes/jogamp/newt/driver/windows/DisplayDriver.java
index 8973ae7ed..c44aa39f4 100644
--- a/src/newt/classes/jogamp/newt/driver/windows/DisplayDriver.java
+++ b/src/newt/classes/jogamp/newt/driver/windows/DisplayDriver.java
@@ -43,9 +43,9 @@ import jogamp.nativewindow.windows.RegisteredClassFactory;
import jogamp.newt.DisplayImpl;
import jogamp.newt.NEWTJNILibLoader;
-import javax.media.nativewindow.AbstractGraphicsDevice;
-import javax.media.nativewindow.NativeWindowException;
-import javax.media.nativewindow.util.PixelFormat;
+import com.jogamp.nativewindow.AbstractGraphicsDevice;
+import com.jogamp.nativewindow.NativeWindowException;
+import com.jogamp.nativewindow.util.PixelFormat;
import com.jogamp.common.nio.Buffers;
import com.jogamp.common.util.IOUtil;
diff --git a/src/newt/classes/jogamp/newt/driver/windows/ScreenDriver.java b/src/newt/classes/jogamp/newt/driver/windows/ScreenDriver.java
index 38acd03ae..b476ee38a 100644
--- a/src/newt/classes/jogamp/newt/driver/windows/ScreenDriver.java
+++ b/src/newt/classes/jogamp/newt/driver/windows/ScreenDriver.java
@@ -33,8 +33,8 @@
*/
package jogamp.newt.driver.windows;
-import javax.media.nativewindow.DefaultGraphicsScreen;
-import javax.media.nativewindow.util.Rectangle;
+import com.jogamp.nativewindow.DefaultGraphicsScreen;
+import com.jogamp.nativewindow.util.Rectangle;
import jogamp.newt.MonitorModeProps;
import jogamp.newt.ScreenImpl;
@@ -106,7 +106,7 @@ public class ScreenDriver extends ScreenImpl {
if ( null != currentMode ) { // enabled
final int[] monitorProps = getMonitorDevice0(adapterName, crtIdx);
// merge monitor-props + supported modes
- MonitorModeProps.streamInMonitorDevice(null, cache, this, supportedModes, currentMode, monitorProps, 0);
+ MonitorModeProps.streamInMonitorDevice(cache, this, currentMode, null, supportedModes, monitorProps, 0, null);
// next monitor, 1st mode
supportedModes= new ArrayHashSet<MonitorMode>();
@@ -118,7 +118,7 @@ public class ScreenDriver extends ScreenImpl {
}
@Override
- protected boolean updateNativeMonitorDeviceViewportImpl(final MonitorDevice monitor, final Rectangle viewportPU, final Rectangle viewportWU) {
+ protected boolean updateNativeMonitorDeviceViewportImpl(final MonitorDevice monitor, final float[] pixelScale, final Rectangle viewportPU, final Rectangle viewportWU) {
final String adapterName = getAdapterName(monitor.getId());
if( null != adapterName ) {
final String activeMonitorName = getActiveMonitorName(adapterName, 0);
diff --git a/src/newt/classes/jogamp/newt/driver/windows/WindowDriver.java b/src/newt/classes/jogamp/newt/driver/windows/WindowDriver.java
index 1c5c34457..cf286e54b 100644
--- a/src/newt/classes/jogamp/newt/driver/windows/WindowDriver.java
+++ b/src/newt/classes/jogamp/newt/driver/windows/WindowDriver.java
@@ -41,13 +41,13 @@ import jogamp.nativewindow.windows.GDIUtil;
import jogamp.newt.PointerIconImpl;
import jogamp.newt.WindowImpl;
-import javax.media.nativewindow.AbstractGraphicsConfiguration;
-import javax.media.nativewindow.GraphicsConfigurationFactory;
-import javax.media.nativewindow.NativeWindowException;
-import javax.media.nativewindow.VisualIDHolder;
-import javax.media.nativewindow.util.Insets;
-import javax.media.nativewindow.util.InsetsImmutable;
-import javax.media.nativewindow.util.Point;
+import com.jogamp.nativewindow.AbstractGraphicsConfiguration;
+import com.jogamp.nativewindow.GraphicsConfigurationFactory;
+import com.jogamp.nativewindow.NativeWindowException;
+import com.jogamp.nativewindow.VisualIDHolder;
+import com.jogamp.nativewindow.util.Insets;
+import com.jogamp.nativewindow.util.InsetsImmutable;
+import com.jogamp.nativewindow.util.Point;
import com.jogamp.common.os.Platform;
import com.jogamp.common.util.VersionNumber;
diff --git a/src/newt/classes/jogamp/newt/driver/x11/DisplayDriver.java b/src/newt/classes/jogamp/newt/driver/x11/DisplayDriver.java
index e2b9a65d1..3276f3ed1 100644
--- a/src/newt/classes/jogamp/newt/driver/x11/DisplayDriver.java
+++ b/src/newt/classes/jogamp/newt/driver/x11/DisplayDriver.java
@@ -37,9 +37,9 @@ package jogamp.newt.driver.x11;
import java.nio.Buffer;
import java.nio.ByteBuffer;
-import javax.media.nativewindow.AbstractGraphicsDevice;
-import javax.media.nativewindow.NativeWindowException;
-import javax.media.nativewindow.util.PixelFormat;
+import com.jogamp.nativewindow.AbstractGraphicsDevice;
+import com.jogamp.nativewindow.NativeWindowException;
+import com.jogamp.nativewindow.util.PixelFormat;
import com.jogamp.common.nio.Buffers;
import com.jogamp.nativewindow.x11.X11GraphicsDevice;
diff --git a/src/newt/classes/jogamp/newt/driver/x11/RandR.java b/src/newt/classes/jogamp/newt/driver/x11/RandR.java
index 8b065d1f0..14c9c0856 100644
--- a/src/newt/classes/jogamp/newt/driver/x11/RandR.java
+++ b/src/newt/classes/jogamp/newt/driver/x11/RandR.java
@@ -29,7 +29,7 @@ package jogamp.newt.driver.x11;
import java.util.List;
-import javax.media.nativewindow.util.RectangleImmutable;
+import com.jogamp.nativewindow.util.RectangleImmutable;
import jogamp.newt.MonitorModeProps;
diff --git a/src/newt/classes/jogamp/newt/driver/x11/RandR11.java b/src/newt/classes/jogamp/newt/driver/x11/RandR11.java
index 4803852f9..d11703e47 100644
--- a/src/newt/classes/jogamp/newt/driver/x11/RandR11.java
+++ b/src/newt/classes/jogamp/newt/driver/x11/RandR11.java
@@ -27,7 +27,7 @@
*/
package jogamp.newt.driver.x11;
-import javax.media.nativewindow.util.RectangleImmutable;
+import com.jogamp.nativewindow.util.RectangleImmutable;
import jogamp.newt.MonitorModeProps;
import jogamp.newt.ScreenImpl;
diff --git a/src/newt/classes/jogamp/newt/driver/x11/RandR13.java b/src/newt/classes/jogamp/newt/driver/x11/RandR13.java
index 7a409bba1..b6d8f13a1 100644
--- a/src/newt/classes/jogamp/newt/driver/x11/RandR13.java
+++ b/src/newt/classes/jogamp/newt/driver/x11/RandR13.java
@@ -29,7 +29,7 @@ package jogamp.newt.driver.x11;
import java.util.Iterator;
-import javax.media.nativewindow.util.RectangleImmutable;
+import com.jogamp.nativewindow.util.RectangleImmutable;
import jogamp.newt.MonitorModeProps;
diff --git a/src/newt/classes/jogamp/newt/driver/x11/ScreenDriver.java b/src/newt/classes/jogamp/newt/driver/x11/ScreenDriver.java
index f7361740e..993ff58f9 100644
--- a/src/newt/classes/jogamp/newt/driver/x11/ScreenDriver.java
+++ b/src/newt/classes/jogamp/newt/driver/x11/ScreenDriver.java
@@ -36,9 +36,9 @@ package jogamp.newt.driver.x11;
import java.util.ArrayList;
import java.util.List;
-import javax.media.nativewindow.AbstractGraphicsDevice;
-import javax.media.nativewindow.util.Rectangle;
-import javax.media.nativewindow.util.RectangleImmutable;
+import com.jogamp.nativewindow.AbstractGraphicsDevice;
+import com.jogamp.nativewindow.util.Rectangle;
+import com.jogamp.nativewindow.util.RectangleImmutable;
import jogamp.nativewindow.x11.X11Util;
import jogamp.newt.Debug;
@@ -152,7 +152,7 @@ public class ScreenDriver extends ScreenImpl {
if( null != monitorProps &&
MonitorModeProps.MIN_MONITOR_DEVICE_PROPERTIES <= monitorProps[0] && // Enabled ? I.e. contains active modes ?
MonitorModeProps.MIN_MONITOR_DEVICE_PROPERTIES <= monitorProps.length ) {
- MonitorModeProps.streamInMonitorDevice(null, cache, this, monitorProps, 0);
+ MonitorModeProps.streamInMonitorDevice(cache, this, null, monitorProps, 0, null);
}
}
}
@@ -166,7 +166,7 @@ public class ScreenDriver extends ScreenImpl {
}
@Override
- protected boolean updateNativeMonitorDeviceViewportImpl(final MonitorDevice monitor, final Rectangle viewportPU, final Rectangle viewportWU) {
+ protected boolean updateNativeMonitorDeviceViewportImpl(final MonitorDevice monitor, final float[] pixelScale, final Rectangle viewportPU, final Rectangle viewportWU) {
final AbstractGraphicsDevice device = getDisplay().getGraphicsDevice();
device.lock();
try {
diff --git a/src/newt/classes/jogamp/newt/driver/x11/WindowDriver.java b/src/newt/classes/jogamp/newt/driver/x11/WindowDriver.java
index afa9786e2..cdeb7d6d0 100644
--- a/src/newt/classes/jogamp/newt/driver/x11/WindowDriver.java
+++ b/src/newt/classes/jogamp/newt/driver/x11/WindowDriver.java
@@ -44,12 +44,13 @@ import jogamp.newt.PointerIconImpl;
import jogamp.newt.WindowImpl;
import jogamp.newt.driver.PNGIcon;
-import javax.media.nativewindow.*;
-import javax.media.nativewindow.VisualIDHolder.VIDType;
-import javax.media.nativewindow.util.Insets;
-import javax.media.nativewindow.util.InsetsImmutable;
-import javax.media.nativewindow.util.Point;
+import com.jogamp.nativewindow.*;
+import com.jogamp.nativewindow.VisualIDHolder.VIDType;
+import com.jogamp.nativewindow.util.Insets;
+import com.jogamp.nativewindow.util.InsetsImmutable;
+import com.jogamp.nativewindow.util.Point;
+import com.jogamp.common.ExceptionUtils;
import com.jogamp.common.nio.Buffers;
import com.jogamp.nativewindow.x11.X11GraphicsDevice;
import com.jogamp.nativewindow.x11.X11GraphicsScreen;
@@ -424,7 +425,7 @@ public class WindowDriver extends WindowImpl {
// Internals only
//
private static final String getCurrentThreadName() { return Thread.currentThread().getName(); } // Callback for JNI
- private static final void dumpStack() { Thread.dumpStack(); } // Callback for JNI
+ private static final void dumpStack() { ExceptionUtils.dumpStack(System.err); } // Callback for JNI
private final <T> T runWithLockedDisplayDevice(final DisplayRunnable<T> action) {
return ((DisplayDriver) getScreen().getDisplay()).runWithLockedDisplayDevice(action);
diff --git a/src/newt/classes/jogamp/newt/swt/SWTEDTUtil.java b/src/newt/classes/jogamp/newt/swt/SWTEDTUtil.java
index 794e989a6..9039b6083 100644
--- a/src/newt/classes/jogamp/newt/swt/SWTEDTUtil.java
+++ b/src/newt/classes/jogamp/newt/swt/SWTEDTUtil.java
@@ -27,10 +27,11 @@
*/
package jogamp.newt.swt;
-import javax.media.nativewindow.NativeWindowException;
+import com.jogamp.nativewindow.NativeWindowException;
import jogamp.newt.Debug;
+import com.jogamp.common.ExceptionUtils;
import com.jogamp.common.util.RunnableTask;
import com.jogamp.newt.util.EDTUtil;
@@ -170,7 +171,7 @@ public class SWTEDTUtil implements EDTUtil {
// drop task ..
if(DEBUG) {
System.err.println(Thread.currentThread()+": Warning: SWT-EDT about (1) to stop, won't enqueue new task: "+nedt+", isRunning "+nedt.isRunning+", shouldStop "+nedt.shouldStop);
- Thread.dumpStack();
+ ExceptionUtils.dumpStack(System.err);
}
return false;
}
@@ -195,7 +196,7 @@ public class SWTEDTUtil implements EDTUtil {
System.err.println(Thread.currentThread()+": Warning: SWT-EDT is not running, dropping task. NEDT "+nedt);
}
if(DEBUG) {
- Thread.dumpStack();
+ ExceptionUtils.dumpStack(System.err);
}
}
return false;
@@ -212,7 +213,7 @@ public class SWTEDTUtil implements EDTUtil {
if( swtDisplay.isDisposed() ) {
System.err.println(Thread.currentThread()+": Warning: SWT-EDT is about (3) to stop and stopped already, dropping task. "+nedt);
if(DEBUG) {
- Thread.dumpStack();
+ ExceptionUtils.dumpStack(System.err);
}
return false;
}
diff --git a/src/newt/classes/jogamp/newt/swt/event/SWTNewtEventFactory.java b/src/newt/classes/jogamp/newt/swt/event/SWTNewtEventFactory.java
index a989345dd..bb0b8c1aa 100644
--- a/src/newt/classes/jogamp/newt/swt/event/SWTNewtEventFactory.java
+++ b/src/newt/classes/jogamp/newt/swt/event/SWTNewtEventFactory.java
@@ -28,8 +28,8 @@
package jogamp.newt.swt.event;
-import javax.media.nativewindow.NativeSurface;
-import javax.media.nativewindow.NativeSurfaceHolder;
+import com.jogamp.nativewindow.NativeSurface;
+import com.jogamp.nativewindow.NativeSurfaceHolder;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Event;
diff --git a/src/newt/native/MacWindow.m b/src/newt/native/MacWindow.m
index 2bd11da3c..e0f8be856 100644
--- a/src/newt/native/MacWindow.m
+++ b/src/newt/native/MacWindow.m
@@ -48,7 +48,7 @@
#include "timespec.h"
#endif
-static const char * const ClazzNamePoint = "javax/media/nativewindow/util/Point";
+static const char * const ClazzNamePoint = "com/jogamp/nativewindow/util/Point";
static const char * const ClazzAnyCstrName = "<init>";
static const char * const ClazzNamePointCstrSignature = "(II)V";
static jclass pointClz = NULL;
@@ -420,7 +420,7 @@ NS_ENDHANDLER
CGDirectDisplayID NewtScreen_getCGDirectDisplayIDByNSScreen(NSScreen *screen) {
- // Mind: typedef uint32_t CGDirectDisplayID; - however, we assume it's 64bit on 64bit ?!
+ // Mind: typedef uint32_t CGDirectDisplayID;
NSDictionary * dict = [screen deviceDescription];
NSNumber * val = (NSNumber *) [dict objectForKey: @"NSScreenNumber"];
// [NSNumber integerValue] returns NSInteger which is 32 or 64 bit native size
@@ -1401,7 +1401,7 @@ JNIEXPORT void JNICALL Java_jogamp_newt_driver_macosx_WindowDriver_setAlwaysOnTo
/*
* Class: jogamp_newt_driver_macosx_WindowDriver
* Method: getLocationOnScreen0
- * Signature: (JII)Ljavax/media/nativewindow/util/Point;
+ * Signature: (JII)Lcom/jogamp/nativewindow/util/Point;
*/
JNIEXPORT jobject JNICALL Java_jogamp_newt_driver_macosx_WindowDriver_getLocationOnScreen0
(JNIEnv *env, jclass unused, jlong win, jint src_x, jint src_y)
diff --git a/src/newt/native/NewtMacWindow.m b/src/newt/native/NewtMacWindow.m
index caf9e54e0..7b3df391d 100644
--- a/src/newt/native/NewtMacWindow.m
+++ b/src/newt/native/NewtMacWindow.m
@@ -784,11 +784,21 @@ static jmethodID windowRepaintID = NULL;
[super viewDidChangeBackingProperties];
// HiDPI scaling
- BOOL useHiDPI = [self wantsBestResolutionOpenGLSurface];
- CGFloat pixelScaleNative = [[self window] backingScaleFactor];
- CGFloat pixelScaleUse = useHiDPI ? pixelScaleNative : 1.0;
- DBG_PRINT("viewDidChangeBackingProperties: PixelScale: HiDPI %d, native %f -> use %f\n", useHiDPI, (float)pixelScaleNative, (float)pixelScaleUse);
- [[self layer] setContentsScale: pixelScaleUse];
+ BOOL useHiDPI = false;
+ CGFloat maxPixelScale = 1.0;
+ CGFloat winPixelScale = 1.0;
+ NSWindow* window = [self window];
+ NSScreen* screen = [window screen];
+NS_DURING
+ maxPixelScale = [screen backingScaleFactor];
+ useHiDPI = [self wantsBestResolutionOpenGLSurface];
+ if( useHiDPI ) {
+ winPixelScale = [window backingScaleFactor];
+ }
+NS_HANDLER
+NS_ENDHANDLER
+ DBG_PRINT("viewDidChangeBackingProperties: PixelScale: HiDPI %d, max %f, window %f\n", useHiDPI, (float)maxPixelScale, (float)winPixelScale);
+ [[self layer] setContentsScale: winPixelScale];
if (javaWindowObject == NULL) {
DBG_PRINT("viewDidChangeBackingProperties: null javaWindowObject\n");
@@ -801,7 +811,7 @@ static jmethodID windowRepaintID = NULL;
return;
}
- (*env)->CallVoidMethod(env, javaWindowObject, updatePixelScaleID, JNI_TRUE, (jfloat)pixelScaleUse, (jfloat)pixelScaleNative); // defer
+ (*env)->CallVoidMethod(env, javaWindowObject, updatePixelScaleID, JNI_TRUE, (jfloat)winPixelScale, (jfloat)maxPixelScale); // defer
// detaching thread not required - daemon
// NewtCommon_ReleaseJNIEnv(shallBeDetached);