summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/jogl/classes/com/jogamp/opengl/GLAutoDrawableDelegate.java18
-rw-r--r--src/jogl/classes/com/jogamp/opengl/swt/GLCanvas.java4
-rw-r--r--src/jogl/classes/javax/media/opengl/GLEventListener.java26
-rw-r--r--src/jogl/classes/javax/media/opengl/GLFBODrawable.java8
-rw-r--r--src/jogl/classes/javax/media/opengl/GLOffscreenAutoDrawable.java10
-rw-r--r--src/jogl/classes/javax/media/opengl/awt/GLCanvas.java1
-rw-r--r--src/jogl/classes/jogamp/opengl/GLAutoDrawableBase.java19
-rw-r--r--src/jogl/classes/jogamp/opengl/GLDrawableHelper.java2
-rw-r--r--src/jogl/classes/jogamp/opengl/GLFBODrawableImpl.java4
-rw-r--r--src/jogl/classes/jogamp/opengl/GLOffscreenAutoDrawableImpl.java2
-rw-r--r--src/jogl/classes/jogamp/opengl/egl/EGLDummyUpstreamSurfaceHook.java4
-rw-r--r--src/jogl/classes/jogamp/opengl/egl/EGLUpstreamSurfaceHook.java8
-rw-r--r--src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLContext.java6
-rw-r--r--src/nativewindow/classes/com/jogamp/nativewindow/DelegatedUpstreamSurfaceHookWithSurfaceSize.java6
-rw-r--r--src/nativewindow/classes/com/jogamp/nativewindow/UpstreamSurfaceHookMutableSize.java6
-rw-r--r--src/nativewindow/classes/com/jogamp/nativewindow/UpstreamWindowHookMutableSizePos.java3
-rw-r--r--src/nativewindow/classes/com/jogamp/nativewindow/awt/JAWTWindow.java16
-rw-r--r--src/nativewindow/classes/javax/media/nativewindow/NativeSurface.java24
-rw-r--r--src/nativewindow/classes/javax/media/nativewindow/UpstreamSurfaceHook.java11
-rw-r--r--src/nativewindow/classes/javax/media/nativewindow/util/Point.java32
-rw-r--r--src/nativewindow/classes/jogamp/nativewindow/ProxySurfaceImpl.java4
-rw-r--r--src/nativewindow/classes/jogamp/nativewindow/WrappedSurface.java17
-rw-r--r--src/nativewindow/classes/jogamp/nativewindow/macosx/OSXDummyUpstreamSurfaceHook.java4
-rw-r--r--src/nativewindow/classes/jogamp/nativewindow/windows/GDIDummyUpstreamSurfaceHook.java4
-rw-r--r--src/nativewindow/classes/jogamp/nativewindow/windows/GDISurface.java14
-rw-r--r--src/nativewindow/classes/jogamp/nativewindow/x11/X11DummyUpstreamSurfaceHook.java4
-rw-r--r--src/newt/classes/com/jogamp/newt/MonitorDevice.java11
-rw-r--r--src/newt/classes/com/jogamp/newt/NewtFactory.java2
-rw-r--r--src/newt/classes/com/jogamp/newt/Screen.java15
-rw-r--r--src/newt/classes/com/jogamp/newt/Window.java44
-rw-r--r--src/newt/classes/com/jogamp/newt/awt/NewtCanvasAWT.java2
-rw-r--r--src/newt/classes/com/jogamp/newt/opengl/GLWindow.java22
-rw-r--r--src/newt/classes/com/jogamp/newt/swt/NewtCanvasSWT.java14
-rw-r--r--src/newt/classes/com/jogamp/newt/util/applet/JOGLNewtApplet3Run.java4
-rw-r--r--src/newt/classes/jogamp/newt/WindowImpl.java236
-rw-r--r--src/newt/classes/jogamp/newt/awt/event/AWTParentWindowAdapter.java2
-rw-r--r--src/newt/classes/jogamp/newt/driver/android/NewtBaseActivity.java120
-rw-r--r--src/newt/classes/jogamp/newt/driver/android/WindowDriver.java17
-rw-r--r--src/newt/classes/jogamp/newt/driver/awt/WindowDriver.java2
-rw-r--r--src/newt/classes/jogamp/newt/driver/bcm/egl/WindowDriver.java4
-rw-r--r--src/newt/classes/jogamp/newt/driver/bcm/vc/iv/WindowDriver.java2
-rw-r--r--src/newt/classes/jogamp/newt/driver/intel/gdl/WindowDriver.java3
-rw-r--r--src/newt/classes/jogamp/newt/driver/kd/WindowDriver.java6
-rw-r--r--src/newt/classes/jogamp/newt/driver/macosx/WindowDriver.java14
-rw-r--r--src/newt/classes/jogamp/newt/driver/windows/WindowDriver.java5
-rw-r--r--src/newt/classes/jogamp/newt/driver/x11/WindowDriver.java4
-rw-r--r--src/test/com/jogamp/opengl/test/junit/graph/demos/GPURegionNewtDemo.java2
-rw-r--r--src/test/com/jogamp/opengl/test/junit/graph/demos/GPUTextNewtDemo.java2
-rw-r--r--src/test/com/jogamp/opengl/test/junit/graph/demos/GPUUISceneNewtDemo.java8
-rw-r--r--src/test/com/jogamp/opengl/test/junit/graph/demos/ui/GLEventListenerButton.java2
-rw-r--r--src/test/com/jogamp/opengl/test/junit/graph/demos/ui/UINewtDemo01.java2
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/acore/TestFBOAutoDrawableFactoryNEWT.java6
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/acore/TestFBOOffThreadSharedContextMix2DemosES2NEWT.java4
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/acore/TestFBOOnThreadSharedContext1DemoES2NEWT.java2
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLAutoDrawableFactoryES2OffscrnCapsNEWT.java4
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLAutoDrawableFactoryGL2OffscrnCapsNEWT.java4
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLAutoDrawableFactoryGLnBitmapCapsNEWT.java4
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/demos/es1/GearsES1.java6
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/GearsES2.java2
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/TextureSequenceCubeES2.java6
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/av/MovieCube.java4
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/av/MovieSimple.java22
-rw-r--r--src/test/com/jogamp/opengl/test/junit/jogl/demos/gl2/Gears.java6
-rw-r--r--src/test/com/jogamp/opengl/test/junit/newt/TestWindows01NEWT.java34
-rw-r--r--src/test/com/jogamp/opengl/test/junit/util/AWTRobotUtil.java4
65 files changed, 548 insertions, 362 deletions
diff --git a/src/jogl/classes/com/jogamp/opengl/GLAutoDrawableDelegate.java b/src/jogl/classes/com/jogamp/opengl/GLAutoDrawableDelegate.java
index 6b1bb0e5e..e9fe80a91 100644
--- a/src/jogl/classes/com/jogamp/opengl/GLAutoDrawableDelegate.java
+++ b/src/jogl/classes/com/jogamp/opengl/GLAutoDrawableDelegate.java
@@ -36,6 +36,7 @@ import javax.media.opengl.GLAutoDrawable;
import javax.media.opengl.GLContext;
import javax.media.opengl.GLDrawable;
import javax.media.opengl.GLDrawableFactory;
+import javax.media.opengl.GLEventListener;
import javax.media.opengl.GLException;
import com.jogamp.common.util.locks.LockFactory;
@@ -101,7 +102,22 @@ public class GLAutoDrawableDelegate extends GLAutoDrawableBase implements GLAuto
super.defaultWindowRepaintOp();
}
- /** Implementation to handle resize events from the windowing system. All required locks are being claimed. */
+ /**
+ * Handling resize events from the windowing system.
+ * <p>
+ * Implementation:
+ * <ul>
+ * <li>resizes {@link #getDelegatedDrawable() the GLDrawable}, if offscreen,</li>
+ * <li>triggers a pending {@link GLEventListener#reshape(GLAutoDrawable, int, int, int, int) reshape events}, and</li>
+ * <li>issues a {@link #display()} call, if no animator is present.</li>
+ * </ul>
+ * </p>
+ * <p>
+ * All required locks are being claimed.
+ * </p>
+ * @param newWidth new width in pixel units
+ * @param newWidth new height in pixel units
+ */
public final void windowResizedOp(int newWidth, int newHeight) {
super.defaultWindowResizedOp(newWidth, newHeight);
}
diff --git a/src/jogl/classes/com/jogamp/opengl/swt/GLCanvas.java b/src/jogl/classes/com/jogamp/opengl/swt/GLCanvas.java
index 1c6dced6a..ec0935c18 100644
--- a/src/jogl/classes/com/jogamp/opengl/swt/GLCanvas.java
+++ b/src/jogl/classes/com/jogamp/opengl/swt/GLCanvas.java
@@ -455,12 +455,12 @@ public class GLCanvas extends Canvas implements GLAutoDrawable, GLSharedContextS
public final void destroy(ProxySurface s) { /* nop */ }
@Override
- public final int getPixelWidth(ProxySurface s) {
+ public final int getSurfaceWidth(ProxySurface s) {
return clientArea.width;
}
@Override
- public final int getPixelHeight(ProxySurface s) {
+ public final int getSurfaceHeight(ProxySurface s) {
return clientArea.height;
}
diff --git a/src/jogl/classes/javax/media/opengl/GLEventListener.java b/src/jogl/classes/javax/media/opengl/GLEventListener.java
index c8c3440b5..995ca2620 100644
--- a/src/jogl/classes/javax/media/opengl/GLEventListener.java
+++ b/src/jogl/classes/javax/media/opengl/GLEventListener.java
@@ -80,13 +80,23 @@ public interface GLEventListener extends EventListener {
enabled. */
public void display(GLAutoDrawable drawable);
- /** Called by the drawable during the first repaint after the
- component has been resized. The client can update the viewport
- and view volume of the window appropriately, for example by a
- call to {@link javax.media.opengl.GL#glViewport}; note that for
- convenience the component has already called <code>glViewport(x,
- y, width, height)</code> when this method is called, so the
- client may not have to do anything in this method.
- */
+ /**
+ * Called by the drawable during the first repaint after the
+ * component has been resized.
+ * <p>
+ * The client can update it's viewport associated data
+ * and view volume of the window appropriately.
+ * </p>
+ * <p>
+ * For efficiency the GL viewport has already been updated
+ * via <code>glViewport(x, y, width, height)</code> when this method is called.
+ * </p>
+ *
+ * @param drawable the triggering {@link GLAutoDrawable}
+ * @param x viewport x-coord in pixel units
+ * @param y viewport y-coord in pixel units
+ * @param width viewport width in pixel units
+ * @param height viewport height in pixel units
+ */
public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height);
}
diff --git a/src/jogl/classes/javax/media/opengl/GLFBODrawable.java b/src/jogl/classes/javax/media/opengl/GLFBODrawable.java
index 052b08a4b..a34fca0fa 100644
--- a/src/jogl/classes/javax/media/opengl/GLFBODrawable.java
+++ b/src/jogl/classes/javax/media/opengl/GLFBODrawable.java
@@ -179,17 +179,17 @@ public interface GLFBODrawable extends GLDrawable {
/** Resizeable {@link GLFBODrawable} specialization */
public interface Resizeable extends GLFBODrawable {
/**
- * Resize this drawable.
+ * Resize this {@link GLFBODrawable}'s surface.
* <p>
* This drawable is being locked during operation.
* </p>
* @param context the {@link GLContext} bound to this drawable, will be made current during operation
* A prev. current context will be make current after operation.
- * @param newWidth
- * @param newHeight
+ * @param newWidth new width in pixel units
+ * @param newHeight new width in pixel units
* @throws NativeWindowException in case the surface could no be locked
* @throws GLException in case an error during the resize operation occurred
*/
- void setSize(GLContext context, int newWidth, int newHeight) throws NativeWindowException, GLException;
+ void setSurfaceSize(GLContext context, int newWidth, int newHeight) throws NativeWindowException, GLException;
}
}
diff --git a/src/jogl/classes/javax/media/opengl/GLOffscreenAutoDrawable.java b/src/jogl/classes/javax/media/opengl/GLOffscreenAutoDrawable.java
index d34edaf2e..a69480242 100644
--- a/src/jogl/classes/javax/media/opengl/GLOffscreenAutoDrawable.java
+++ b/src/jogl/classes/javax/media/opengl/GLOffscreenAutoDrawable.java
@@ -37,19 +37,19 @@ import com.jogamp.opengl.FBObject;
* exposing offscreen functionality.
* <p>
* This class distinguishes itself from {@link GLAutoDrawable}
- * with it's {@link #setSize(int, int)} functionality.
+ * with it's {@link #setSurfaceSize(int, int)} functionality.
* </p>
*/
public interface GLOffscreenAutoDrawable extends GLAutoDrawable, GLSharedContextSetter {
/**
- * Resize this auto drawable.
- * @param newWidth
- * @param newHeight
+ * Resize this {@link GLAutoDrawable}'s surface
+ * @param newWidth new width in pixel units
+ * @param newHeight new height in pixel units
* @throws NativeWindowException in case the surface could no be locked
* @throws GLException in case of an error during the resize operation
*/
- void setSize(int newWidth, int newHeight) throws NativeWindowException, GLException;
+ void setSurfaceSize(int newWidth, int newHeight) throws NativeWindowException, GLException;
/**
* Set the upstream UI toolkit object.
diff --git a/src/jogl/classes/javax/media/opengl/awt/GLCanvas.java b/src/jogl/classes/javax/media/opengl/awt/GLCanvas.java
index c5ce32827..d06b61624 100644
--- a/src/jogl/classes/javax/media/opengl/awt/GLCanvas.java
+++ b/src/jogl/classes/javax/media/opengl/awt/GLCanvas.java
@@ -101,7 +101,6 @@ import com.jogamp.opengl.JoglVersion;
import com.jogamp.opengl.util.GLDrawableUtil;
import com.jogamp.opengl.util.TileRenderer;
-import jogamp.nativewindow.jawt.JAWTUtil;
import jogamp.opengl.Debug;
import jogamp.opengl.GLContextImpl;
import jogamp.opengl.GLDrawableHelper;
diff --git a/src/jogl/classes/jogamp/opengl/GLAutoDrawableBase.java b/src/jogl/classes/jogamp/opengl/GLAutoDrawableBase.java
index de7653570..493926f25 100644
--- a/src/jogl/classes/jogamp/opengl/GLAutoDrawableBase.java
+++ b/src/jogl/classes/jogamp/opengl/GLAutoDrawableBase.java
@@ -216,8 +216,23 @@ public abstract class GLAutoDrawableBase implements GLAutoDrawable, GLStateKeepe
}
}
- /** Default implementation to handle resize events from the windowing system. All required locks are being claimed. */
- protected final void defaultWindowResizedOp(int newWidth, int newHeight) throws NativeWindowException, GLException {
+ /**
+ * Handling resize events from the windowing system.
+ * <p>
+ * Implementation:
+ * <ul>
+ * <li>resizes {@link #getDelegatedDrawable() the GLDrawable}, if offscreen,</li>
+ * <li>triggers a pending {@link GLEventListener#reshape(GLAutoDrawable, int, int, int, int) reshape events}, and</li>
+ * <li>issues a {@link #display()} call, if no animator is present.</li>
+ * </ul>
+ * </p>
+ * <p>
+ * All required locks are being claimed.
+ * </p>
+ * @param newWidth new width in pixel units
+ * @param newWidth new height in pixel units
+ */
+ protected final void defaultWindowResizedOp(final int newWidth, final int newHeight) throws NativeWindowException, GLException {
GLDrawableImpl _drawable = drawable;
if( null!=_drawable ) {
if(DEBUG) {
diff --git a/src/jogl/classes/jogamp/opengl/GLDrawableHelper.java b/src/jogl/classes/jogamp/opengl/GLDrawableHelper.java
index 6116a2886..c0603383a 100644
--- a/src/jogl/classes/jogamp/opengl/GLDrawableHelper.java
+++ b/src/jogl/classes/jogamp/opengl/GLDrawableHelper.java
@@ -362,7 +362,7 @@ public class GLDrawableHelper {
final ProxySurface ps = (ProxySurface) ns;
final UpstreamSurfaceHook ush = ps.getUpstreamSurfaceHook();
if(ush instanceof UpstreamSurfaceHook.MutableSize) {
- ((UpstreamSurfaceHook.MutableSize)ush).setPixelSize(newWidth, newHeight);
+ ((UpstreamSurfaceHook.MutableSize)ush).setSurfaceSize(newWidth, newHeight);
} else if(DEBUG) { // we have to assume UpstreamSurfaceHook contains the new size already, hence size check @ bottom
System.err.println("GLDrawableHelper.resizeOffscreenDrawable: Drawable's offscreen ProxySurface n.a. UpstreamSurfaceHook.MutableSize, but "+ush.getClass().getName()+": "+ush);
}
diff --git a/src/jogl/classes/jogamp/opengl/GLFBODrawableImpl.java b/src/jogl/classes/jogamp/opengl/GLFBODrawableImpl.java
index 0e9d3c1bb..bf6a56afe 100644
--- a/src/jogl/classes/jogamp/opengl/GLFBODrawableImpl.java
+++ b/src/jogl/classes/jogamp/opengl/GLFBODrawableImpl.java
@@ -565,7 +565,7 @@ public class GLFBODrawableImpl extends GLDrawableImpl implements GLFBODrawable {
}
@Override
- public final void setSize(GLContext context, int newWidth, int newHeight) throws NativeWindowException, GLException {
+ public final void setSurfaceSize(GLContext context, int newWidth, int newHeight) throws NativeWindowException, GLException {
if(DEBUG) {
System.err.println("GLFBODrawableImpl.ResizeableImpl setSize: ("+getThreadName()+"): "+newWidth+"x"+newHeight+" - surfaceHandle 0x"+Long.toHexString(getNativeSurface().getSurfaceHandle()));
}
@@ -578,7 +578,7 @@ public class GLFBODrawableImpl extends GLDrawableImpl implements GLFBODrawable {
final ProxySurface ps = (ProxySurface) getNativeSurface();
final UpstreamSurfaceHook ush = ps.getUpstreamSurfaceHook();
if(ush instanceof UpstreamSurfaceHook.MutableSize) {
- ((UpstreamSurfaceHook.MutableSize)ush).setPixelSize(newWidth, newHeight);
+ ((UpstreamSurfaceHook.MutableSize)ush).setSurfaceSize(newWidth, newHeight);
} else {
throw new InternalError("GLFBODrawableImpl.ResizableImpl's ProxySurface doesn't hold a UpstreamSurfaceHookMutableSize but "+ush.getClass().getName()+", "+ps+", ush");
}
diff --git a/src/jogl/classes/jogamp/opengl/GLOffscreenAutoDrawableImpl.java b/src/jogl/classes/jogamp/opengl/GLOffscreenAutoDrawableImpl.java
index 345f08e4c..edfebdcfe 100644
--- a/src/jogl/classes/jogamp/opengl/GLOffscreenAutoDrawableImpl.java
+++ b/src/jogl/classes/jogamp/opengl/GLOffscreenAutoDrawableImpl.java
@@ -57,7 +57,7 @@ public class GLOffscreenAutoDrawableImpl extends GLAutoDrawableDelegate implemen
}
@Override
- public void setSize(int newWidth, int newHeight) throws NativeWindowException, GLException {
+ public void setSurfaceSize(int newWidth, int newHeight) throws NativeWindowException, GLException {
this.defaultWindowResizedOp(newWidth, newHeight);
}
diff --git a/src/jogl/classes/jogamp/opengl/egl/EGLDummyUpstreamSurfaceHook.java b/src/jogl/classes/jogamp/opengl/egl/EGLDummyUpstreamSurfaceHook.java
index 6deaa26c7..205a94951 100644
--- a/src/jogl/classes/jogamp/opengl/egl/EGLDummyUpstreamSurfaceHook.java
+++ b/src/jogl/classes/jogamp/opengl/egl/EGLDummyUpstreamSurfaceHook.java
@@ -10,10 +10,10 @@ import com.jogamp.nativewindow.egl.EGLGraphicsDevice;
/** Uses a PBuffer offscreen surface */
public class EGLDummyUpstreamSurfaceHook extends UpstreamSurfaceHookMutableSize {
/**
- * @param width the initial width as returned by {@link NativeSurface#getSurfaceWidth()} via {@link UpstreamSurfaceHook#getPixelWidth(ProxySurface)},
+ * @param width the initial width as returned by {@link NativeSurface#getSurfaceWidth()} via {@link UpstreamSurfaceHook#getSurfaceWidth(ProxySurface)},
* not the actual dummy surface width.
* The latter is platform specific and small
- * @param height the initial height as returned by {@link NativeSurface#getSurfaceHeight()} via {@link UpstreamSurfaceHook#getPixelHeight(ProxySurface)},
+ * @param height the initial height as returned by {@link NativeSurface#getSurfaceHeight()} via {@link UpstreamSurfaceHook#getSurfaceHeight(ProxySurface)},
* not the actual dummy surface height,
* The latter is platform specific and small
*/
diff --git a/src/jogl/classes/jogamp/opengl/egl/EGLUpstreamSurfaceHook.java b/src/jogl/classes/jogamp/opengl/egl/EGLUpstreamSurfaceHook.java
index 8cc4580a7..d0dc79437 100644
--- a/src/jogl/classes/jogamp/opengl/egl/EGLUpstreamSurfaceHook.java
+++ b/src/jogl/classes/jogamp/opengl/egl/EGLUpstreamSurfaceHook.java
@@ -45,9 +45,9 @@ public class EGLUpstreamSurfaceHook implements UpstreamSurfaceHook.MutableSize {
static String getThreadName() { return Thread.currentThread().getName(); }
@Override
- public final void setPixelSize(int width, int height) {
+ public final void setSurfaceSize(int width, int height) {
if(null != upstreamSurfaceHookMutableSize) {
- upstreamSurfaceHookMutableSize.setPixelSize(width, height);
+ upstreamSurfaceHookMutableSize.setSurfaceSize(width, height);
}
}
@@ -199,12 +199,12 @@ public class EGLUpstreamSurfaceHook implements UpstreamSurfaceHook.MutableSize {
}
@Override
- public final int getPixelWidth(ProxySurface s) {
+ public final int getSurfaceWidth(ProxySurface s) {
return upstreamSurface.getSurfaceWidth();
}
@Override
- public final int getPixelHeight(ProxySurface s) {
+ public final int getSurfaceHeight(ProxySurface s) {
return upstreamSurface.getSurfaceHeight();
}
diff --git a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLContext.java b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLContext.java
index d3cfffdea..485fbd0a0 100644
--- a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLContext.java
+++ b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLContext.java
@@ -859,11 +859,7 @@ public class MacOSXCGLContext extends GLContextImpl
}
// All CALayer lifecycle ops are deferred on main-thread
- final int[] winSize;
- {
- final int[] pixelSize = { lastWidth, lastHeight };
- winSize = drawable.getNativeSurface().getWindowUnitXY(pixelSize, pixelSize);
- }
+ final int[] winSize = drawable.getNativeSurface().convertToWindowUnits(new int[]{ lastWidth, lastHeight });
attachGLLayerCmd = new AttachGLLayerCmd(
backingLayerHost, ctx, gl3ShaderProgramName, pixelFormat, pbufferHandle, texID,
chosenCaps.isBackgroundOpaque(), lastWidth, lastHeight, winSize[0], winSize[1] );
diff --git a/src/nativewindow/classes/com/jogamp/nativewindow/DelegatedUpstreamSurfaceHookWithSurfaceSize.java b/src/nativewindow/classes/com/jogamp/nativewindow/DelegatedUpstreamSurfaceHookWithSurfaceSize.java
index db4a979d1..9a462105f 100644
--- a/src/nativewindow/classes/com/jogamp/nativewindow/DelegatedUpstreamSurfaceHookWithSurfaceSize.java
+++ b/src/nativewindow/classes/com/jogamp/nativewindow/DelegatedUpstreamSurfaceHookWithSurfaceSize.java
@@ -10,7 +10,7 @@ public class DelegatedUpstreamSurfaceHookWithSurfaceSize implements UpstreamSurf
/**
* @param upstream optional upstream UpstreamSurfaceHook used for {@link #create(ProxySurface)} and {@link #destroy(ProxySurface)}.
- * @param surface mandatory {@link NativeSurface} used for {@link #getPixelWidth(ProxySurface)} and {@link #getPixelHeight(ProxySurface)}
+ * @param surface mandatory {@link NativeSurface} used for {@link #getSurfaceWidth(ProxySurface)} and {@link #getSurfaceHeight(ProxySurface)}
*/
public DelegatedUpstreamSurfaceHookWithSurfaceSize(UpstreamSurfaceHook upstream, NativeSurface surface) {
this.upstream = upstream;
@@ -35,12 +35,12 @@ public class DelegatedUpstreamSurfaceHookWithSurfaceSize implements UpstreamSurf
}
@Override
- public final int getPixelWidth(ProxySurface s) {
+ public final int getSurfaceWidth(ProxySurface s) {
return surface.getSurfaceWidth();
}
@Override
- public final int getPixelHeight(ProxySurface s) {
+ public final int getSurfaceHeight(ProxySurface s) {
return surface.getSurfaceHeight();
}
diff --git a/src/nativewindow/classes/com/jogamp/nativewindow/UpstreamSurfaceHookMutableSize.java b/src/nativewindow/classes/com/jogamp/nativewindow/UpstreamSurfaceHookMutableSize.java
index 5910f5fea..25e2bbd49 100644
--- a/src/nativewindow/classes/com/jogamp/nativewindow/UpstreamSurfaceHookMutableSize.java
+++ b/src/nativewindow/classes/com/jogamp/nativewindow/UpstreamSurfaceHookMutableSize.java
@@ -16,18 +16,18 @@ public class UpstreamSurfaceHookMutableSize implements UpstreamSurfaceHook.Mutab
}
@Override
- public final void setPixelSize(int width, int height) {
+ public final void setSurfaceSize(int width, int height) {
this.pixWidth = width;
this.pixHeight = height;
}
@Override
- public final int getPixelWidth(ProxySurface s) {
+ public final int getSurfaceWidth(ProxySurface s) {
return pixWidth;
}
@Override
- public final int getPixelHeight(ProxySurface s) {
+ public final int getSurfaceHeight(ProxySurface s) {
return pixHeight;
}
@Override
diff --git a/src/nativewindow/classes/com/jogamp/nativewindow/UpstreamWindowHookMutableSizePos.java b/src/nativewindow/classes/com/jogamp/nativewindow/UpstreamWindowHookMutableSizePos.java
index f761b522a..2e9a33801 100644
--- a/src/nativewindow/classes/com/jogamp/nativewindow/UpstreamWindowHookMutableSizePos.java
+++ b/src/nativewindow/classes/com/jogamp/nativewindow/UpstreamWindowHookMutableSizePos.java
@@ -28,6 +28,9 @@ public class UpstreamWindowHookMutableSizePos extends UpstreamSurfaceHookMutable
public final void setWinSize(int winWidth, int winHeight) {
this.winWidth= winWidth;
this.winHeight= winHeight;
+ // FIXME HiDPI: Use pixelScale ?!
+ // FIXME HiDPI: Consider setting winWidth/winHeight by setSurfaceSize(..) (back-propagation)
+ this.setSurfaceSize(winWidth, winHeight);
}
public final int getX() {
diff --git a/src/nativewindow/classes/com/jogamp/nativewindow/awt/JAWTWindow.java b/src/nativewindow/classes/com/jogamp/nativewindow/awt/JAWTWindow.java
index e35716c49..24bc8fa51 100644
--- a/src/nativewindow/classes/com/jogamp/nativewindow/awt/JAWTWindow.java
+++ b/src/nativewindow/classes/com/jogamp/nativewindow/awt/JAWTWindow.java
@@ -648,19 +648,19 @@ public abstract class JAWTWindow implements NativeWindow, OffscreenLayerSurface,
}
@Override
- public final int[] getWindowUnitXY(int[] result, final int[] pixelUnitXY) {
+ public final int[] convertToWindowUnits(final int[] pixelUnitsAndResult) {
final int scale = getPixelScale();
- result[0] = pixelUnitXY[0] / scale;
- result[1] = pixelUnitXY[1] / scale;
- return result;
+ pixelUnitsAndResult[0] /= scale;
+ pixelUnitsAndResult[1] /= scale;
+ return pixelUnitsAndResult;
}
@Override
- public final int[] getPixelUnitXY(int[] result, final int[] windowUnitXY) {
+ public final int[] convertToPixelUnits(final int[] windowUnitsAndResult) {
final int scale = getPixelScale();
- result[0] = windowUnitXY[0] * scale;
- result[1] = windowUnitXY[1] * scale;
- return result;
+ windowUnitsAndResult[0] *= scale;
+ windowUnitsAndResult[1] *= scale;
+ return windowUnitsAndResult;
}
@Override
diff --git a/src/nativewindow/classes/javax/media/nativewindow/NativeSurface.java b/src/nativewindow/classes/javax/media/nativewindow/NativeSurface.java
index d5cc048a1..f8596bc74 100644
--- a/src/nativewindow/classes/javax/media/nativewindow/NativeSurface.java
+++ b/src/nativewindow/classes/javax/media/nativewindow/NativeSurface.java
@@ -181,7 +181,7 @@ public interface NativeSurface extends SurfaceUpdatedListener {
* Returns the width of the client area excluding insets (window decorations) in pixel units.
* @return width of the client area in pixel units
* @see NativeWindow#getWindowWidth()
- * @see #getWindowUnitXY(int[], int[])
+ * @see #convertToWindowUnits(int[])
*/
public int getSurfaceWidth();
@@ -189,25 +189,25 @@ public interface NativeSurface extends SurfaceUpdatedListener {
* Returns the height of the client area excluding insets (window decorations) in pixel units.
* @return height of the client area in pixel units
* @see NativeWindow#getWindowHeight()
- * @see #getWindowUnitXY(int[], int[])
+ * @see #convertToWindowUnits(int[])
*/
public int getSurfaceHeight();
/**
- * Converts the given pixel units into window units.
- * @param result int[2] storage for the result, may be equal to pixelUnitXY (in-place)
- * @param pixelUnitXY int[2] x- and y-coord values in pixel units
- * @return result int[2] storage for chaining holding the converted values
+ * Converts the given pixel units into window units <i>in place</i>.
+ * @param pixelUnitsAndResult int[2] storage holding the pixel units for the x- and y-coord to convert
+ * and the resulting values.
+ * @return result int[2] storage pixelUnitsAndResult for chaining holding the converted values
*/
- public int[] getWindowUnitXY(int[] result, final int[] pixelUnitXY);
+ public int[] convertToWindowUnits(final int[] pixelUnitsAndResult);
/**
- * Converts the given window units into pixel units.
- * @param result int[2] storage for the result, may be equal to windowUnitXY (in-place)
- * @param windowUnitXY int[2] x- and y-coord values in window units
- * @return result int[2] storage for chaining holding the converted values
+ * Converts the given window units into pixel units <i>in place</i>.
+ * @param windowUnitsAndResult int[2] storage holding the window units for the x- and y-coord to convert
+ * and the resulting values.
+ * @return result int[2] storage windowUnitsAndResult for chaining holding the converted values
*/
- public int[] getPixelUnitXY(int[] result, final int[] windowUnitXY);
+ public int[] convertToPixelUnits(final int[] windowUnitsAndResult);
/**
* Returns the graphics configuration corresponding to this window.
diff --git a/src/nativewindow/classes/javax/media/nativewindow/UpstreamSurfaceHook.java b/src/nativewindow/classes/javax/media/nativewindow/UpstreamSurfaceHook.java
index 39e316856..1a13b050a 100644
--- a/src/nativewindow/classes/javax/media/nativewindow/UpstreamSurfaceHook.java
+++ b/src/nativewindow/classes/javax/media/nativewindow/UpstreamSurfaceHook.java
@@ -39,14 +39,19 @@ public interface UpstreamSurfaceHook {
public void destroy(ProxySurface s);
/** Returns the width of the upstream surface in pixels, used if {@link ProxySurface#UPSTREAM_PROVIDES_SIZE} is set. */
- public int getPixelWidth(ProxySurface s);
+ public int getSurfaceWidth(ProxySurface s);
/** Returns the height of the upstream surface in pixels, used if {@link ProxySurface#UPSTREAM_PROVIDES_SIZE} is set. */
- public int getPixelHeight(ProxySurface s);
+ public int getSurfaceHeight(ProxySurface s);
/**
* {@link UpstreamSurfaceHook} w/ mutable size, allowing it's {@link ProxySurface} user to resize.
*/
public interface MutableSize extends UpstreamSurfaceHook {
- public void setPixelSize(int width, int height);
+ /**
+ * Resizes the upstream surface.
+ * @param width new width in pixel units
+ * @param height new height in pixel units
+ */
+ public void setSurfaceSize(int width, int height);
}
}
diff --git a/src/nativewindow/classes/javax/media/nativewindow/util/Point.java b/src/nativewindow/classes/javax/media/nativewindow/util/Point.java
index 331c1388e..e544118d0 100644
--- a/src/nativewindow/classes/javax/media/nativewindow/util/Point.java
+++ b/src/nativewindow/classes/javax/media/nativewindow/util/Point.java
@@ -106,22 +106,54 @@ public class Point implements Cloneable, PointImmutable {
public final void setX(int x) { this.x = x; }
public final void setY(int y) { this.y = y; }
+ /**
+ * Translate this instance's x- and y-components,
+ * i.e. add the values of the given delta point to them.
+ * @param pd delta point
+ * @return this instance for scaling
+ */
public final Point translate(Point pd) {
x += pd.x ;
y += pd.y ;
return this;
}
+ /**
+ * Translate this instance's x- and y-components,
+ * i.e. add the given deltas to them.
+ * @param dx delta for x
+ * @param dy delta for y
+ * @return this instance for scaling
+ */
public final Point translate(int dx, int dy) {
x += dx ;
y += dy ;
return this;
}
+ /**
+ * Scale this instance's x- and y-components,
+ * i.e. multiply them by the given scale factors.
+ * @param sx scale factor for x
+ * @param sy scale factor for y
+ * @return this instance for scaling
+ */
public final Point scale(int sx, int sy) {
x *= sx ;
y *= sy ;
return this;
}
+ /**
+ * Inverse scale this instance's x- and y-components,
+ * i.e. divide them by the given scale factors.
+ * @param sx inverse scale factor for x
+ * @param sy inverse scale factor for y
+ * @return this instance for scaling
+ */
+ public final Point scaleInv(int sx, int sy) {
+ x /= sx ;
+ y /= sy ;
+ return this;
+ }
}
diff --git a/src/nativewindow/classes/jogamp/nativewindow/ProxySurfaceImpl.java b/src/nativewindow/classes/jogamp/nativewindow/ProxySurfaceImpl.java
index dd1b6f185..969e012a6 100644
--- a/src/nativewindow/classes/jogamp/nativewindow/ProxySurfaceImpl.java
+++ b/src/nativewindow/classes/jogamp/nativewindow/ProxySurfaceImpl.java
@@ -150,12 +150,12 @@ public abstract class ProxySurfaceImpl implements ProxySurface {
@Override
public final int getSurfaceWidth() {
- return upstream.getPixelWidth(this);
+ return upstream.getSurfaceWidth(this);
}
@Override
public final int getSurfaceHeight() {
- return upstream.getPixelHeight(this);
+ return upstream.getSurfaceHeight(this);
}
@Override
diff --git a/src/nativewindow/classes/jogamp/nativewindow/WrappedSurface.java b/src/nativewindow/classes/jogamp/nativewindow/WrappedSurface.java
index 5601dac02..902223c80 100644
--- a/src/nativewindow/classes/jogamp/nativewindow/WrappedSurface.java
+++ b/src/nativewindow/classes/jogamp/nativewindow/WrappedSurface.java
@@ -98,20 +98,13 @@ public class WrappedSurface extends ProxySurfaceImpl {
}
@Override
- public final int[] getWindowUnitXY(int[] result, final int[] pixelUnitXY) {
- final int scale = 1; // FIXME: Use 'scale' ..
- result[0] = pixelUnitXY[0] / scale;
- result[1] = pixelUnitXY[1] / scale;
- return result;
+ public final int[] convertToWindowUnits(final int[] pixelUnitsAndResult) {
+ return pixelUnitsAndResult; // FIXME HiDPI: use 'pixelScale'
}
@Override
- public final int[] getPixelUnitXY(int[] result, final int[] windowUnitXY) {
- final int scale = 1; // FIXME: Use 'scale' ..
- result[0] = windowUnitXY[0] * scale;
- result[1] = windowUnitXY[1] * scale;
- return result;
+ public final int[] convertToPixelUnits(final int[] windowUnitsAndResult) {
+ return windowUnitsAndResult; // FIXME HiDPI: use 'pixelScale'
}
-
-}
+} \ No newline at end of file
diff --git a/src/nativewindow/classes/jogamp/nativewindow/macosx/OSXDummyUpstreamSurfaceHook.java b/src/nativewindow/classes/jogamp/nativewindow/macosx/OSXDummyUpstreamSurfaceHook.java
index 5a51aca3e..98ea68f4f 100644
--- a/src/nativewindow/classes/jogamp/nativewindow/macosx/OSXDummyUpstreamSurfaceHook.java
+++ b/src/nativewindow/classes/jogamp/nativewindow/macosx/OSXDummyUpstreamSurfaceHook.java
@@ -11,10 +11,10 @@ public class OSXDummyUpstreamSurfaceHook extends UpstreamSurfaceHookMutableSize
long nsWindow;
/**
- * @param width the initial width as returned by {@link NativeSurface#getSurfaceWidth()} via {@link UpstreamSurfaceHook#getPixelWidth(ProxySurface)},
+ * @param width the initial width as returned by {@link NativeSurface#getSurfaceWidth()} via {@link UpstreamSurfaceHook#getSurfaceWidth(ProxySurface)},
* not the actual dummy surface width.
* The latter is platform specific and small
- * @param height the initial height as returned by {@link NativeSurface#getSurfaceHeight()} via {@link UpstreamSurfaceHook#getPixelHeight(ProxySurface)},
+ * @param height the initial height as returned by {@link NativeSurface#getSurfaceHeight()} via {@link UpstreamSurfaceHook#getSurfaceHeight(ProxySurface)},
* not the actual dummy surface height,
* The latter is platform specific and small
*/
diff --git a/src/nativewindow/classes/jogamp/nativewindow/windows/GDIDummyUpstreamSurfaceHook.java b/src/nativewindow/classes/jogamp/nativewindow/windows/GDIDummyUpstreamSurfaceHook.java
index 9c74950e0..bf59a6639 100644
--- a/src/nativewindow/classes/jogamp/nativewindow/windows/GDIDummyUpstreamSurfaceHook.java
+++ b/src/nativewindow/classes/jogamp/nativewindow/windows/GDIDummyUpstreamSurfaceHook.java
@@ -9,10 +9,10 @@ import com.jogamp.nativewindow.UpstreamSurfaceHookMutableSize;
public class GDIDummyUpstreamSurfaceHook extends UpstreamSurfaceHookMutableSize {
/**
- * @param width the initial width as returned by {@link NativeSurface#getSurfaceWidth()} via {@link UpstreamSurfaceHook#getPixelWidth(ProxySurface)},
+ * @param width the initial width as returned by {@link NativeSurface#getSurfaceWidth()} via {@link UpstreamSurfaceHook#getSurfaceWidth(ProxySurface)},
* not the actual dummy surface width.
* The latter is platform specific and small
- * @param height the initial height as returned by {@link NativeSurface#getSurfaceHeight()} via {@link UpstreamSurfaceHook#getPixelHeight(ProxySurface)},
+ * @param height the initial height as returned by {@link NativeSurface#getSurfaceHeight()} via {@link UpstreamSurfaceHook#getSurfaceHeight(ProxySurface)},
* not the actual dummy surface height,
* The latter is platform specific and small
*/
diff --git a/src/nativewindow/classes/jogamp/nativewindow/windows/GDISurface.java b/src/nativewindow/classes/jogamp/nativewindow/windows/GDISurface.java
index c4ec0f653..c9e48e94e 100644
--- a/src/nativewindow/classes/jogamp/nativewindow/windows/GDISurface.java
+++ b/src/nativewindow/classes/jogamp/nativewindow/windows/GDISurface.java
@@ -130,19 +130,13 @@ public class GDISurface extends ProxySurfaceImpl {
}
@Override
- public final int[] getWindowUnitXY(int[] result, final int[] pixelUnitXY) {
- if( pixelUnitXY != result ) { // no scale factor, window units == pixel units
- System.arraycopy(pixelUnitXY, 0, result, 0, 2);
- }
- return result;
+ public final int[] convertToWindowUnits(final int[] pixelUnitsAndResult) {
+ return pixelUnitsAndResult; // no pixelScale factor
}
@Override
- public final int[] getPixelUnitXY(int[] result, final int[] windowUnitXY) {
- if( windowUnitXY != result ) { // no scale factor, window units == pixel units
- System.arraycopy(windowUnitXY, 0, result, 0, 2);
- }
- return result;
+ public final int[] convertToPixelUnits(final int[] windowUnitsAndResult) {
+ return windowUnitsAndResult; // no pixelScale factor
}
}
diff --git a/src/nativewindow/classes/jogamp/nativewindow/x11/X11DummyUpstreamSurfaceHook.java b/src/nativewindow/classes/jogamp/nativewindow/x11/X11DummyUpstreamSurfaceHook.java
index 31d168fea..53b303071 100644
--- a/src/nativewindow/classes/jogamp/nativewindow/x11/X11DummyUpstreamSurfaceHook.java
+++ b/src/nativewindow/classes/jogamp/nativewindow/x11/X11DummyUpstreamSurfaceHook.java
@@ -14,10 +14,10 @@ import com.jogamp.nativewindow.x11.X11GraphicsScreen;
public class X11DummyUpstreamSurfaceHook extends UpstreamSurfaceHookMutableSize {
/**
- * @param width the initial width as returned by {@link NativeSurface#getSurfaceWidth()} via {@link UpstreamSurfaceHook#getPixelWidth(ProxySurface)},
+ * @param width the initial width as returned by {@link NativeSurface#getSurfaceWidth()} via {@link UpstreamSurfaceHook#getSurfaceWidth(ProxySurface)},
* not the actual dummy surface width.
* The latter is platform specific and small
- * @param height the initial height as returned by {@link NativeSurface#getSurfaceHeight()} via {@link UpstreamSurfaceHook#getPixelHeight(ProxySurface)},
+ * @param height the initial height as returned by {@link NativeSurface#getSurfaceHeight()} via {@link UpstreamSurfaceHook#getSurfaceHeight(ProxySurface)},
* not the actual dummy surface height,
* The latter is platform specific and small
*/
diff --git a/src/newt/classes/com/jogamp/newt/MonitorDevice.java b/src/newt/classes/com/jogamp/newt/MonitorDevice.java
index 2d1d912c7..1198f7681 100644
--- a/src/newt/classes/com/jogamp/newt/MonitorDevice.java
+++ b/src/newt/classes/com/jogamp/newt/MonitorDevice.java
@@ -168,12 +168,19 @@ public abstract class MonitorDevice {
return supportedModes.getData();
}
- /** Returns the {@link RectangleImmutable rectangular} portion of the rotated virtual {@link Screen} size represented by this monitor. */
+ /**
+ * Returns the {@link RectangleImmutable rectangular} portion
+ * of the rotated virtual {@link Screen} size in screen/window units
+ * represented by this monitor.
+ */
public final RectangleImmutable getViewport() {
return viewport;
}
- /** Returns <code>true</code> if given coordinates are contained by this {@link #getViewport() viewport}, otherwise <code>false</code>. */
+ /**
+ * Returns <code>true</code> if given screen coordinates in screen/window units
+ * are contained by this {@link #getViewport() viewport}, otherwise <code>false</code>.
+ */
public final boolean contains(int x, int y) {
return x >= viewport.getX() &&
x < viewport.getX() + viewport.getWidth() &&
diff --git a/src/newt/classes/com/jogamp/newt/NewtFactory.java b/src/newt/classes/com/jogamp/newt/NewtFactory.java
index 3b31861f0..4443c70c9 100644
--- a/src/newt/classes/com/jogamp/newt/NewtFactory.java
+++ b/src/newt/classes/com/jogamp/newt/NewtFactory.java
@@ -296,7 +296,7 @@ public class NewtFactory {
}
final Window win = WindowImpl.create(parentWindow, 0, screen, caps);
- win.setSize(parentWindow.getSurfaceWidth(), parentWindow.getSurfaceHeight());
+ win.setSize(parentWindow.getWindowWidth(), parentWindow.getWindowHeight());
if ( null != newtParentWindow ) {
newtParentWindow.addChild(win);
win.setVisible(newtParentWindow.isVisible());
diff --git a/src/newt/classes/com/jogamp/newt/Screen.java b/src/newt/classes/com/jogamp/newt/Screen.java
index ef62ec95d..2a713c538 100644
--- a/src/newt/classes/com/jogamp/newt/Screen.java
+++ b/src/newt/classes/com/jogamp/newt/Screen.java
@@ -131,27 +131,27 @@ public abstract class Screen {
public abstract int getIndex();
/**
- * @return the x position of the virtual viewport's top-left origin.
+ * @return the x position of the virtual viewport's top-left origin in screen/window units.
*/
public abstract int getX();
/**
- * @return the y position of the virtual viewport's top-left origin.
+ * @return the y position of the virtual viewport's top-left origin in screen/window units.
*/
public abstract int getY();
/**
- * @return the <b>rotated</b> virtual viewport's width.
+ * @return the <b>rotated</b> virtual viewport's width in screen/window units.
*/
public abstract int getWidth();
/**
- * @return the <b>rotated</b> virtual viewport's height.
+ * @return the <b>rotated</b> virtual viewport's height in screen/window units.
*/
public abstract int getHeight();
/**
- * @return the <b>rotated</b> virtual viewport, i.e. origin and size.
+ * @return the <b>rotated</b> virtual viewport, i.e. origin and size in screen/window units.
*/
public abstract RectangleImmutable getViewport();
@@ -186,6 +186,7 @@ public abstract class Screen {
* <p>
* If no coverage is detected the first {@link MonitorDevice} is returned.
* </p>
+ * @param r arbitrary rectangle in screen/window units
*/
public final MonitorDevice getMainMonitor(RectangleImmutable r) {
MonitorDevice res = null;
@@ -206,7 +207,7 @@ public abstract class Screen {
}
/**
- * Returns the union of all monitor's {@link MonitorDevice#getViewport() viewport}.
+ * Returns the union of all monitor's {@link MonitorDevice#getViewport() viewport} in screen/window units.
* <p>
* Should be equal to {@link #getX()}, {@link #getY()}, {@link #getWidth()} and {@link #getHeight()},
* however, some native toolkits may choose a different virtual screen area.
@@ -257,7 +258,7 @@ public abstract class Screen {
synchronized(screenList) {
int i = fromIndex >= 0 ? fromIndex : screenList.size() - 1 ;
while( ( incr > 0 ) ? i < screenList.size() : i >= 0 ) {
- final Screen screen = (Screen) screenList.get(i).get();
+ final Screen screen = screenList.get(i).get();
if( null == screen ) {
// Clear GC'ed dead reference entry!
screenList.remove(i);
diff --git a/src/newt/classes/com/jogamp/newt/Window.java b/src/newt/classes/com/jogamp/newt/Window.java
index 9cf67c56f..b733406e8 100644
--- a/src/newt/classes/com/jogamp/newt/Window.java
+++ b/src/newt/classes/com/jogamp/newt/Window.java
@@ -46,6 +46,7 @@ import javax.media.nativewindow.CapabilitiesChooser;
import javax.media.nativewindow.CapabilitiesImmutable;
import javax.media.nativewindow.NativeWindow;
import javax.media.nativewindow.WindowClosingProtocol;
+import javax.media.nativewindow.util.Point;
import javax.media.nativewindow.util.RectangleImmutable;
/**
@@ -251,11 +252,38 @@ public interface Window extends NativeWindow, WindowClosingProtocol {
* @param width of the window's client area in window units
* @param height of the window's client area in window units
*
+ * @see #setSurfaceSize(int, int)
+ * @see #setTopLevelSize(int, int)
* @see #getInsets()
*/
void setSize(int width, int height);
/**
+ * Sets the size of the window's surface in pixel units which claims the window's client area excluding decorations.
+ *
+ * <p>
+ * Zero size semantics are respected, see {@link #setVisible(boolean)}:<br>
+ * <pre>
+ * if ( visible && 0 != windowHandle && ( 0 &ge; width || 0 &ge; height ) ) {
+ * setVisible(false);
+ * } else if ( visible && 0 == windowHandle && 0 &lt; width && 0 &lt; height ) {
+ * setVisible(true);
+ * } else {
+ * // as expected ..
+ * }
+ * </pre></p>
+ * <p>
+ * This call is ignored if in fullscreen mode.<br></p>
+ *
+ * @param pixelWidth of the window's client area in pixel units
+ * @param pixelHeight of the window's client area in pixel units
+ *
+ * @see #setSize(int, int)
+ * @see #getInsets()
+ */
+ void setSurfaceSize(int pixelWidth, int pixelHeight);
+
+ /**
* Sets the size of the top-level window including insets (window decorations) in window units.
*
* <p>
@@ -299,6 +327,22 @@ public interface Window extends NativeWindow, WindowClosingProtocol {
*/
void setTopLevelPosition(int x, int y);
+ /**
+ * Converts the given pixel units into window units <i>in place</i>.
+ * @param pixelUnitsAndResult point storage holding the pixel units to convert
+ * and the resulting conversion.
+ * @return resulting point storage pixelUnitsAndResult for chaining holding the converted values
+ */
+ Point convertToWindowUnits(final Point pixelUnitsAndResult);
+
+ /**
+ * Converts the given window units into pixel units <i>in place</i>.
+ * @param windowUnitsAndResult point storage holding the window units to convert
+ * and the resulting conversion.
+ * @return resulting point storage windowUnitsAndResult for chaining holding the converted values
+ */
+ Point convertToPixelUnits(final Point windowUnitsAndResult);
+
void setUndecorated(boolean value);
boolean isUndecorated();
diff --git a/src/newt/classes/com/jogamp/newt/awt/NewtCanvasAWT.java b/src/newt/classes/com/jogamp/newt/awt/NewtCanvasAWT.java
index 891843cb7..0d70b5f8c 100644
--- a/src/newt/classes/com/jogamp/newt/awt/NewtCanvasAWT.java
+++ b/src/newt/classes/com/jogamp/newt/awt/NewtCanvasAWT.java
@@ -400,7 +400,7 @@ public class NewtCanvasAWT extends java.awt.Canvas implements WindowClosingProto
final Window w = newtChild;
if( null != w ) {
// use NEWT child's size for min/pref size!
- java.awt.Dimension minSize = new java.awt.Dimension(w.getSurfaceWidth(), w.getSurfaceHeight());
+ java.awt.Dimension minSize = new java.awt.Dimension(w.getWindowWidth(), w.getWindowHeight());
setMinimumSize(minSize);
setPreferredSize(minSize);
}
diff --git a/src/newt/classes/com/jogamp/newt/opengl/GLWindow.java b/src/newt/classes/com/jogamp/newt/opengl/GLWindow.java
index c4a5fcab1..7ba4bddf0 100644
--- a/src/newt/classes/com/jogamp/newt/opengl/GLWindow.java
+++ b/src/newt/classes/com/jogamp/newt/opengl/GLWindow.java
@@ -363,13 +363,23 @@ public class GLWindow extends GLAutoDrawableBase implements GLAutoDrawable, Wind
}
@Override
- public final int[] getWindowUnitXY(int[] result, final int[] pixelUnitXY) {
- return window.getWindowUnitXY(result, pixelUnitXY);
+ public final int[] convertToWindowUnits(final int[] pixelUnitsAndResult) {
+ return window.convertToWindowUnits(pixelUnitsAndResult);
}
@Override
- public final int[] getPixelUnitXY(int[] result, final int[] windowUnitXY) {
- return window.getPixelUnitXY(result, windowUnitXY);
+ public final int[] convertToPixelUnits(final int[] windowUnitsAndResult) {
+ return window.convertToPixelUnits(windowUnitsAndResult);
+ }
+
+ @Override
+ public final Point convertToWindowUnits(final Point pixelUnitsAndResult) {
+ return window.convertToWindowUnits(pixelUnitsAndResult);
+ }
+
+ @Override
+ public final Point convertToPixelUnits(final Point windowUnitsAndResult) {
+ return window.convertToPixelUnits(windowUnitsAndResult);
}
@Override
@@ -471,6 +481,10 @@ public class GLWindow extends GLAutoDrawableBase implements GLAutoDrawable, Wind
window.setSize(width, height);
}
@Override
+ public final void setSurfaceSize(int pixelWidth, int pixelHeight) {
+ window.setSurfaceSize(pixelWidth, pixelHeight);
+ }
+ @Override
public void setTopLevelSize(int width, int height) {
window.setTopLevelSize(width, height);
}
diff --git a/src/newt/classes/com/jogamp/newt/swt/NewtCanvasSWT.java b/src/newt/classes/com/jogamp/newt/swt/NewtCanvasSWT.java
index ee01212cb..b627fa1ad 100644
--- a/src/newt/classes/com/jogamp/newt/swt/NewtCanvasSWT.java
+++ b/src/newt/classes/com/jogamp/newt/swt/NewtCanvasSWT.java
@@ -470,19 +470,13 @@ public class NewtCanvasSWT extends Canvas implements WindowClosingProtocol {
}
@Override
- public final int[] getWindowUnitXY(int[] result, final int[] pixelUnitXY) {
- final int scale = 1; // FIXME: Use 'scale' ..
- result[0] = pixelUnitXY[0] / scale;
- result[1] = pixelUnitXY[1] / scale;
- return result;
+ public final int[] convertToWindowUnits(final int[] pixelUnitsAndResult) {
+ return pixelUnitsAndResult; // FIXME HiDPI: use 'pixelScale'
}
@Override
- public final int[] getPixelUnitXY(int[] result, final int[] windowUnitXY) {
- final int scale = 1; // FIXME: Use 'scale' ..
- result[0] = windowUnitXY[0] * scale;
- result[1] = windowUnitXY[1] * scale;
- return result;
+ public final int[] convertToPixelUnits(final int[] windowUnitsAndResult) {
+ return windowUnitsAndResult; // FIXME HiDPI: use 'pixelScale'
}
@Override
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 8a3e5616d..7b6a1c8cd 100644
--- a/src/newt/classes/com/jogamp/newt/util/applet/JOGLNewtApplet3Run.java
+++ b/src/newt/classes/com/jogamp/newt/util/applet/JOGLNewtApplet3Run.java
@@ -172,7 +172,7 @@ public class JOGLNewtApplet3Run implements Applet3 {
glWindow = GLWindow.create(w);
glWindow.setUndecorated(glUndecorated);
glWindow.setAlwaysOnTop(glAlwaysOnTop);
- glWindow.setSize(browserWin.getSurfaceWidth(), browserWin.getSurfaceHeight());
+ glWindow.setSize(browserWin.getWindowWidth(), browserWin.getWindowHeight());
return new NativeWindowDownstream() {
@Override
@@ -184,7 +184,7 @@ public class JOGLNewtApplet3Run implements Applet3 {
@Override
public void setSize(int width, int height) {
- upstreamSizePosHook.setPixelSize(width, height);
+ upstreamSizePosHook.setWinSize(width, height);
if( null != glWindow ) {
glWindow.setSize(width, height);
}
diff --git a/src/newt/classes/jogamp/newt/WindowImpl.java b/src/newt/classes/jogamp/newt/WindowImpl.java
index a9fc28a33..b127426a8 100644
--- a/src/newt/classes/jogamp/newt/WindowImpl.java
+++ b/src/newt/classes/jogamp/newt/WindowImpl.java
@@ -195,7 +195,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
/** from event passing: {@link WindowImpl#consumePointerEvent(MouseEvent)}. */
private static class PointerState0 {
/** Pointer entered window - is inside the window (may be synthetic) */
- boolean insideWindow = false;
+ boolean insideSurface = false;
/** Mouse EXIT has been sent (only for MOUSE type enter/exit)*/
boolean exitSent = false;
@@ -208,7 +208,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
void clearButton() {
lastButtonPressTime = 0;
}
- public String toString() { return "PState0[inside "+insideWindow+", exitSent "+exitSent+", lastPress "+lastButtonPressTime+", dragging "+dragging+"]"; }
+ public String toString() { return "PState0[inside "+insideSurface+", exitSent "+exitSent+", lastPress "+lastButtonPressTime+", dragging "+dragging+"]"; }
}
private final PointerState0 pState0 = new PointerState0();
@@ -242,7 +242,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
}
return null;
}
- public final String toString() { return "PState1[inside "+insideWindow+", exitSent "+exitSent+", lastPress "+lastButtonPressTime+
+ public final String toString() { return "PState1[inside "+insideSurface+", exitSent "+exitSent+", lastPress "+lastButtonPressTime+
", pressed [button "+buttonPressed+", mask "+buttonPressedMask+", dragging "+dragging+", clickCount "+lastButtonClickCount+"]"; }
}
private final PointerState1 pState1 = new PointerState1();
@@ -633,10 +633,10 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
* to insets and positioning a decorated window to 0/0, which would place the frame
* outside of the screen.</p>
*
- * @param x client-area position, or <0 if unchanged
- * @param y client-area position, or <0 if unchanged
- * @param width client-area size, or <=0 if unchanged
- * @param height client-area size, or <=0 if unchanged
+ * @param x client-area position in window units, or <0 if unchanged
+ * @param y client-area position in window units, or <0 if unchanged
+ * @param width client-area size in window units, or <=0 if unchanged
+ * @param height client-area size in window units, or <=0 if unchanged
* @param flags bitfield of change and status flags
*
* @see #sizeChanged(int,int)
@@ -709,7 +709,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
/**
* Translates the given window client-area coordinates with top-left origin
- * to screen coordinates.
+ * to screen coordinates in window units.
* <p>
* Since the position reflects the client area, it does not include the insets.
* </p>
@@ -722,7 +722,8 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
*/
protected abstract Point getLocationOnScreenImpl(int x, int y);
- /** Triggered by user via {@link #getInsets()}.<br>
+ /**
+ * Triggered by user via {@link #getInsets()}.<br>
* Implementations may implement this hook to update the insets.<br>
* However, they may prefer the event driven path via {@link #insetsChanged(boolean, int, int, int, int)}.
*
@@ -911,9 +912,16 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
@Override
public final MonitorDevice getMainMonitor() {
- return screen.getMainMonitor(new Rectangle(getX(), getY(), getSurfaceWidth(), getSurfaceHeight()));
+ return screen.getMainMonitor(new Rectangle(getX(), getY(), getWindowWidth(), getWindowHeight()));
}
+ /**
+ * @param visible
+ * @param x client-area position in window units, or <0 if unchanged
+ * @param y client-area position in window units, or <0 if unchanged
+ * @param width client-area size in window units, or <=0 if unchanged
+ * @param height client-area size in window units, or <=0 if unchanged
+ */
protected final void setVisibleImpl(boolean visible, int x, int y, int width, int height) {
reconfigureWindowImpl(x, y, width, height, getReconfigureFlags(FLAG_CHANGE_VISIBILITY, visible));
}
@@ -935,7 +943,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
}
}
if(!isNativeValid() && visible) {
- if( 0<getSurfaceWidth()*getSurfaceHeight() ) {
+ if( 0<getWindowWidth()*getWindowHeight() ) {
nativeWindowCreated = createNative();
madeVisible = nativeWindowCreated;
}
@@ -943,7 +951,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
WindowImpl.this.visible = true;
} else if(WindowImpl.this.visible != visible) {
if(isNativeValid()) {
- setVisibleImpl(visible, getX(), getY(), getSurfaceWidth(), getSurfaceHeight());
+ setVisibleImpl(visible, getX(), getY(), getWindowWidth(), getWindowHeight());
WindowImpl.this.waitForVisible(visible, false);
madeVisible = visible;
} else {
@@ -966,7 +974,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
}
}
if(DEBUG_IMPLEMENTATION) {
- System.err.println("Window setVisible: END ("+getThreadName()+") "+getX()+"/"+getY()+" "+getSurfaceWidth()+"x"+getSurfaceHeight()+", fs "+fullscreen+", windowHandle "+toHexString(windowHandle)+", visible: "+WindowImpl.this.visible+", nativeWindowCreated: "+nativeWindowCreated+", madeVisible: "+madeVisible);
+ System.err.println("Window setVisible: END ("+getThreadName()+") "+getX()+"/"+getY()+" "+getWindowWidth()+"x"+getWindowHeight()+", fs "+fullscreen+", windowHandle "+toHexString(windowHandle)+", visible: "+WindowImpl.this.visible+", nativeWindowCreated: "+nativeWindowCreated+", madeVisible: "+madeVisible);
}
} finally {
if(null!=lifecycleHook) {
@@ -994,7 +1002,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
@Override
public final void setVisible(boolean wait, boolean visible) {
if(DEBUG_IMPLEMENTATION) {
- System.err.println("Window setVisible: START ("+getThreadName()+") "+getX()+"/"+getY()+" "+getSurfaceWidth()+"x"+getSurfaceHeight()+", fs "+fullscreen+", windowHandle "+toHexString(windowHandle)+", visible: "+this.visible+" -> "+visible+", parentWindowHandle "+toHexString(parentWindowHandle)+", parentWindow "+(null!=parentWindow));
+ System.err.println("Window setVisible: START ("+getThreadName()+") "+getX()+"/"+getY()+" "+getWindowWidth()+"x"+getWindowHeight()+", fs "+fullscreen+", windowHandle "+toHexString(windowHandle)+", visible: "+this.visible+" -> "+visible+", parentWindowHandle "+toHexString(parentWindowHandle)+", parentWindow "+(null!=parentWindow));
}
runOnEDTIfAvail(wait, new VisibleAction(visible));
}
@@ -1019,9 +1027,9 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
final RecursiveLock _lock = windowLock;
_lock.lock();
try {
- if ( ( disregardFS || !isFullscreen() ) && ( getSurfaceWidth() != width || getSurfaceHeight() != height ) ) {
+ if ( ( disregardFS || !isFullscreen() ) && ( getWindowWidth() != width || getWindowHeight() != height ) ) {
if(DEBUG_IMPLEMENTATION) {
- System.err.println("Window setSize: START "+getSurfaceWidth()+"x"+getSurfaceHeight()+" -> "+width+"x"+height+", fs "+fullscreen+", windowHandle "+toHexString(windowHandle)+", visible "+visible);
+ System.err.println("Window setSize: START "+getWindowWidth()+"x"+getWindowHeight()+" -> "+width+"x"+height+", fs "+fullscreen+", windowHandle "+toHexString(windowHandle)+", visible "+visible);
}
int visibleAction; // 0 nop, 1 invisible, 2 visible (create)
if ( visible && isNativeValid() && ( 0 >= width || 0 >= height ) ) {
@@ -1041,7 +1049,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
defineSize(width, height);
}
if(DEBUG_IMPLEMENTATION) {
- System.err.println("Window setSize: END "+getSurfaceWidth()+"x"+getSurfaceHeight()+", visibleAction "+visibleAction);
+ System.err.println("Window setSize: END "+getWindowWidth()+"x"+getWindowHeight()+", visibleAction "+visibleAction);
}
switch(visibleAction) {
case 1: setVisibleActionImpl(false); break;
@@ -1054,15 +1062,20 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
}
}
- private void setFullscreenSize(int width, int height) {
+ private void setFullscreenSize(final int width, final int height) {
runOnEDTIfAvail(true, new SetSizeAction(width, height, true));
}
@Override
- public final void setSize(int width, int height) {
+ public final void setSize(final int width, final int height) {
runOnEDTIfAvail(true, new SetSizeAction(width, height, false));
}
@Override
- public final void setTopLevelSize(int width, int height) {
+ public final void setSurfaceSize(final int pixelWidth, final int pixelHeight) {
+ final int[] winSize = convertToWindowUnits(new int[]{pixelWidth, pixelHeight});
+ setSize(winSize[0], winSize[1]);
+ }
+ @Override
+ public final void setTopLevelSize(final int width, final int height) {
setSize(width - getInsets().getTotalWidth(), height - getInsets().getTotalHeight());
}
@@ -1248,8 +1261,8 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
// mirror pos/size so native change notification can get overwritten
final int oldX = getX();
final int oldY = getY();
- final int oldWidth = getSurfaceWidth();
- final int oldHeight = getSurfaceHeight();
+ final int oldWidth = getWindowWidth();
+ final int oldHeight = getWindowHeight();
final int x, y;
int width = oldWidth;
int height = oldHeight;
@@ -1300,11 +1313,11 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
y = 0;
// refit if size is bigger than parent
- if( width > newParentWindow.getSurfaceWidth() ) {
- width = newParentWindow.getSurfaceWidth();
+ if( width > newParentWindow.getWindowWidth() ) {
+ width = newParentWindow.getWindowWidth();
}
- if( height > newParentWindow.getSurfaceHeight() ) {
- height = newParentWindow.getSurfaceHeight();
+ if( height > newParentWindow.getWindowHeight() ) {
+ height = newParentWindow.getWindowHeight();
}
// Case: Child Window
@@ -1511,7 +1524,10 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
}
if(DEBUG_IMPLEMENTATION) {
- System.err.println("Window.reparent: END-1 ("+getThreadName()+") windowHandle "+toHexString(windowHandle)+", visible: "+visible+", parentWindowHandle "+toHexString(parentWindowHandle)+", parentWindow "+ Display.hashCodeNullSafe(parentWindow)+" "+getX()+"/"+getY()+" "+getSurfaceWidth()+"x"+getSurfaceHeight());
+ System.err.println("Window.reparent: END-1 ("+getThreadName()+") windowHandle "+toHexString(windowHandle)+
+ ", visible: "+visible+", parentWindowHandle "+toHexString(parentWindowHandle)+
+ ", parentWindow "+ Display.hashCodeNullSafe(parentWindow)+" "+
+ getX()+"/"+getY()+" "+getWindowWidth()+"x"+getWindowHeight());
}
} finally {
if(null!=lifecycleHook) {
@@ -1535,7 +1551,10 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
}
}
if(DEBUG_IMPLEMENTATION) {
- System.err.println("Window.reparent: END-X ("+getThreadName()+") windowHandle "+toHexString(windowHandle)+", visible: "+visible+", parentWindowHandle "+toHexString(parentWindowHandle)+", parentWindow "+ Display.hashCodeNullSafe(parentWindow)+" "+getX()+"/"+getY()+" "+getSurfaceWidth()+"x"+getSurfaceHeight());
+ System.err.println("Window.reparent: END-X ("+getThreadName()+") windowHandle "+toHexString(windowHandle)+
+ ", visible: "+visible+", parentWindowHandle "+toHexString(parentWindowHandle)+
+ ", parentWindow "+ Display.hashCodeNullSafe(parentWindow)+" "+
+ getX()+"/"+getY()+" "+getWindowWidth()+"x"+getWindowHeight());
}
}
}
@@ -1612,8 +1631,8 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
// Mirror pos/size so native change notification can get overwritten
final int x = getX();
final int y = getY();
- final int width = getSurfaceWidth();
- final int height = getSurfaceHeight();
+ final int width = getWindowWidth();
+ final int height = getWindowHeight();
DisplayImpl display = (DisplayImpl) screen.getDisplay();
display.dispatchMessagesNative(); // status up2date
@@ -1658,8 +1677,8 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
// Mirror pos/size so native change notification can get overwritten
final int x = getX();
final int y = getY();
- final int width = getSurfaceWidth();
- final int height = getSurfaceHeight();
+ final int width = getWindowWidth();
+ final int height = getWindowHeight();
DisplayImpl display = (DisplayImpl) screen.getDisplay();
display.dispatchMessagesNative(); // status up2date
@@ -1869,31 +1888,42 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
@Override
public final int getWindowWidth() {
- return getSurfaceWidth(); // FIXME: Use 'scale' or an actual pixel-width
+ return winWidth;
}
@Override
public final int getWindowHeight() {
- return getSurfaceHeight(); // FIXME: Use 'scale' or an actual pixel-width
+ return winHeight;
+ }
+
+ @Override
+ public final int[] convertToWindowUnits(final int[] pixelUnitsAndResult) {
+ pixelUnitsAndResult[0] /= getPixelScaleX();
+ pixelUnitsAndResult[1] /= getPixelScaleY();
+ return pixelUnitsAndResult;
}
@Override
- public final int[] getWindowUnitXY(int[] result, final int[] pixelUnitXY) {
- final int scale = 1; // FIXME: Use 'scale' ..
- result[0] = pixelUnitXY[0] / scale;
- result[1] = pixelUnitXY[1] / scale;
- return result;
+ public final int[] convertToPixelUnits(final int[] windowUnitsAndResult) {
+ windowUnitsAndResult[0] *= getPixelScaleX();
+ windowUnitsAndResult[1] *= getPixelScaleY();
+ return windowUnitsAndResult;
}
@Override
- public final int[] getPixelUnitXY(int[] result, final int[] windowUnitXY) {
- final int scale = 1; // FIXME: Use 'scale' ..
- result[0] = windowUnitXY[0] * scale;
- result[1] = windowUnitXY[1] * scale;
- return result;
+ public final Point convertToWindowUnits(final Point pixelUnitsAndResult) {
+ return pixelUnitsAndResult.scaleInv(getPixelScaleX(), getPixelScaleY());
}
@Override
+ public final Point convertToPixelUnits(final Point windowUnitsAndResult) {
+ return windowUnitsAndResult.scale(getPixelScaleX(), getPixelScaleY());
+ }
+
+ protected int getPixelScaleX() { return 1; }
+ protected int getPixelScaleY() { return 1; }
+
+ @Override
public final int getX() {
return x;
}
@@ -1905,7 +1935,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
protected final boolean autoPosition() { return autoPosition; }
- /** Sets the position fields {@link #x} and {@link #y} to the given values and {@link #autoPosition} to false. */
+ /** Sets the position fields {@link #x} and {@link #y} in window units to the given values and {@link #autoPosition} to false. */
protected final void definePosition(int x, int y) {
if(DEBUG_IMPLEMENTATION) {
System.err.println("definePosition: "+this.x+"/"+this.y+" -> "+x+"/"+y);
@@ -1915,13 +1945,19 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
this.x = x; this.y = y;
}
- /** Sets the size fields {@link #pixWidth} and {@link #pixHeight} to the given values. */
- protected final void defineSize(int width, int height) {
+ /**
+ * Sets the size fields {@link #winWidth} and {@link #winHeight} in window units to the given values
+ * and {@link #pixWidth} and {@link #pixHeight} in pixel units according to {@link #convertToPixelUnits(int[])}.
+ */
+ protected final void defineSize(int winWidth, int winHeight) {
+ final int[] pixelSize = convertToPixelUnits(new int[] { winWidth, winHeight });
if(DEBUG_IMPLEMENTATION) {
- System.err.println("defineSize: "+this.pixWidth+"x"+this.pixHeight+" -> "+width+"x"+height);
+ System.err.println("defineSize: win["+this.winWidth+"x"+this.winHeight+" -> "+winWidth+"x"+winHeight+
+ "], pixel["+this.pixWidth+"x"+this.pixHeight+" -> "+pixelSize[0]+"x"+pixelSize[1]+"]");
// Thread.dumpStack();
}
- this.pixWidth = width; this.pixHeight = height;
+ this.winWidth = winWidth; this.winHeight = winHeight;
+ this.pixWidth = pixelSize[0]; this.pixHeight = pixelSize[0];
}
@Override
@@ -1987,17 +2023,17 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
StringBuilder sb = new StringBuilder();
sb.append(getClass().getName()+"[Config "+config+
- "\n, "+screen+
- "\n, ParentWindow "+parentWindow+
- "\n, ParentWindowHandle "+toHexString(parentWindowHandle)+" ("+(0!=getParentWindowHandle())+")"+
- "\n, WindowHandle "+toHexString(getWindowHandle())+
- "\n, SurfaceHandle "+toHexString(getSurfaceHandle())+ " (lockedExt window "+windowLock.isLockedByOtherThread()+", surface "+isSurfaceLockedByOtherThread()+")"+
- "\n, Pos "+getX()+"/"+getY()+" (auto "+autoPosition()+"), size "+getSurfaceWidth()+"x"+getSurfaceHeight()+
- "\n, Visible "+isVisible()+", focus "+hasFocus()+
- "\n, Undecorated "+undecorated+" ("+isUndecorated()+")"+
- "\n, AlwaysOnTop "+alwaysOnTop+", Fullscreen "+fullscreen+
- "\n, WrappedSurface "+getWrappedSurface()+
- "\n, ChildWindows "+childWindows.size());
+ ",\n "+screen+
+ ",\n ParentWindow "+parentWindow+
+ ",\n ParentWindowHandle "+toHexString(parentWindowHandle)+" ("+(0!=getParentWindowHandle())+")"+
+ ",\n WindowHandle "+toHexString(getWindowHandle())+
+ ",\n SurfaceHandle "+toHexString(getSurfaceHandle())+ " (lockedExt window "+windowLock.isLockedByOtherThread()+", surface "+isSurfaceLockedByOtherThread()+")"+
+ ",\n window["+getX()+"/"+getY()+" (auto "+autoPosition()+") "+getWindowWidth()+"x"+getWindowHeight()+"], pixel["+getSurfaceWidth()+"x"+getSurfaceHeight()+
+ "],\n Visible "+isVisible()+", focus "+hasFocus()+
+ ",\n Undecorated "+undecorated+" ("+isUndecorated()+")"+
+ ",\n AlwaysOnTop "+alwaysOnTop+", Fullscreen "+fullscreen+
+ ",\n WrappedSurface "+getWrappedSurface()+
+ ",\n ChildWindows "+childWindows.size());
sb.append(", SurfaceUpdatedListeners num "+surfaceUpdatedHelper.size()+" [");
for (int i = 0; i < surfaceUpdatedHelper.size(); i++ ) {
@@ -2138,7 +2174,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
if ( !isFullscreen() && ( getX() != x || getY() != y || null != getParent()) ) {
if(isNativeValid()) {
// this.x/this.y will be set by sizeChanged, triggered by windowing event system
- reconfigureWindowImpl(x, y, getSurfaceWidth(), getSurfaceHeight(), getReconfigureFlags(0, isVisible()));
+ reconfigureWindowImpl(x, y, getWindowWidth(), getWindowHeight(), getReconfigureFlags(0, isVisible()));
if( null == parentWindow ) {
// Wait until custom position is reached within tolerances
waitForPosition(true, x, y, Window.TIMEOUT_NATIVEWINDOW);
@@ -2186,8 +2222,8 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
try {
final int oldX = getX();
final int oldY = getY();
- final int oldWidth = getSurfaceWidth();
- final int oldHeight = getSurfaceHeight();
+ final int oldWidth = getWindowWidth();
+ final int oldHeight = getWindowHeight();
int x,y,w,h;
@@ -2240,11 +2276,11 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
y = 0;
// refit if size is bigger than parent
- if( w > parentWindow.getSurfaceWidth() ) {
- w = parentWindow.getSurfaceWidth();
+ if( w > parentWindow.getWindowWidth() ) {
+ w = parentWindow.getWindowWidth();
}
- if( h > parentWindow.getSurfaceHeight() ) {
- h = parentWindow.getSurfaceHeight();
+ if( h > parentWindow.getWindowHeight() ) {
+ h = parentWindow.getWindowHeight();
}
}
}
@@ -2415,10 +2451,10 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
// Simply move/resize window to fit in virtual screen if required
final RectangleImmutable viewport = screen.getViewport();
if( viewport.getWidth() > 0 && viewport.getHeight() > 0 ) { // failsafe
- final RectangleImmutable rect = new Rectangle(getX(), getY(), getSurfaceWidth(), getSurfaceHeight());
+ final RectangleImmutable rect = new Rectangle(getX(), getY(), getWindowWidth(), getWindowHeight());
final RectangleImmutable isect = viewport.intersection(rect);
- if ( getSurfaceHeight() > isect.getHeight() ||
- getSurfaceWidth() > isect.getWidth() ) {
+ if ( getWindowHeight() > isect.getHeight() ||
+ getWindowWidth() > isect.getWidth() ) {
if(DEBUG_IMPLEMENTATION) {
System.err.println("Window.monitorModeChanged: fit window "+rect+" into screen viewport "+viewport+
", due to minimal intersection "+isect);
@@ -2441,7 +2477,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
if( fullscreenMonitors.contains(md) ) {
final RectangleImmutable viewport = MonitorDevice.unionOfViewports(new Rectangle(), fullscreenMonitors);
if(DEBUG_IMPLEMENTATION) {
- final RectangleImmutable rect = new Rectangle(getX(), getY(), getSurfaceWidth(), getSurfaceHeight());
+ final RectangleImmutable rect = new Rectangle(getX(), getY(), getWindowWidth(), getWindowHeight());
System.err.println("Window.monitorModeChanged: FS Monitor Match: Fit window "+rect+" into new viewport union "+viewport+", provoked by "+md);
}
definePosition(viewport.getX(), viewport.getY()); // set pos for setVisible(..) or createNative(..) - reduce EDT roundtrip
@@ -2762,7 +2798,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
//
int x = pX[0];
int y = pY[0];
- final boolean insideWindow = x >= 0 && y >= 0 && x < getSurfaceWidth() && y < getSurfaceHeight();
+ final boolean insideSurface = x >= 0 && y >= 0 && x < getSurfaceWidth() && y < getSurfaceHeight();
final Point movePositionP0 = pState1.getMovePosition(pID[0]);
switch( eventType ) {
case MouseEvent.EVENT_MOUSE_EXITED:
@@ -2786,10 +2822,10 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
case MouseEvent.EVENT_MOUSE_ENTERED:
if( eventType == MouseEvent.EVENT_MOUSE_ENTERED ) {
- pState1.insideWindow = true;
+ pState1.insideSurface = true;
pState1.exitSent = false;
} else {
- pState1.insideWindow = false;
+ pState1.insideSurface = false;
pState1.exitSent = true;
}
pState1.clearButton();
@@ -2821,10 +2857,10 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
// Fall through intended !
default:
- if( pState1.insideWindow != insideWindow ) {
+ if( pState1.insideSurface != insideSurface ) {
// ENTER/EXIT!
- pState1.insideWindow = insideWindow;
- if( insideWindow ) {
+ pState1.insideSurface = insideSurface;
+ if( insideSurface ) {
pState1.exitSent = false;
}
pState1.clearButton();
@@ -2835,10 +2871,10 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
// Drop exterior events if not dragging pointer and not EXIT event
// Safeguard for non compliant implementations!
//
- if( !pState1.dragging && !insideWindow && MouseEvent.EVENT_MOUSE_EXITED != eventType ) {
+ if( !pState1.dragging && !insideSurface && MouseEvent.EVENT_MOUSE_EXITED != eventType ) {
if(DEBUG_MOUSE_EVENT) {
System.err.println("doPointerEvent: drop: "+MouseEvent.getEventTypeString(eventType)+
- ", mod "+modifiers+", pos "+x+"/"+y+", button "+button+", lastMousePosition: "+movePositionP0+", insideWindow "+insideWindow+", "+pState1);
+ ", mod "+modifiers+", pos "+x+"/"+y+", button "+button+", lastMousePosition: "+movePositionP0+", insideWindow "+insideSurface+", "+pState1);
}
return; // .. invalid ..
}
@@ -2976,7 +3012,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
//
final long when = pe.getWhen();
final int eventType = pe.getEventType();
- final boolean insideWindow;
+ final boolean insideSurface;
boolean eExitAllowed = false;
MouseEvent eEntered = null, eExited = null;
switch( eventType ) {
@@ -2994,13 +3030,13 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
y = Math.min(Math.max(y, 0), getSurfaceHeight()-1);
pState0.clearButton();
if( eventType == MouseEvent.EVENT_MOUSE_ENTERED ) {
- insideWindow = true;
- pState0.insideWindow = true;
+ insideSurface = true;
+ pState0.insideSurface = true;
pState0.exitSent = false;
pState0.dragging = false;
} else {
- insideWindow = false;
- pState0.insideWindow = false;
+ insideSurface = false;
+ pState0.insideSurface = false;
pState0.exitSent = true;
}
break;
@@ -3014,16 +3050,16 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
// Fall through intended !
default:
- insideWindow = x >= 0 && y >= 0 && x < getSurfaceWidth() && y < getWindowHeight();
+ insideSurface = x >= 0 && y >= 0 && x < getSurfaceWidth() && y < getSurfaceHeight();
if( pe.getPointerType(0) == PointerType.Mouse ) {
- if( !pState0.insideWindow && insideWindow ) {
+ if( !pState0.insideSurface && insideSurface ) {
// ENTER .. use clipped coordinates
eEntered = new MouseEvent(MouseEvent.EVENT_MOUSE_ENTERED, pe.getSource(), pe.getWhen(), pe.getModifiers(),
Math.min(Math.max(x, 0), getSurfaceWidth()-1),
Math.min(Math.max(y, 0), getSurfaceHeight()-1),
(short)0, (short)0, pe.getRotation(), pe.getRotationScale());
pState0.exitSent = false;
- } else if( !insideWindow && eExitAllowed ) {
+ } else if( !insideSurface && eExitAllowed ) {
// EXIT .. use clipped coordinates
eExited = new MouseEvent(MouseEvent.EVENT_MOUSE_EXITED, pe.getSource(), pe.getWhen(), pe.getModifiers(),
Math.min(Math.max(x, 0), getSurfaceWidth()-1),
@@ -3032,17 +3068,17 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
pState0.exitSent = true;
}
}
- if( pState0.insideWindow != insideWindow || null != eEntered || null != eExited) {
+ if( pState0.insideSurface != insideSurface || null != eEntered || null != eExited) {
pState0.clearButton();
}
- pState0.insideWindow = insideWindow;
+ pState0.insideSurface = insideSurface;
}
if( null != eEntered ) {
if(DEBUG_MOUSE_EVENT) {
System.err.println("consumePointerEvent.send.0: "+eEntered+", "+pState0);
}
dispatchMouseEvent(eEntered);
- } else if( DEBUG_MOUSE_EVENT && !insideWindow ) {
+ } else if( DEBUG_MOUSE_EVENT && !insideSurface ) {
System.err.println("INFO consumePointerEvent.exterior: "+pState0+", "+pe);
}
@@ -3624,11 +3660,13 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
}
}
- /** Triggered by implementation's WM events to update the client-area size w/o insets/decorations. */
+ /** Triggered by implementation's WM events to update the client-area size in window units w/o insets/decorations. */
protected void sizeChanged(boolean defer, int newWidth, int newHeight, boolean force) {
- if(force || getSurfaceWidth() != newWidth || getSurfaceHeight() != newHeight) {
+ if(force || getWindowWidth() != newWidth || getWindowHeight() != newHeight) {
if(DEBUG_IMPLEMENTATION) {
- System.err.println("Window.sizeChanged: ("+getThreadName()+"): (defer: "+defer+") force "+force+", "+getSurfaceWidth()+"x"+getSurfaceHeight()+" -> "+newWidth+"x"+newHeight+" - windowHandle "+toHexString(windowHandle)+" parentWindowHandle "+toHexString(parentWindowHandle));
+ System.err.println("Window.sizeChanged: ("+getThreadName()+"): (defer: "+defer+") force "+force+", "+
+ getWindowWidth()+"x"+getWindowHeight()+" -> "+newWidth+"x"+newHeight+
+ " - windowHandle "+toHexString(windowHandle)+" parentWindowHandle "+toHexString(parentWindowHandle));
}
if(0>newWidth || 0>newHeight) {
throw new NativeWindowException("Illegal width or height "+newWidth+"x"+newHeight+" (must be >= 0)");
@@ -3648,12 +3686,12 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
final DisplayImpl display = (DisplayImpl) screen.getDisplay();
display.dispatchMessagesNative(); // status up2date
long sleep;
- for(sleep = timeOut; 0<sleep && w!=getSurfaceWidth() && h!=getSurfaceHeight(); sleep-=10 ) {
+ for(sleep = timeOut; 0<sleep && w!=getWindowWidth() && h!=getWindowHeight(); sleep-=10 ) {
try { Thread.sleep(10); } catch (InterruptedException ie) {}
display.dispatchMessagesNative(); // status up2date
}
if(0 >= sleep) {
- final String msg = "Size/Pos not reached as requested within "+timeOut+"ms : requested "+w+"x"+h+", is "+getSurfaceWidth()+"x"+getSurfaceHeight();
+ final String msg = "Size/Pos not reached as requested within "+timeOut+"ms : requested "+w+"x"+h+", is "+getWindowWidth()+"x"+getWindowHeight();
if(failFast) {
throw new NativeWindowException(msg);
} else if (DEBUG_IMPLEMENTATION) {
@@ -3805,10 +3843,10 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
/**
* Triggered by implementation's WM events to update the content
* @param defer if true sent event later, otherwise wait until processed.
- * @param x dirty-region y-pos in pixels
- * @param y dirty-region x-pos in pixels
- * @param width dirty-region width in pixels
- * @param height dirty-region height in pixels
+ * @param x dirty-region y-pos in pixel units
+ * @param y dirty-region x-pos in pixel units
+ * @param width dirty-region width in pixel units
+ * @param height dirty-region height in pixel units
*/
protected final void windowRepaint(boolean defer, int x, int y, int width, int height) {
width = ( 0 >= width ) ? getSurfaceWidth() : width;
diff --git a/src/newt/classes/jogamp/newt/awt/event/AWTParentWindowAdapter.java b/src/newt/classes/jogamp/newt/awt/event/AWTParentWindowAdapter.java
index 8b6bb95a9..26faa4550 100644
--- a/src/newt/classes/jogamp/newt/awt/event/AWTParentWindowAdapter.java
+++ b/src/newt/classes/jogamp/newt/awt/event/AWTParentWindowAdapter.java
@@ -124,7 +124,7 @@ public class AWTParentWindowAdapter extends AWTWindowAdapter implements java.awt
final int cw = comp.getWidth();
final int ch = comp.getHeight();
if( 0 < cw && 0 < ch ) {
- if( newtChild.getSurfaceWidth() != cw || newtChild.getSurfaceHeight() != ch ) {
+ if( newtChild.getWindowWidth() != cw || newtChild.getWindowHeight() != ch ) {
newtChild.setSize(cw, ch);
final boolean v = comp.isShowing(); // compute showing-state throughout hierarchy
if(v != newtChild.isVisible()) {
diff --git a/src/newt/classes/jogamp/newt/driver/android/NewtBaseActivity.java b/src/newt/classes/jogamp/newt/driver/android/NewtBaseActivity.java
index 5fe378f2c..22294a212 100644
--- a/src/newt/classes/jogamp/newt/driver/android/NewtBaseActivity.java
+++ b/src/newt/classes/jogamp/newt/driver/android/NewtBaseActivity.java
@@ -3,14 +3,14 @@
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
@@ -20,7 +20,7 @@
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of JogAmp Community.
@@ -50,21 +50,21 @@ import android.view.WindowManager;
public class NewtBaseActivity extends Activity {
List<Window> newtWindows = new ArrayList<Window>();
List<GLAutoDrawable> glAutoDrawables = new ArrayList<GLAutoDrawable>();
-
+
GLAnimatorControl animator = null;
-
+
boolean isDelegatedActivity;
Activity rootActivity;
boolean setThemeCalled = false;
-
+
protected void startAnimation(boolean start) {
if(null != animator) {
final boolean res;
if( start ) {
- if( animator.isPaused() ) {
- res = animator.resume();
- } else {
- res = animator.start();
+ if( animator.isPaused() ) {
+ res = animator.resume();
+ } else {
+ res = animator.start();
}
} else {
res = animator.stop();
@@ -76,10 +76,10 @@ public class NewtBaseActivity extends Activity {
if(null != anim) {
final boolean res;
if( start ) {
- if( anim.isPaused() ) {
- res = anim.resume();
- } else {
- res = anim.start();
+ if( anim.isPaused() ) {
+ res = anim.resume();
+ } else {
+ res = anim.start();
}
} else {
res = anim.stop();
@@ -88,32 +88,32 @@ public class NewtBaseActivity extends Activity {
}
}
}
-
+
public NewtBaseActivity() {
super();
isDelegatedActivity = false;
rootActivity = this;
}
-
+
public void setRootActivity(Activity rootActivity) {
this.rootActivity = rootActivity;
this.isDelegatedActivity = this != rootActivity;
}
-
+
public final boolean isDelegatedActivity() {
return isDelegatedActivity;
}
-
+
public final Activity getActivity() {
return rootActivity;
- }
-
+ }
+
/**
* This is one of the three registration methods (see below).
* <p>
* This methods issues {@link android.view.Window#setContentView(android.view.View, android.view.ViewGroup.LayoutParams) androidWindow.setContenView(newtWindow.getAndroidView())}
* and finally calls {@link #registerNEWTWindow(Window)}.
- * </p>
+ * </p>
* @param androidWindow
* @param newtWindow
* @throws IllegalArgumentException if the <code>newtWindow</code>'s {@link Window#getDelegatedWindow() delegate} is not an AndroidDriver.
@@ -128,7 +128,7 @@ public class NewtBaseActivity extends Activity {
final WindowDriver newtAWindow = (WindowDriver)delegateWindow;
androidWindow.setContentView(newtAWindow.getAndroidView());
} else {
- throw new IllegalArgumentException("Given NEWT Window is not an Android Window: "+newtWindow.getClass().getName());
+ throw new IllegalArgumentException("Given NEWT Window is not an Android Window: "+newtWindow.getClass().getName());
}
registerNEWTWindow(newtWindow);
}
@@ -137,7 +137,7 @@ public class NewtBaseActivity extends Activity {
* <p>
* This methods issues {@link android.view.Window#addContentView(android.view.View, android.view.ViewGroup.LayoutParams) androidWindow.addContenView(newtWindow.getAndroidView(), params)}
* and finally calls {@link #registerNEWTWindow(Window)}.
- * </p>
+ * </p>
* @param androidWindow
* @param newtWindow
* @param params
@@ -151,8 +151,8 @@ public class NewtBaseActivity extends Activity {
final WindowDriver newtAWindow = (WindowDriver)delegateWindow;
androidWindow.addContentView(newtAWindow.getAndroidView(), params);
} else {
- throw new IllegalArgumentException("Given NEWT Window's Delegate is not an Android Window: "+delegateWindow.getClass().getName());
- }
+ throw new IllegalArgumentException("Given NEWT Window's Delegate is not an Android Window: "+delegateWindow.getClass().getName());
+ }
registerNEWTWindow(newtWindow);
}
/**
@@ -161,15 +161,15 @@ public class NewtBaseActivity extends Activity {
* This methods registers the given NEWT window to ensure it's destruction at {@link #onDestroy()}.
* </p>
* <p>
- * If adding a {@link GLAutoDrawable} implementation, the {@link GLAnimatorControl} retrieved by {@link GLAutoDrawable#getAnimator()}
+ * If adding a {@link GLAutoDrawable} implementation, the {@link GLAnimatorControl} retrieved by {@link GLAutoDrawable#getAnimator()}
* will be used for {@link #onPause()} and {@link #onResume()}.
* </p>
* <p>
- * If adding a {@link GLAutoDrawable} implementation, the {@link GLEventListenerState} will preserve it's state
- * when {@link #onPause()} is being called while not {@link #isFinishing()}. A later {@link #onResume()} will
+ * If adding a {@link GLAutoDrawable} implementation, the {@link GLEventListenerState} will preserve it's state
+ * when {@link #onPause()} is being called while not {@link #isFinishing()}. A later {@link #onResume()} will
* reinstate the {@link GLEventListenerState}.
* </p>
- *
+ *
* @param newtWindow
* @throws IllegalArgumentException if the <code>newtWindow</code>'s {@link Window#getDelegatedWindow() delegate} is not an AndroidDriver.
* @see #setContentView(android.view.Window, Window)
@@ -182,8 +182,8 @@ public class NewtBaseActivity extends Activity {
final WindowDriver newtAWindow = (WindowDriver)delegateWindow;
newtAWindow.registerActivity(getActivity());
} else {
- throw new IllegalArgumentException("Given NEWT Window's Delegate is not an Android Window: "+delegateWindow.getClass().getName());
- }
+ throw new IllegalArgumentException("Given NEWT Window's Delegate is not an Android Window: "+delegateWindow.getClass().getName());
+ }
newtWindows.add(newtWindow);
if(newtWindow instanceof GLAutoDrawable) {
glAutoDrawables.add((GLAutoDrawable)newtWindow);
@@ -203,9 +203,9 @@ public class NewtBaseActivity extends Activity {
startAnimation(true);
}
};
-
+
/**
- * Convenient method to set the Android window's flags to fullscreen or size-layout depending on the given NEWT window.
+ * Convenient method to set the Android window's flags to fullscreen or size-layout depending on the given NEWT window.
* <p>
* Must be called before creating the view and adding any content, i.e. setContentView() !
* </p>
@@ -216,7 +216,7 @@ public class NewtBaseActivity extends Activity {
if(null == androidWindow || null == newtWindow) {
throw new IllegalArgumentException("Android or NEWT Window null");
}
-
+
if( newtWindow.isFullscreen() || newtWindow.isUndecorated() ) {
androidWindow.requestFeature(android.view.Window.FEATURE_NO_TITLE);
}
@@ -225,16 +225,16 @@ public class NewtBaseActivity extends Activity {
androidWindow.clearFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN);
} else {
androidWindow.addFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN);
- androidWindow.clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
+ androidWindow.clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
+ }
+
+ if(newtWindow.getWindowWidth()>0 && newtWindow.getWindowHeight()>0 && !newtWindow.isFullscreen()) {
+ androidWindow.setLayout(newtWindow.getWindowWidth(), newtWindow.getWindowHeight());
}
-
- if(newtWindow.getSurfaceWidth()>0 && newtWindow.getSurfaceHeight()>0 && !newtWindow.isFullscreen()) {
- androidWindow.setLayout(newtWindow.getSurfaceWidth(), newtWindow.getSurfaceHeight());
- }
}
/**
- * Convenient method to set the Android window's flags to fullscreen or size-layout depending on the given NEWT window.
+ * Convenient method to set the Android window's flags to fullscreen or size-layout depending on the given NEWT window.
* <p>
* Must be called before creating the view and adding any content, i.e. setContentView() !
* </p>
@@ -245,7 +245,7 @@ public class NewtBaseActivity extends Activity {
if(null == androidWindow) {
throw new IllegalArgumentException("Android or Window null");
}
-
+
if( fullscreen ) {
androidWindow.requestFeature(android.view.Window.FEATURE_NO_TITLE);
androidWindow.addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
@@ -255,9 +255,9 @@ public class NewtBaseActivity extends Activity {
androidWindow.clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
}
}
-
+
/**
- * Convenient method to set this context's theme to transparency depending on {@link CapabilitiesImmutable#isBackgroundOpaque()}.
+ * Convenient method to set this context's theme to transparency depending on {@link CapabilitiesImmutable#isBackgroundOpaque()}.
* <p>
* Must be called before creating the view and adding any content, i.e. setContentView() !
* </p>
@@ -267,7 +267,7 @@ public class NewtBaseActivity extends Activity {
setTransparencyTheme();
}
}
-
+
/**
* Convenient method to set this context's theme to transparency.
* <p>
@@ -279,12 +279,12 @@ public class NewtBaseActivity extends Activity {
* </p>
* <p>
* Can be called only once.
- * </p>
+ * </p>
*/
public void setTransparencyTheme() {
if(!setThemeCalled) {
setThemeCalled = true;
- final Context ctx = getActivity().getApplicationContext();
+ final Context ctx = getActivity().getApplicationContext();
final String frn = ctx.getPackageName()+":style/Theme.Transparent";
final int resID = ctx.getResources().getIdentifier("Theme.Transparent", "style", ctx.getPackageName());
if(0 == resID) {
@@ -295,14 +295,14 @@ public class NewtBaseActivity extends Activity {
}
}
}
-
+
/**
* Setting up a global {@Link GLAnimatorControl} for {@link #onPause()} and {@link #onResume()}.
* <p>
* Note that if adding a {@link GLAutoDrawable} implementation via {@link #registerNEWTWindow(Window)},
* {@link #setContentView(android.view.Window, Window)} or {@link #addContentView(android.view.Window, Window, android.view.ViewGroup.LayoutParams)}
* their {@link GLAnimatorControl} retrieved by {@link GLAutoDrawable#getAnimator()} will be used as well.
- * In this case, using this global {@Link GLAnimatorControl} is redundant.
+ * In this case, using this global {@Link GLAnimatorControl} is redundant.
* </p>
* @see #registerNEWTWindow(Window)
* @see #setContentView(android.view.Window, Window)
@@ -315,7 +315,7 @@ public class NewtBaseActivity extends Activity {
}
animator.pause();
}
-
+
@Override
public android.view.Window getWindow() {
if( isDelegatedActivity() ) {
@@ -324,22 +324,22 @@ public class NewtBaseActivity extends Activity {
return super.getWindow();
}
}
-
+
@Override
public void onCreate(Bundle savedInstanceState) {
Log.d(MD.TAG, "onCreate.0");
if(!isDelegatedActivity()) {
super.onCreate(savedInstanceState);
}
- // Extraordinary cleanup, for cases of 'onCreate()' calls w/ valid states,
+ // Extraordinary cleanup, for cases of 'onCreate()' calls w/ valid states,
// i.e. w/o having onDestroy() being called.
// Could happened due to spec when App process is killed for memory exhaustion or other reasons.
cleanup();
-
+
jogamp.common.os.android.StaticContext.init(rootActivity.getApplicationContext());
Log.d(MD.TAG, "onCreate.X");
}
-
+
@Override
public void onStart() {
Log.d(MD.TAG, "onStart.0");
@@ -348,7 +348,7 @@ public class NewtBaseActivity extends Activity {
}
Log.d(MD.TAG, "onStart.X");
}
-
+
@Override
public void onRestart() {
Log.d(MD.TAG, "onRestart.0");
@@ -407,11 +407,11 @@ public class NewtBaseActivity extends Activity {
win.setVisible(false);
}
if( !isDelegatedActivity() ) {
- super.onStop();
+ super.onStop();
}
Log.d(MD.TAG, "onStop.X");
}
-
+
/**
* Performs cleaning up all references,
* <p>
@@ -450,14 +450,14 @@ public class NewtBaseActivity extends Activity {
jogamp.common.os.android.StaticContext.clear();
Log.d(MD.TAG, "cleanup.X");
}
-
+
@Override
public void onDestroy() {
Log.d(MD.TAG, "onDestroy.0");
cleanup(); // normal cleanup
if(!isDelegatedActivity()) {
- super.onDestroy();
+ super.onDestroy();
}
Log.d(MD.TAG, "onDestroy.X");
- }
+ }
}
diff --git a/src/newt/classes/jogamp/newt/driver/android/WindowDriver.java b/src/newt/classes/jogamp/newt/driver/android/WindowDriver.java
index 20163f96c..93ff0c1e0 100644
--- a/src/newt/classes/jogamp/newt/driver/android/WindowDriver.java
+++ b/src/newt/classes/jogamp/newt/driver/android/WindowDriver.java
@@ -304,7 +304,7 @@ public class WindowDriver extends jogamp.newt.WindowImpl implements Callback2 {
if(null == androidView) {
setupAndroidView( StaticContext.getContext() );
}
- viewGroup.addView(androidView, new android.widget.FrameLayout.LayoutParams(getSurfaceWidth(), getSurfaceHeight(), Gravity.BOTTOM|Gravity.RIGHT));
+ viewGroup.addView(androidView, new android.widget.FrameLayout.LayoutParams(getWindowWidth(), getWindowHeight(), Gravity.BOTTOM|Gravity.RIGHT));
Log.d(MD.TAG, "canCreateNativeImpl: added to static ViewGroup - on thread "+Thread.currentThread().getName());
} });
for(long sleep = TIMEOUT_NATIVEWINDOW; 0<sleep && 0 == surfaceHandle; sleep-=10 ) {
@@ -462,7 +462,7 @@ public class WindowDriver extends jogamp.newt.WindowImpl implements Callback2 {
Log.d(MD.TAG, "reconfigureWindowImpl.setFullscreen post creation (setContentView()) n/a");
return false;
}
- if(getSurfaceWidth() != width || getSurfaceHeight() != height) {
+ if(getWindowWidth() != width || getWindowHeight() != height) {
if(0!=getWindowHandle()) {
Log.d(MD.TAG, "reconfigureWindowImpl.setSize n/a");
res = false;
@@ -548,7 +548,8 @@ public class WindowDriver extends jogamp.newt.WindowImpl implements Callback2 {
@Override
public final void surfaceCreated(SurfaceHolder holder) {
- Log.d(MD.TAG, "surfaceCreated: "+getX()+"/"+getY()+" "+getSurfaceWidth()+"x"+getSurfaceHeight()+" - on thread "+Thread.currentThread().getName());
+ Log.d(MD.TAG, "surfaceCreated: win["+getX()+"/"+getY()+" "+getWindowWidth()+"x"+getWindowHeight()+
+ "], pixels["+" "+getSurfaceWidth()+"x"+getSurfaceHeight()+"] - on thread "+Thread.currentThread().getName());
}
@Override
@@ -586,15 +587,15 @@ public class WindowDriver extends jogamp.newt.WindowImpl implements Callback2 {
nativeFormat = getSurfaceVisualID0(surfaceHandle);
Log.d(MD.TAG, "surfaceChanged: androidFormat "+androidFormat+" -- (set-native "+aNativeWindowFormat+") --> nativeFormat "+nativeFormat);
- final int nWidth = getWidth0(surfaceHandle);
- final int nHeight = getHeight0(surfaceHandle);
+ final int[] newSurfSize = { getWidth0(surfaceHandle), getHeight0(surfaceHandle) };
+ final int[] newWinSize = convertToWindowUnits(new int[]{ newSurfSize[0], newSurfSize[1] }); // HiDPI: Not necessary yet ..
capsByFormat = (GLCapabilitiesImmutable) fixCaps(true /* matchFormatPrecise */, nativeFormat, getRequestedCapabilities());
- sizeChanged(false, nWidth, nHeight, false);
+ sizeChanged(false, newWinSize[0], newWinSize[1], false);
Log.d(MD.TAG, "surfaceRealized: isValid: "+surface.isValid()+
", new surfaceHandle 0x"+Long.toHexString(surfaceHandle)+
- ", format [a "+androidFormat+"/n "+nativeFormat+"], "+
- getX()+"/"+getY()+" "+nWidth+"x"+nHeight+", visible: "+isVisible());
+ ", format [a "+androidFormat+"/n "+nativeFormat+"], win["+
+ getX()+"/"+getY()+" "+newWinSize[0]+"x"+newWinSize[1]+"], pixel["+newSurfSize[0]+"x"+newSurfSize[1]+"], visible: "+isVisible());
if(isVisible()) {
setVisible(false, true);
diff --git a/src/newt/classes/jogamp/newt/driver/awt/WindowDriver.java b/src/newt/classes/jogamp/newt/driver/awt/WindowDriver.java
index 965426d4e..f99476851 100644
--- a/src/newt/classes/jogamp/newt/driver/awt/WindowDriver.java
+++ b/src/newt/classes/jogamp/newt/driver/awt/WindowDriver.java
@@ -132,7 +132,7 @@ public class WindowDriver extends WindowImpl {
new AWTWindowAdapter(new LocalWindowListener(), this).addTo(awtCanvas); // fwd all AWT Window events to here
}
- reconfigureWindowImpl(getX(), getY(), getSurfaceWidth(), getSurfaceHeight(), getReconfigureFlags(FLAG_CHANGE_VISIBILITY | FLAG_CHANGE_DECORATION, true));
+ reconfigureWindowImpl(getX(), getY(), getWindowWidth(), getWindowHeight(), getReconfigureFlags(FLAG_CHANGE_VISIBILITY | FLAG_CHANGE_DECORATION, true));
// throws exception if failed ..
final NativeWindow nw = awtCanvas.getNativeWindow();
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 5b0d21c66..be7e8fd07 100644
--- a/src/newt/classes/jogamp/newt/driver/bcm/egl/WindowDriver.java
+++ b/src/newt/classes/jogamp/newt/driver/bcm/egl/WindowDriver.java
@@ -67,7 +67,7 @@ public class WindowDriver extends jogamp.newt.WindowImpl {
setGraphicsConfiguration(cfg);
setSizeImpl(getScreen().getWidth(), getScreen().getHeight());
- setWindowHandle(realizeWindow(true, getSurfaceWidth(), getSurfaceHeight()));
+ setWindowHandle(realizeWindow(true, getWindowWidth(), getWindowHeight()));
if (0 == getWindowHandle()) {
throw new NativeWindowException("Error native Window Handle is null");
}
@@ -108,7 +108,7 @@ public class WindowDriver extends jogamp.newt.WindowImpl {
// n/a in BroadcomEGL
System.err.println("BCEGL Window.setSizeImpl n/a in BroadcomEGL with realized window");
} else {
- defineSize((width>0)?width:getSurfaceWidth(), (height>0)?height:getSurfaceHeight());
+ defineSize((width>0)?width:getWindowWidth(), (height>0)?height:getWindowHeight());
}
}
if(x>=0 || y>=0) {
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 817ce3aeb..1c927acc4 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
@@ -110,7 +110,7 @@ public class WindowDriver extends WindowImpl {
chosenCaps.setBackgroundOpaque(capsRequested.isBackgroundOpaque());
}
setGraphicsConfiguration(cfg);
- nativeWindowHandle = CreateWindow0(display.getBCMHandle(), layer, getX(), getY(), getSurfaceWidth(), getSurfaceHeight(),
+ nativeWindowHandle = CreateWindow0(display.getBCMHandle(), layer, getX(), getY(), getWindowWidth(), getWindowHeight(),
chosenCaps.isBackgroundOpaque(), chosenCaps.getAlphaBits());
if (nativeWindowHandle == 0) {
throw new NativeWindowException("Error creating egl window: "+cfg);
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 d86cf7471..7e15d0258 100644
--- a/src/newt/classes/jogamp/newt/driver/intel/gdl/WindowDriver.java
+++ b/src/newt/classes/jogamp/newt/driver/intel/gdl/WindowDriver.java
@@ -66,7 +66,8 @@ public class WindowDriver extends jogamp.newt.WindowImpl {
synchronized(WindowDriver.class) {
setWindowHandle(nextWindowHandle++); // just a marker
- surfaceHandle = CreateSurface(aDevice.getHandle(), getScreen().getWidth(), getScreen().getHeight(), getX(), getY(), getSurfaceWidth(), getSurfaceHeight());
+ surfaceHandle = CreateSurface(aDevice.getHandle(), getScreen().getWidth(), getScreen().getHeight(),
+ getX(), getY(), getWindowWidth(), getWindowHeight());
if (surfaceHandle == 0) {
throw new NativeWindowException("Error creating window");
}
diff --git a/src/newt/classes/jogamp/newt/driver/kd/WindowDriver.java b/src/newt/classes/jogamp/newt/driver/kd/WindowDriver.java
index 35e9227d3..0b909bc08 100644
--- a/src/newt/classes/jogamp/newt/driver/kd/WindowDriver.java
+++ b/src/newt/classes/jogamp/newt/driver/kd/WindowDriver.java
@@ -112,8 +112,8 @@ public class WindowDriver extends WindowImpl {
}
// int _x=(x>=0)?x:this.x;
// int _y=(x>=0)?y:this.y;
- width=(width>0)?width:getSurfaceWidth();
- height=(height>0)?height:getSurfaceHeight();
+ width=(width>0)?width:getWindowWidth();
+ height=(height>0)?height:getWindowHeight();
if(width>0 || height>0) {
setSize0(eglWindowHandle, width, height);
}
@@ -158,7 +158,7 @@ public class WindowDriver extends WindowImpl {
@Override
protected void sizeChanged(boolean defer, int newWidth, int newHeight, boolean force) {
if(isFullscreen()) {
- ((ScreenDriver)getScreen()).sizeChanged(getSurfaceWidth(), getSurfaceHeight());
+ ((ScreenDriver)getScreen()).sizeChanged(getWindowWidth(), getWindowHeight());
}
super.sizeChanged(defer, newWidth, newHeight, force);
}
diff --git a/src/newt/classes/jogamp/newt/driver/macosx/WindowDriver.java b/src/newt/classes/jogamp/newt/driver/macosx/WindowDriver.java
index 8f3eb1e89..eebf280de 100644
--- a/src/newt/classes/jogamp/newt/driver/macosx/WindowDriver.java
+++ b/src/newt/classes/jogamp/newt/driver/macosx/WindowDriver.java
@@ -70,7 +70,7 @@ public class WindowDriver extends WindowImpl implements MutableSurface, DriverCl
throw new NativeWindowException("Error choosing GraphicsConfiguration creating window: "+this);
}
setGraphicsConfiguration(cfg);
- reconfigureWindowImpl(getX(), getY(), getSurfaceWidth(), getSurfaceHeight(), getReconfigureFlags(FLAG_CHANGE_VISIBILITY, true));
+ reconfigureWindowImpl(getX(), getY(), getWindowWidth(), getWindowHeight(), getReconfigureFlags(FLAG_CHANGE_VISIBILITY, true));
if (0 == getWindowHandle()) {
throw new NativeWindowException("Error creating window");
}
@@ -210,6 +210,16 @@ public class WindowDriver extends WindowImpl implements MutableSurface, DriverCl
private boolean useParent(NativeWindow parent) { return null != parent && 0 != parent.getWindowHandle(); }
@Override
+ protected final int getPixelScaleX() {
+ return 1; // FIXME HiDPI: Use pixelScale
+ }
+
+ @Override
+ protected final int getPixelScaleY() {
+ return 1; // FIXME HiDPI: Use pixelScale
+ }
+
+ @Override
public void updatePosition(int x, int y) {
final long handle = getWindowHandle();
if( 0 != handle && !isOffscreenInstance ) {
@@ -236,7 +246,7 @@ public class WindowDriver extends WindowImpl implements MutableSurface, DriverCl
if( 0 != handle && !isOffscreenInstance ) {
final NativeWindow parent = getParent();
final boolean useParent = useParent(parent);
- if( useParent && ( getSurfaceWidth() != newWidth || getSurfaceHeight() != newHeight ) ) {
+ if( useParent && ( getWindowWidth() != newWidth || getWindowHeight() != newHeight ) ) {
final int x=getX(), y=getY();
final Point p0S = getLocationOnScreenImpl(x, y, parent, useParent);
if(DEBUG_IMPLEMENTATION) {
diff --git a/src/newt/classes/jogamp/newt/driver/windows/WindowDriver.java b/src/newt/classes/jogamp/newt/driver/windows/WindowDriver.java
index 0fc38f92d..541247efd 100644
--- a/src/newt/classes/jogamp/newt/driver/windows/WindowDriver.java
+++ b/src/newt/classes/jogamp/newt/driver/windows/WindowDriver.java
@@ -145,7 +145,8 @@ public class WindowDriver extends WindowImpl {
( FLAG_IS_ALWAYSONTOP | FLAG_IS_UNDECORATED ) ;
final long _windowHandle = CreateWindow0(DisplayDriver.getHInstance(), display.getWindowClassName(), display.getWindowClassName(),
winVer.getMajor(), winVer.getMinor(),
- getParentWindowHandle(), getX(), getY(), getSurfaceWidth(), getSurfaceHeight(), autoPosition(), flags);
+ getParentWindowHandle(),
+ getX(), getY(), getWindowWidth(), getWindowHeight(), autoPosition(), flags);
if ( 0 == _windowHandle ) {
throw new NativeWindowException("Error creating window");
}
@@ -250,7 +251,7 @@ public class WindowDriver extends WindowImpl {
this.runOnEDTIfAvail(true, new Runnable() {
@Override
public void run() {
- final Point p0 = getLocationOnScreenImpl(0, 0);
+ final Point p0 = convertToPixelUnits( getLocationOnScreenImpl(0, 0) );
res[0] = Boolean.valueOf(confinePointer0(getWindowHandle(), confine,
p0.getX(), p0.getY(), p0.getX()+getSurfaceWidth(), p0.getY()+getSurfaceHeight()));
}
diff --git a/src/newt/classes/jogamp/newt/driver/x11/WindowDriver.java b/src/newt/classes/jogamp/newt/driver/x11/WindowDriver.java
index 2f4ccbfea..9538f31a2 100644
--- a/src/newt/classes/jogamp/newt/driver/x11/WindowDriver.java
+++ b/src/newt/classes/jogamp/newt/driver/x11/WindowDriver.java
@@ -129,7 +129,7 @@ public class WindowDriver extends WindowImpl {
setWindowHandle(CreateWindow(getParentWindowHandle(),
edtDevice.getHandle(), screen.getIndex(), visualID,
display.getJavaObjectAtom(), display.getWindowDeleteAtom(),
- getX(), getY(), getSurfaceWidth(), getSurfaceHeight(), autoPosition(), flags,
+ getX(), getY(), getWindowWidth(), getWindowHeight(), autoPosition(), flags,
defaultIconDataSize, defaultIconData));
} finally {
edtDevice.unlock();
@@ -238,7 +238,7 @@ public class WindowDriver extends WindowImpl {
public Object run(long dpy) {
reconfigureWindow0( dpy, getScreenIndex(),
getParentWindowHandle(), getWindowHandle(), display.getWindowDeleteAtom(),
- getX(), getY(), getSurfaceWidth(), getSurfaceHeight(), flags);
+ getX(), getY(), getWindowWidth(), getWindowHeight(), flags);
return null;
}
});
diff --git a/src/test/com/jogamp/opengl/test/junit/graph/demos/GPURegionNewtDemo.java b/src/test/com/jogamp/opengl/test/junit/graph/demos/GPURegionNewtDemo.java
index 7897d0a00..5c217a7dc 100644
--- a/src/test/com/jogamp/opengl/test/junit/graph/demos/GPURegionNewtDemo.java
+++ b/src/test/com/jogamp/opengl/test/junit/graph/demos/GPURegionNewtDemo.java
@@ -108,7 +108,7 @@ public class GPURegionNewtDemo {
final GLWindow window = GLWindow.create(caps);
window.setPosition(10, 10);
- window.setSize(800, 400);
+ window.setSurfaceSize(800, 400);
window.setTitle("GPU Curve Region Newt Demo - graph[vbaa"+GraphVBAASamples+" msaa"+GraphMSAASamples+"], msaa "+SceneMSAASamples);
RenderState rs = RenderState.createRenderState(SVertex.factory());
diff --git a/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUTextNewtDemo.java b/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUTextNewtDemo.java
index e6b1f9c9c..09cf706ce 100644
--- a/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUTextNewtDemo.java
+++ b/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUTextNewtDemo.java
@@ -106,7 +106,7 @@ public class GPUTextNewtDemo {
final GLWindow window = GLWindow.create(caps);
window.setPosition(10, 10);
- window.setSize(800, 400);
+ window.setSurfaceSize(800, 400);
window.setTitle("GPU Text Newt Demo - graph[vbaa"+GraphVBAASamples+" msaa"+GraphMSAASamples+"], msaa "+SceneMSAASamples);
RenderState rs = RenderState.createRenderState(SVertex.factory());
diff --git a/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUUISceneNewtDemo.java b/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUUISceneNewtDemo.java
index 79f6d7bb8..c26cb467a 100644
--- a/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUUISceneNewtDemo.java
+++ b/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUUISceneNewtDemo.java
@@ -21,7 +21,7 @@ public class GPUUISceneNewtDemo {
static boolean GraphMSAAMode = false;
public static void main(String[] args) {
- int wwidth = 800, wheight = 400;
+ int swidth = 800, sheight = 400;
if( 0 != args.length ) {
for(int i=0; i<args.length; i++) {
if(args[i].equals("-smsaa")) {
@@ -37,10 +37,10 @@ public class GPUUISceneNewtDemo {
GraphVBAAMode = true;
} else if(args[i].equals("-width")) {
i++;
- wwidth = MiscUtils.atoi(args[i], wwidth);
+ swidth = MiscUtils.atoi(args[i], swidth);
} else if(args[i].equals("-height")) {
i++;
- wheight = MiscUtils.atoi(args[i], wheight);
+ sheight = MiscUtils.atoi(args[i], sheight);
}
}
}
@@ -68,7 +68,7 @@ public class GPUUISceneNewtDemo {
final GLWindow window = GLWindow.create(caps);
window.setPosition(10, 10);
- window.setSize(wwidth, wheight);
+ window.setSurfaceSize(swidth, sheight);
window.setTitle("GraphUI Newt Demo: graph["+Region.getRenderModeString(rmode)+"], msaa "+SceneMSAASamples);
final RenderState rs = RenderState.createRenderState(SVertex.factory());
diff --git a/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/GLEventListenerButton.java b/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/GLEventListenerButton.java
index ae2cf6c5a..1f6faf15b 100644
--- a/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/GLEventListenerButton.java
+++ b/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/GLEventListenerButton.java
@@ -115,7 +115,7 @@ public class GLEventListenerButton extends TextureSeqButton {
imgSeq.addFrame(gl, tex);
markStateDirty();
} else if( 0 != fboWidth*fboHeight ) {
- fboGLAD.setSize(fboWidth, fboHeight);
+ fboGLAD.setSurfaceSize(fboWidth, fboHeight);
fboWidth = 0;
fboHeight = 0;
} else if( animateGLEL ) {
diff --git a/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/UINewtDemo01.java b/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/UINewtDemo01.java
index 27a91befc..5fe863527 100644
--- a/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/UINewtDemo01.java
+++ b/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/UINewtDemo01.java
@@ -61,7 +61,7 @@ public class UINewtDemo01 {
final GLWindow window = GLWindow.create(caps);
window.setPosition(10, 10);
- window.setSize(800, 400);
+ window.setSurfaceSize(800, 400);
window.setTitle("GPU UI Newt Demo 01");
RenderState rs = RenderState.createRenderState(SVertex.factory());
UIGLListener01 uiGLListener = new UIGLListener01 (0, rs, DEBUG, TRACE);
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestFBOAutoDrawableFactoryNEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestFBOAutoDrawableFactoryNEWT.java
index 3ad1b90dc..665cb2df4 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestFBOAutoDrawableFactoryNEWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestFBOAutoDrawableFactoryNEWT.java
@@ -265,7 +265,7 @@ public class TestFBOAutoDrawableFactoryNEWT extends UITestCase {
// 2, 3 (resize + display)
szStep = 1;
- glad.setSize(widthStep*szStep, heightStep*szStep); // SWAP_EVEN
+ glad.setSurfaceSize(widthStep*szStep, heightStep*szStep); // SWAP_EVEN
Assert.assertTrue("Size not reached: Expected "+(widthStep*szStep)+"x"+(heightStep*szStep)+", Is "+glad.getSurfaceWidth()+"x"+glad.getSurfaceHeight(),
AWTRobotUtil.waitForSize(glad, widthStep*szStep, heightStep*szStep));
snapshotGLEventListener.setMakeSnapshot();
@@ -309,7 +309,7 @@ public class TestFBOAutoDrawableFactoryNEWT extends UITestCase {
// 4, 5 (resize + display)
szStep = 4;
- glad.setSize(widthStep*szStep, heightStep*szStep); // SWAP_ODD
+ glad.setSurfaceSize(widthStep*szStep, heightStep*szStep); // SWAP_ODD
Assert.assertTrue("Size not reached: Expected "+(widthStep*szStep)+"x"+(heightStep*szStep)+", Is "+glad.getSurfaceWidth()+"x"+glad.getSurfaceHeight(),
AWTRobotUtil.waitForSize(glad, widthStep*szStep, heightStep*szStep));
snapshotGLEventListener.setMakeSnapshot();
@@ -361,7 +361,7 @@ public class TestFBOAutoDrawableFactoryNEWT extends UITestCase {
// 8, 9 (resize + samples + display)
szStep = 3;
- glad.setSize(widthStep*szStep, heightStep*szStep);
+ glad.setSurfaceSize(widthStep*szStep, heightStep*szStep);
Assert.assertTrue("Size not reached: Expected "+(widthStep*szStep)+"x"+(heightStep*szStep)+", Is "+glad.getSurfaceWidth()+"x"+glad.getSurfaceHeight(),
AWTRobotUtil.waitForSize(glad, widthStep*szStep, heightStep*szStep));
snapshotGLEventListener.setMakeSnapshot();
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestFBOOffThreadSharedContextMix2DemosES2NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestFBOOffThreadSharedContextMix2DemosES2NEWT.java
index f1c019f2c..8a833be05 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestFBOOffThreadSharedContextMix2DemosES2NEWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestFBOOffThreadSharedContextMix2DemosES2NEWT.java
@@ -201,8 +201,8 @@ public class TestFBOOffThreadSharedContextMix2DemosES2NEWT extends UITestCase {
}
}
public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) {
- fbod1.setSize(width, height);
- fbod2.setSize(width, height);
+ fbod1.setSurfaceSize(width, height);
+ fbod2.setSurfaceSize(width, height);
}
});
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestFBOOnThreadSharedContext1DemoES2NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestFBOOnThreadSharedContext1DemoES2NEWT.java
index baa8a965b..155162964 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestFBOOnThreadSharedContext1DemoES2NEWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestFBOOnThreadSharedContext1DemoES2NEWT.java
@@ -156,7 +156,7 @@ public class TestFBOOnThreadSharedContext1DemoES2NEWT extends UITestCase {
glWindow.addWindowListener(new WindowAdapter() {
@Override
public void windowResized(WindowEvent e) {
- fbod1.setSize(glWindow.getSurfaceWidth(), glWindow.getSurfaceHeight());
+ fbod1.setSurfaceSize(glWindow.getSurfaceWidth(), glWindow.getSurfaceHeight());
}
});
glWindow.addGLEventListener(mixerDemo);
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLAutoDrawableFactoryES2OffscrnCapsNEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLAutoDrawableFactoryES2OffscrnCapsNEWT.java
index 33c0508a1..06c09bbbf 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLAutoDrawableFactoryES2OffscrnCapsNEWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLAutoDrawableFactoryES2OffscrnCapsNEWT.java
@@ -134,7 +134,7 @@ public class TestGLAutoDrawableFactoryES2OffscrnCapsNEWT extends UITestCase {
// 2, 3 (resize + display)
szStep = 1;
- glad.setSize(widthStep*szStep, heightStep*szStep);
+ glad.setSurfaceSize(widthStep*szStep, heightStep*szStep);
Assert.assertTrue("Size not reached: Expected "+(widthStep*szStep)+"x"+(heightStep*szStep)+", Is "+glad.getSurfaceWidth()+"x"+glad.getSurfaceHeight(),
AWTRobotUtil.waitForSize(glad, widthStep*szStep, heightStep*szStep));
snapshotGLEventListener.setMakeSnapshot();
@@ -142,7 +142,7 @@ public class TestGLAutoDrawableFactoryES2OffscrnCapsNEWT extends UITestCase {
// 4, 5 (resize + display)
szStep = 4;
- glad.setSize(widthStep*szStep, heightStep*szStep);
+ glad.setSurfaceSize(widthStep*szStep, heightStep*szStep);
Assert.assertTrue("Size not reached: Expected "+(widthStep*szStep)+"x"+(heightStep*szStep)+", Is "+glad.getSurfaceWidth()+"x"+glad.getSurfaceHeight(),
AWTRobotUtil.waitForSize(glad, widthStep*szStep, heightStep*szStep));
snapshotGLEventListener.setMakeSnapshot();
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLAutoDrawableFactoryGL2OffscrnCapsNEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLAutoDrawableFactoryGL2OffscrnCapsNEWT.java
index f482a4468..ffa64d894 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLAutoDrawableFactoryGL2OffscrnCapsNEWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLAutoDrawableFactoryGL2OffscrnCapsNEWT.java
@@ -134,7 +134,7 @@ public class TestGLAutoDrawableFactoryGL2OffscrnCapsNEWT extends UITestCase {
// 2, 3 (resize + display)
szStep = 1;
- glad.setSize(widthStep*szStep, heightStep*szStep);
+ glad.setSurfaceSize(widthStep*szStep, heightStep*szStep);
Assert.assertTrue("Size not reached: Expected "+(widthStep*szStep)+"x"+(heightStep*szStep)+", Is "+glad.getSurfaceWidth()+"x"+glad.getSurfaceHeight(),
AWTRobotUtil.waitForSize(glad, widthStep*szStep, heightStep*szStep));
snapshotGLEventListener.setMakeSnapshot();
@@ -142,7 +142,7 @@ public class TestGLAutoDrawableFactoryGL2OffscrnCapsNEWT extends UITestCase {
// 4, 5 (resize + display)
szStep = 4;
- glad.setSize(widthStep*szStep, heightStep*szStep);
+ glad.setSurfaceSize(widthStep*szStep, heightStep*szStep);
Assert.assertTrue("Size not reached: Expected "+(widthStep*szStep)+"x"+(heightStep*szStep)+", Is "+glad.getSurfaceWidth()+"x"+glad.getSurfaceHeight(),
AWTRobotUtil.waitForSize(glad, widthStep*szStep, heightStep*szStep));
snapshotGLEventListener.setMakeSnapshot();
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLAutoDrawableFactoryGLnBitmapCapsNEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLAutoDrawableFactoryGLnBitmapCapsNEWT.java
index 2f3c8c7e8..8d3d05869 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLAutoDrawableFactoryGLnBitmapCapsNEWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLAutoDrawableFactoryGLnBitmapCapsNEWT.java
@@ -126,7 +126,7 @@ public class TestGLAutoDrawableFactoryGLnBitmapCapsNEWT extends UITestCase {
// 2, 3 (resize + display)
szStep = 1;
- glad.setSize(widthStep*szStep, heightStep*szStep);
+ glad.setSurfaceSize(widthStep*szStep, heightStep*szStep);
Assert.assertTrue("Size not reached: Expected "+(widthStep*szStep)+"x"+(heightStep*szStep)+", Is "+glad.getSurfaceWidth()+"x"+glad.getSurfaceHeight(),
AWTRobotUtil.waitForSize(glad, widthStep*szStep, heightStep*szStep));
snapshotGLEventListener.setMakeSnapshot();
@@ -134,7 +134,7 @@ public class TestGLAutoDrawableFactoryGLnBitmapCapsNEWT extends UITestCase {
// 4, 5 (resize + display)
szStep = 4;
- glad.setSize(widthStep*szStep, heightStep*szStep);
+ glad.setSurfaceSize(widthStep*szStep, heightStep*szStep);
Assert.assertTrue("Size not reached: Expected "+(widthStep*szStep)+"x"+(heightStep*szStep)+", Is "+glad.getSurfaceWidth()+"x"+glad.getSurfaceHeight(),
AWTRobotUtil.waitForSize(glad, widthStep*szStep, heightStep*szStep));
snapshotGLEventListener.setMakeSnapshot();
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es1/GearsES1.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es1/GearsES1.java
index 218093689..6cddce62c 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es1/GearsES1.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es1/GearsES1.java
@@ -327,9 +327,13 @@ public class GearsES1 implements GLEventListener {
Window window = (Window) source;
width=window.getSurfaceWidth();
height=window.getSurfaceHeight();
+ } else if (source instanceof GLAutoDrawable) {
+ GLAutoDrawable glad = (GLAutoDrawable) source;
+ width = glad.getSurfaceWidth();
+ height = glad.getSurfaceHeight();
} else if (GLProfile.isAWTAvailable() && source instanceof java.awt.Component) {
java.awt.Component comp = (java.awt.Component) source;
- width=comp.getWidth();
+ width=comp.getWidth(); // FIXME HiDPI: May need to convert window units -> pixel units!
height=comp.getHeight();
} else {
throw new RuntimeException("Event source neither Window nor Component: "+source);
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/GearsES2.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/GearsES2.java
index 09fd911a7..b2b1dd642 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/GearsES2.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/GearsES2.java
@@ -619,7 +619,7 @@ public class GearsES2 implements GLEventListener, TileRendererBase.TileRendererL
height = glad.getSurfaceHeight();
} else if (GLProfile.isAWTAvailable() && source instanceof java.awt.Component) {
java.awt.Component comp = (java.awt.Component) source;
- width=comp.getWidth();
+ width=comp.getWidth(); // FIXME HiDPI: May need to convert window units -> pixel units!
height=comp.getHeight();
} else {
throw new RuntimeException("Event source neither Window nor Component: "+source);
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/TextureSequenceCubeES2.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/TextureSequenceCubeES2.java
index 17332a4e2..db0e11734 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/TextureSequenceCubeES2.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/TextureSequenceCubeES2.java
@@ -98,9 +98,13 @@ public class TextureSequenceCubeES2 implements GLEventListener {
window = (Window) source;
width=window.getSurfaceWidth();
height=window.getSurfaceHeight();
+ } else if (source instanceof GLAutoDrawable) {
+ GLAutoDrawable glad = (GLAutoDrawable) source;
+ width = glad.getSurfaceWidth();
+ height = glad.getSurfaceHeight();
} else if (GLProfile.isAWTAvailable() && source instanceof java.awt.Component) {
java.awt.Component comp = (java.awt.Component) source;
- width=comp.getWidth();
+ width=comp.getWidth(); // FIXME HiDPI: May need to convert window units -> pixel units!
height=comp.getHeight();
} else {
throw new RuntimeException("Event source neither Window nor Component: "+source);
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/av/MovieCube.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/av/MovieCube.java
index 730e6e562..116d5d245 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/av/MovieCube.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/av/MovieCube.java
@@ -561,7 +561,7 @@ public class MovieCube implements GLEventListener {
anim.stop();
}
});
- window.setSize(width, height);
+ window.setSurfaceSize(width, height);
window.setVisible(true);
System.err.println("Chosen: "+window.getChosenGLCapabilities());
anim.start();
@@ -577,7 +577,7 @@ public class MovieCube implements GLEventListener {
System.err.println("MovieCube State: "+mp);
if( 0 != ( GLMediaEventListener.EVENT_CHANGE_SIZE & event_mask ) ) {
if( origSize ) {
- window.setSize(mp.getWidth(), mp.getHeight());
+ window.setSurfaceSize(mp.getWidth(), mp.getHeight());
}
// window.disposeGLEventListener(ms, false /* remove */ );
mc.resetGLState();
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/av/MovieSimple.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/av/MovieSimple.java
index 7afd31352..1997739e3 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/av/MovieSimple.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/av/MovieSimple.java
@@ -94,7 +94,7 @@ public class MovieSimple implements GLEventListener {
private static final String PLAYER = "player";
private static boolean waitForKey = false;
- private int winWidth, winHeight;
+ private int surfWidth, surfHeight;
private int prevMouseX; // , prevMouseY;
private int rotate = 0;
private boolean orthoProjection = true;
@@ -213,7 +213,7 @@ public class MovieSimple implements GLEventListener {
private final MouseListener mouseAction = new MouseAdapter() {
public void mousePressed(MouseEvent e) {
- if(e.getY()<=winHeight/2 && null!=mPlayer && 1 == e.getClickCount()) {
+ if(e.getY()<=surfHeight/2 && null!=mPlayer && 1 == e.getClickCount()) {
if(GLMediaPlayer.State.Playing == mPlayer.getState()) {
mPlayer.pause(false);
} else {
@@ -222,7 +222,7 @@ public class MovieSimple implements GLEventListener {
}
}
public void mouseReleased(MouseEvent e) {
- if(e.getY()<=winHeight/2) {
+ if(e.getY()<=surfHeight/2) {
rotate = -1;
zoom = zoom0;
System.err.println("zoom: "+zoom);
@@ -236,8 +236,8 @@ public class MovieSimple implements GLEventListener {
int x = e.getX();
int y = e.getY();
- if(y>winHeight/2) {
- final float dp = (float)(x-prevMouseX)/(float)winWidth;
+ if(y>surfHeight/2) {
+ final float dp = (float)(x-prevMouseX)/(float)surfWidth;
final int pts0 = GLMediaPlayer.STREAM_ID_NONE != mPlayer.getVID() ? mPlayer.getVideoPTS() : mPlayer.getAudioPTS();
mPlayer.seek(pts0 + (int) (mPlayer.getDuration() * dp));
} else {
@@ -602,8 +602,8 @@ public class MovieSimple implements GLEventListener {
final Window window = (Window) upstreamWidget;
window.addMouseListener(mouseAction);
window.addKeyListener(keyAction);
- winWidth = window.getSurfaceWidth();
- winHeight = window.getSurfaceHeight();
+ surfWidth = window.getSurfaceWidth();
+ surfHeight = window.getSurfaceHeight();
}
final int rmode = drawable.getChosenGLCapabilities().getSampleBuffers() ? 0 : Region.VBAA_RENDERING_BIT;
final boolean lowPerfDevice = gl.isGLES();
@@ -669,8 +669,8 @@ public class MovieSimple implements GLEventListener {
public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) {
final GL2ES2 gl = drawable.getGL().getGL2ES2();
if(null == mPlayer) { return; }
- winWidth = width;
- winHeight = height;
+ surfWidth = width;
+ surfHeight = height;
if(null != st) {
reshapePMV(width, height);
@@ -827,7 +827,7 @@ public class MovieSimple implements GLEventListener {
if( 0 != ( GLMediaEventListener.EVENT_CHANGE_SIZE & event_mask ) ) {
System.err.println("MovieSimple State: CHANGE_SIZE");
if( origSize ) {
- window.setSize(mp.getWidth(), mp.getHeight());
+ window.setSurfaceSize(mp.getWidth(), mp.getHeight());
}
// window.disposeGLEventListener(ms, false /* remove */ );
ms.resetGLState();
@@ -1050,7 +1050,7 @@ public class MovieSimple implements GLEventListener {
mss[i].mPlayer.addEventListener(myGLMediaEventListener);
windows[i].setTitle("Player "+i);
- windows[i].setSize(width, height);
+ windows[i].setSurfaceSize(width, height);
windows[i].setVisible(true);
anim.add(windows[i]);
diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl2/Gears.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl2/Gears.java
index 049945bda..9c5d1e249 100644
--- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl2/Gears.java
+++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl2/Gears.java
@@ -501,9 +501,13 @@ public class Gears implements GLEventListener, TileRendererBase.TileRendererList
Window window = (Window) source;
width=window.getSurfaceWidth();
height=window.getSurfaceHeight();
+ } else if (source instanceof GLAutoDrawable) {
+ GLAutoDrawable glad = (GLAutoDrawable) source;
+ width = glad.getSurfaceWidth();
+ height = glad.getSurfaceHeight();
} else if (GLProfile.isAWTAvailable() && source instanceof java.awt.Component) {
java.awt.Component comp = (java.awt.Component) source;
- width=comp.getWidth();
+ width=comp.getWidth(); // FIXME HiDPI: May need to convert window units -> pixel units!
height=comp.getHeight();
} else {
throw new RuntimeException("Event source neither Window nor Component: "+source);
diff --git a/src/test/com/jogamp/opengl/test/junit/newt/TestWindows01NEWT.java b/src/test/com/jogamp/opengl/test/junit/newt/TestWindows01NEWT.java
index 19b6fbd07..082a900a0 100644
--- a/src/test/com/jogamp/opengl/test/junit/newt/TestWindows01NEWT.java
+++ b/src/test/com/jogamp/opengl/test/junit/newt/TestWindows01NEWT.java
@@ -3,14 +3,14 @@
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
- *
+ *
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
- *
+ *
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
@@ -20,12 +20,12 @@
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
+ *
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of JogAmp Community.
*/
-
+
package com.jogamp.opengl.test.junit.newt;
import org.junit.Assert;
@@ -54,14 +54,14 @@ public class TestWindows01NEWT extends UITestCase {
static Window createWindow(Capabilities caps, int x, int y, int width, int height, boolean onscreen, boolean undecorated) throws InterruptedException {
final boolean userPos = x>=0 && y>=0 ; // user has specified a position
-
+
Assert.assertNotNull(caps);
caps.setOnscreen(onscreen);
// System.out.println("Requested: "+caps);
//
// Create native windowing resources .. X11/Win/OSX
- //
+ //
Window window = NewtFactory.createWindow(caps);
Assert.assertNotNull(window);
Screen screen = window.getScreen();
@@ -75,13 +75,13 @@ public class TestWindows01NEWT extends UITestCase {
Assert.assertEquals(false,window.isVisible());
window.setVisible(true);
// System.err.println("************* Created: "+window);
-
- Assert.assertEquals(true,display.isNativeValid());
+
+ Assert.assertEquals(true,display.isNativeValid());
Assert.assertEquals(true,screen.isNativeValid());
Assert.assertEquals(true,window.isVisible());
Assert.assertEquals(true,window.isNativeValid());
- Assert.assertEquals(width, window.getSurfaceWidth());
- Assert.assertEquals(height, window.getSurfaceHeight());
+ Assert.assertEquals(width, window.getWindowWidth());
+ Assert.assertEquals(height, window.getWindowHeight());
/** we don't sync on position - unreliable test
Point p0 = window.getLocationOnScreen(null);
@@ -98,7 +98,7 @@ public class TestWindows01NEWT extends UITestCase {
Assert.assertTrue(chosenCapabilities.getBlueBits()>=5);
Assert.assertTrue(chosenCapabilities.getRedBits()>=5);
Assert.assertEquals(chosenCapabilities.isOnscreen(),onscreen);
-
+
return window;
}
@@ -115,7 +115,7 @@ public class TestWindows01NEWT extends UITestCase {
Assert.assertEquals(false,display.isNativeValid());
} else {
Assert.assertEquals(true,screen.isNativeValid());
- Assert.assertEquals(true,display.isNativeValid());
+ Assert.assertEquals(true,display.isNativeValid());
}
Assert.assertEquals(false,window.isNativeValid());
Assert.assertEquals(false,window.isVisible());
@@ -148,16 +148,16 @@ public class TestWindows01NEWT extends UITestCase {
Window window = createWindow(caps, -1, -1, width, height, true /* onscreen */, false /* undecorated */);
destroyWindow(window, true);
-
+
window.setVisible(true);
Assert.assertEquals(true,window.isNativeValid());
Assert.assertEquals(true,window.isVisible());
- Assert.assertEquals(width, window.getSurfaceWidth());
- Assert.assertEquals(height, window.getSurfaceHeight());
+ Assert.assertEquals(width, window.getWindowWidth());
+ Assert.assertEquals(height, window.getWindowHeight());
destroyWindow(window, true);
}
-
+
@Test
public void testWindowDecorDestroyWinTwiceA() throws InterruptedException {
Capabilities caps = new Capabilities();
diff --git a/src/test/com/jogamp/opengl/test/junit/util/AWTRobotUtil.java b/src/test/com/jogamp/opengl/test/junit/util/AWTRobotUtil.java
index 45df52220..a9fc53eec 100644
--- a/src/test/com/jogamp/opengl/test/junit/util/AWTRobotUtil.java
+++ b/src/test/com/jogamp/opengl/test/junit/util/AWTRobotUtil.java
@@ -137,9 +137,9 @@ public class AWTRobotUtil {
javax.media.nativewindow.util.Point p0 = win.getLocationOnScreen(null);
if( onTitleBarIfWindow ) {
javax.media.nativewindow.util.InsetsImmutable insets = win.getInsets();
- p0.translate(win.getSurfaceWidth()/2, insets.getTopHeight()/2);
+ p0.translate(win.getWindowWidth()/2, insets.getTopHeight()/2);
} else {
- p0.translate(win.getSurfaceWidth()/2, win.getSurfaceHeight()/2);
+ p0.translate(win.getWindowWidth()/2, win.getWindowHeight()/2);
}
return new int[] { p0.getX(), p0.getY() };
}