diff options
author | Sven Gothel <[email protected]> | 2014-05-21 08:53:54 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2014-05-21 08:53:54 +0200 |
commit | f9a00b91dcd146c72a50237b62270f33bd0da98e (patch) | |
tree | f4387da868608cea5066ce3a8cb9039a16b529de | |
parent | 0ffba122ea5c4b8cc247234ca9f48ccfcce833cd (diff) |
Bug 742 HiDPI: [Core API Change] Distinguish window-units and pixel-units; Add HiDPI for AWT GLCanvas w/ OSX CALayer
Core API Change:
To support HiDPI thoroughly in JOGL (NativeWindow, JOGL, NEWT)
we need to separate window- and pixel units.
NativeWindow and NativeSurface now have distinguished
access methods for window units and pixel units.
NativeWindow: Using window units
- getWindowWidth() * NEW Method *
- getWindowHeight() * NEW Method *
- getX(), getY(), ...
NativeSurface: Using pixel units
- getWidth() -> getSurfaceWidth() * RENAMED *
- getHeight() -> getSurfaceHeight() * RENAMED *
GLDrawable: Using pixel units
- getWidth() -> getSurfaceWidth() * RENAMED, aligned w/ NativeSurface *
- getHeight() -> getSurfaceHeight() * RENAMED, aligned w/ NativeSurface *
Above changes also removes API collision w/ other windowing TK,
e.g. AWT's getWidth()/getHeight() in GLCanvas
and the same method names in GLDrawable before this change.
+++
Now preliminary 'working':
- AWT GLCanvas
- AWT GLJPanel
Tested manually on OSX w/ and w/o HiDPI Retina:
java com.jogamp.opengl.test.junit.jogl.demos.es2.awt.TestGearsES2AWT -manual -noanim -time 1000000
java com.jogamp.opengl.test.junit.jogl.demos.es2.awt.TestGearsES2GLJPanelAWT -manual -noanim -time 1000000
+++
TODO:
- NEWT
- Change Window.setSize(..) to use pixel units ?
- OSX HiDPI support
- Testing ..
- API refinement
161 files changed, 1147 insertions, 762 deletions
diff --git a/make/config/jogl/cgl-macosx-CustomJavaCode.java b/make/config/jogl/cgl-macosx-CustomJavaCode.java index ab1d44b64..fc3ce1c57 100644 --- a/make/config/jogl/cgl-macosx-CustomJavaCode.java +++ b/make/config/jogl/cgl-macosx-CustomJavaCode.java @@ -11,8 +11,10 @@ * </p> */ public static long createNSOpenGLLayer(final long ctx, final int gl3ShaderProgramName, final long fmt, final long p, - final int texID, final boolean opaque, final int texWidth, final int texHeight) { - return createNSOpenGLLayerImpl(ctx, gl3ShaderProgramName, fmt, p, texID, opaque, texWidth, texHeight); + final int texID, final boolean opaque, + final int texWidth, final int texHeight, + final int winWidth, final int winHeight) { + return createNSOpenGLLayerImpl(ctx, gl3ShaderProgramName, fmt, p, texID, opaque, texWidth, texHeight, winWidth, winHeight); } /** diff --git a/make/scripts/tests.sh b/make/scripts/tests.sh index 6fbad332f..13f5b08ea 100644 --- a/make/scripts/tests.sh +++ b/make/scripts/tests.sh @@ -216,8 +216,9 @@ function jrun() { #D_ARGS="-Dnewt.debug.Window -Dnewt.debug.Window.MouseEvent -Dnewt.debug.Window.KeyEvent" #D_ARGS="-Dnewt.debug.Window" #D_ARGS="-Xprof" + #D_ARGS="-Dnativewindow.debug=all -Djogl.debug=all -Dnewt.debug=all" D_ARGS="-Djogl.debug.GLCanvas -Djogl.debug.Java2D -Djogl.debug.GLJPanel" - #D_ARGS="-Djogl.debug.GLCanvas -Djogl.debug.Java2D -Djogl.debug.GLJPanel -Djogl.gljpanel.nohidpi" + #D_ARGS="-Djogl.debug.GLCanvas -Djogl.debug.Java2D -Djogl.debug.GLJPanel -Dnativewindow.awt.nohidpi" #D_ARGS="-Djogl.debug.GLCanvas -Djogl.debug.Java2D -Djogl.debug.GLJPanel -Djogl.debug.GLJPanel.Viewport" #D_ARGS="-Djogl.debug.GLCanvas -Djogl.debug.Java2D -Djogl.debug.GLJPanel -Djogl.gljpanel.noglsl" #D_ARGS="-Djogl.debug.GLCanvas -Djogl.debug.Java2D -Djogl.debug.GLJPanel -Djogl.gljpanel.noglsl -Djogl.gljpanel.awtverticalflip" diff --git a/make/stub_includes/opengl/macosx-window-system.h b/make/stub_includes/opengl/macosx-window-system.h index 2bfe86aa4..96643fca3 100644 --- a/make/stub_includes/opengl/macosx-window-system.h +++ b/make/stub_includes/opengl/macosx-window-system.h @@ -56,7 +56,8 @@ void setContextPBuffer(NSOpenGLContext* ctx, NSOpenGLPixelBuffer* pBuffer); void setContextTextureImageToPBuffer(NSOpenGLContext* ctx, NSOpenGLPixelBuffer* pBuffer, GLenum colorBuffer); Bool isNSOpenGLPixelBuffer(uint64_t object); -NSOpenGLLayer* createNSOpenGLLayer(NSOpenGLContext* ctx, int gl3ShaderProgramName, NSOpenGLPixelFormat* fmt, NSOpenGLPixelBuffer* p, uint32_t texID, Bool opaque, int texWidth, int texHeight); +NSOpenGLLayer* createNSOpenGLLayer(NSOpenGLContext* ctx, int gl3ShaderProgramName, NSOpenGLPixelFormat* fmt, NSOpenGLPixelBuffer* p, uint32_t texID, Bool opaque, + int texWidth, int texHeight, int winWidth, int winHeight); void setNSOpenGLLayerEnabled(NSOpenGLLayer* layer, Bool enable); void setNSOpenGLLayerSwapInterval(NSOpenGLLayer* layer, int interval); void waitUntilNSOpenGLLayerIsReady(NSOpenGLLayer* layer, long to_micros); diff --git a/src/jogl/classes/com/jogamp/opengl/GLEventListenerState.java b/src/jogl/classes/com/jogamp/opengl/GLEventListenerState.java index 1b4187668..299e51532 100644 --- a/src/jogl/classes/com/jogamp/opengl/GLEventListenerState.java +++ b/src/jogl/classes/com/jogamp/opengl/GLEventListenerState.java @@ -408,7 +408,7 @@ public class GLEventListenerState { public static GLRunnable setViewport = new GLRunnable() { @Override public boolean run(GLAutoDrawable drawable) { - drawable.getGL().glViewport(0, 0, drawable.getWidth(), drawable.getHeight()); + drawable.getGL().glViewport(0, 0, drawable.getSurfaceWidth(), drawable.getSurfaceHeight()); return true; } }; @@ -428,7 +428,7 @@ public class GLEventListenerState { } @Override public boolean run(GLAutoDrawable drawable) { - listener.reshape(drawable, 0, 0, drawable.getWidth(), drawable.getHeight()); + listener.reshape(drawable, 0, 0, drawable.getSurfaceWidth(), drawable.getSurfaceHeight()); return true; } } diff --git a/src/jogl/classes/com/jogamp/opengl/swt/GLCanvas.java b/src/jogl/classes/com/jogamp/opengl/swt/GLCanvas.java index cd5aa338d..1c6dced6a 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 getWidth(ProxySurface s) { + public final int getPixelWidth(ProxySurface s) { return clientArea.width; } @Override - public final int getHeight(ProxySurface s) { + public final int getPixelHeight(ProxySurface s) { return clientArea.height; } @@ -689,12 +689,12 @@ public class GLCanvas extends Canvas implements GLAutoDrawable, GLSharedContextS } @Override - public int getWidth() { + public int getSurfaceWidth() { return clientArea.width; } @Override - public int getHeight() { + public int getSurfaceHeight() { return clientArea.height; } @@ -984,15 +984,15 @@ public class GLCanvas extends Canvas implements GLAutoDrawable, GLSharedContextS @Override public String toString() { final GLDrawable _drawable = drawable; - final int dw = (null!=_drawable) ? _drawable.getWidth() : -1; - final int dh = (null!=_drawable) ? _drawable.getHeight() : -1; + final int dw = (null!=_drawable) ? _drawable.getSurfaceWidth() : -1; + final int dh = (null!=_drawable) ? _drawable.getSurfaceHeight() : -1; return "SWT-GLCanvas[Realized "+isRealized()+ ",\n\t"+((null!=_drawable)?_drawable.getClass().getName():"null-drawable")+ ",\n\tFactory "+getFactory()+ ",\n\thandle "+toHexString(getHandle())+ ",\n\tDrawable size "+dw+"x"+dh+ - ",\n\tSWT size "+getWidth()+"x"+getHeight()+"]"; + ",\n\tSWT size "+getSurfaceWidth()+"x"+getSurfaceHeight()+"]"; } public static void main(final String[] args) { diff --git a/src/jogl/classes/com/jogamp/opengl/util/GLReadBufferUtil.java b/src/jogl/classes/com/jogamp/opengl/util/GLReadBufferUtil.java index 25a012bb9..2b4795aaa 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/GLReadBufferUtil.java +++ b/src/jogl/classes/com/jogamp/opengl/util/GLReadBufferUtil.java @@ -154,13 +154,13 @@ public class GLReadBufferUtil { public boolean readPixels(GL gl, int inX, int inY, int inWidth, int inHeight, boolean mustFlipVertically) { final GLDrawable drawable = gl.getContext().getGLReadDrawable(); final int width, height; - if( 0 >= inWidth || drawable.getWidth() < inWidth ) { - width = drawable.getWidth(); + if( 0 >= inWidth || drawable.getSurfaceWidth() < inWidth ) { + width = drawable.getSurfaceWidth(); } else { width = inWidth; } - if( 0 >= inHeight || drawable.getHeight() < inHeight ) { - height = drawable.getHeight(); + if( 0 >= inHeight || drawable.getSurfaceHeight() < inHeight ) { + height = drawable.getSurfaceHeight(); } else { height= inHeight; } diff --git a/src/jogl/classes/com/jogamp/opengl/util/awt/AWTGLReadBufferUtil.java b/src/jogl/classes/com/jogamp/opengl/util/awt/AWTGLReadBufferUtil.java index 9490e041b..3c5d6be2d 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/awt/AWTGLReadBufferUtil.java +++ b/src/jogl/classes/com/jogamp/opengl/util/awt/AWTGLReadBufferUtil.java @@ -87,13 +87,13 @@ public class AWTGLReadBufferUtil extends GLReadBufferUtil { public BufferedImage readPixelsToBufferedImage(GL gl, int inX, int inY, int inWidth, int inHeight, boolean awtOrientation) { final GLDrawable drawable = gl.getContext().getGLReadDrawable(); final int width, height; - if( 0 >= inWidth || drawable.getWidth() < inWidth ) { - width = drawable.getWidth(); + if( 0 >= inWidth || drawable.getSurfaceWidth() < inWidth ) { + width = drawable.getSurfaceWidth(); } else { width = inWidth; } - if( 0 >= inHeight || drawable.getHeight() < inHeight ) { - height = drawable.getHeight(); + if( 0 >= inHeight || drawable.getSurfaceHeight() < inHeight ) { + height = drawable.getSurfaceHeight(); } else { height= inHeight; } diff --git a/src/jogl/classes/com/jogamp/opengl/util/awt/Overlay.java b/src/jogl/classes/com/jogamp/opengl/util/awt/Overlay.java index 931f59869..1ad7b9987 100644 --- a/src/jogl/classes/com/jogamp/opengl/util/awt/Overlay.java +++ b/src/jogl/classes/com/jogamp/opengl/util/awt/Overlay.java @@ -119,7 +119,7 @@ public class Overlay { */ public void drawAll() throws GLException { beginRendering(); - draw(0, 0, drawable.getWidth(), drawable.getHeight()); + draw(0, 0, drawable.getSurfaceWidth(), drawable.getSurfaceHeight()); endRendering(); } @@ -130,7 +130,7 @@ public class Overlay { @throws GLException If an OpenGL context is not current when this method is called */ public void beginRendering() throws GLException { - renderer.beginOrthoRendering(drawable.getWidth(), drawable.getHeight()); + renderer.beginOrthoRendering(drawable.getSurfaceWidth(), drawable.getSurfaceHeight()); } /** Ends the OpenGL rendering process for the overlay. This is @@ -198,13 +198,13 @@ public class Overlay { private void validateRenderer() { if (renderer == null) { - renderer = new TextureRenderer(drawable.getWidth(), - drawable.getHeight(), + renderer = new TextureRenderer(drawable.getSurfaceWidth(), + drawable.getSurfaceHeight(), true); contentsLost = true; - } else if (renderer.getWidth() != drawable.getWidth() || - renderer.getHeight() != drawable.getHeight()) { - renderer.setSize(drawable.getWidth(), drawable.getHeight()); + } else if (renderer.getWidth() != drawable.getSurfaceWidth() || + renderer.getHeight() != drawable.getSurfaceHeight()) { + renderer.setSize(drawable.getSurfaceWidth(), drawable.getSurfaceHeight()); contentsLost = true; } else { contentsLost = false; diff --git a/src/jogl/classes/javax/media/opengl/GLDrawable.java b/src/jogl/classes/javax/media/opengl/GLDrawable.java index 3c354a240..e93d1c3ad 100644 --- a/src/jogl/classes/javax/media/opengl/GLDrawable.java +++ b/src/jogl/classes/javax/media/opengl/GLDrawable.java @@ -140,11 +140,17 @@ public interface GLDrawable { */ public boolean isRealized(); - /** Returns the current width of this GLDrawable. */ - public int getWidth(); + /** + * Returns the width of this {@link GLDrawable}'s {@link #getNativeSurface() surface} client area in pixel units. + * @see NativeSurface#getSurfaceWidth() + */ + public int getSurfaceWidth(); - /** Returns the current height of this GLDrawable. */ - public int getHeight(); + /** + * Returns the height of this {@link GLDrawable}'s {@link #getNativeSurface() surface} client area in pixel units. + * @see NativeSurface#getSurfaceHeight() + */ + public int getSurfaceHeight(); /** * Returns <code>true</code> if the drawable is rendered in diff --git a/src/jogl/classes/javax/media/opengl/awt/GLCanvas.java b/src/jogl/classes/javax/media/opengl/awt/GLCanvas.java index 09589080f..c5ce32827 100644 --- a/src/jogl/classes/javax/media/opengl/awt/GLCanvas.java +++ b/src/jogl/classes/javax/media/opengl/awt/GLCanvas.java @@ -101,6 +101,7 @@ 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; @@ -167,6 +168,7 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing private volatile JAWTWindow jawtWindow; // the JAWTWindow presentation of this AWT Canvas, bound to the 'drawable' lifecycle private volatile GLContextImpl context; // volatile: avoid locking for read-only access private volatile boolean sendReshape = false; // volatile: maybe written by EDT w/o locking + private volatile int pixelScale; // copy of the cstr args, mainly for recreation private final GLCapabilitiesImmutable capsReqUser; @@ -307,6 +309,7 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing this.addHierarchyListener(hierarchyListener); this.isShowing = isShowing(); + this.pixelScale = 1; } @Override @@ -378,7 +381,7 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing * otherwise it is from an ancestor component that this Canvas is being * added to, and we go into this block. */ - GraphicsConfiguration chosen = awtConfig.getAWTGraphicsConfiguration(); + GraphicsConfiguration chosen = null != awtConfig ? awtConfig.getAWTGraphicsConfiguration() : null; if (gc != null && chosen != null && !chosen.equals(gc)) { /* @@ -487,7 +490,7 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing try { final GLDrawable _drawable = drawable; if( null == _drawable || realized == _drawable.isRealized() || - realized && ( 0 >= _drawable.getWidth() || 0 >= _drawable.getHeight() ) ) { + realized && ( 0 >= _drawable.getSurfaceWidth() || 0 >= _drawable.getSurfaceHeight() ) ) { return; } _drawable.setRealized(realized); @@ -665,6 +668,7 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing try { drawable = (GLDrawableImpl) GLDrawableFactory.getFactory(capsReqUser.getGLProfile()).createGLDrawable(jawtWindow); createContextImpl(drawable); + pixelScale = jawtWindow.getPixelScale(); } finally { jawtWindow.unlockSurface(); } @@ -696,7 +700,7 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing boolean res = _drawable.isRealized(); if( !res ) { // re-try drawable creation - if( 0 >= _drawable.getWidth() || 0 >= _drawable.getHeight() ) { + if( 0 >= _drawable.getSurfaceWidth() || 0 >= _drawable.getSurfaceHeight() ) { return false; // early out! } setRealized(true); @@ -760,10 +764,17 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing synchronized (getTreeLock()) { // super.reshape(..) claims tree lock, so we do extend it's lock over reshape super.reshape(x, y, width, height); + final int scale = getPixelScale(); + final int scaledWidth = scale * width; + final int scaledHeight = scale * height; + if(DEBUG) { final NativeSurface ns = getNativeSurface(); final long nsH = null != ns ? ns.getSurfaceHandle() : 0; - System.err.println("GLCanvas.sizeChanged: ("+getThreadName()+"): "+width+"x"+height+" - surfaceHandle 0x"+Long.toHexString(nsH)); + System.err.println(getThreadName()+": GLCanvas.reshape.0 "+this.getName()+" resize"+(printActive?"WithinPrint":"")+ + " [ this "+getWidth()+"x"+getHeight()+", pixelScale "+scale+ + "] -> "+(printActive?"[skipped] ":"") + width+"x"+height+" * "+scale+" -> "+scaledWidth+"x"+scaledHeight+ + " - surfaceHandle 0x"+Long.toHexString(nsH)); // Thread.dumpStack(); } if( validateGLDrawable() && !printActive ) { @@ -772,7 +783,7 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing final RecursiveLock _lock = lock; _lock.lock(); try { - final GLDrawableImpl _drawableNew = GLDrawableHelper.resizeOffscreenDrawable(_drawable, context, width, height); + final GLDrawableImpl _drawableNew = GLDrawableHelper.resizeOffscreenDrawable(_drawable, context, scaledWidth, scaledHeight); if(_drawable != _drawableNew) { // write back drawable = _drawableNew; @@ -835,15 +846,15 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing final int printNumSamples = printAWTTiles.getNumSamples(caps); GLDrawable printDrawable = printGLAD.getDelegatedDrawable(); final boolean reqNewGLADSamples = printNumSamples != caps.getNumSamples(); - final boolean reqNewGLADSize = printAWTTiles.customTileWidth != -1 && printAWTTiles.customTileWidth != printDrawable.getWidth() || - printAWTTiles.customTileHeight != -1 && printAWTTiles.customTileHeight != printDrawable.getHeight(); + final boolean reqNewGLADSize = printAWTTiles.customTileWidth != -1 && printAWTTiles.customTileWidth != printDrawable.getSurfaceWidth() || + printAWTTiles.customTileHeight != -1 && printAWTTiles.customTileHeight != printDrawable.getSurfaceHeight(); final boolean reqNewGLADOnscrn = caps.isOnscreen(); // It is desired to use a new offscreen GLAD, however Bug 830 forbids this for AA onscreen context. // Bug 830: swapGLContextAndAllGLEventListener and onscreen MSAA w/ NV/GLX final boolean reqNewGLAD = !caps.getSampleBuffers() && ( reqNewGLADOnscrn || reqNewGLADSamples || reqNewGLADSize ); if( DEBUG ) { System.err.println("AWT print.setup: reqNewGLAD "+reqNewGLAD+"[ onscreen "+reqNewGLADOnscrn+", samples "+reqNewGLADSamples+", size "+reqNewGLADSize+"], "+ - ", drawableSize "+printDrawable.getWidth()+"x"+printDrawable.getHeight()+ + ", drawableSize "+printDrawable.getSurfaceWidth()+"x"+printDrawable.getSurfaceHeight()+ ", customTileSize "+printAWTTiles.customTileWidth+"x"+printAWTTiles.customTileHeight+ ", scaleMat "+printAWTTiles.scaleMatX+" x "+printAWTTiles.scaleMatY+ ", numSamples "+printAWTTiles.customNumSamples+" -> "+printNumSamples+", printAnimator "+printAnimator); @@ -863,13 +874,13 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing printDrawable = printGLAD.getDelegatedDrawable(); } printAWTTiles.setGLOrientation(printGLAD.isGLOriented(), printGLAD.isGLOriented()); - printAWTTiles.renderer.setTileSize(printDrawable.getWidth(), printDrawable.getHeight(), 0); + printAWTTiles.renderer.setTileSize(printDrawable.getSurfaceWidth(), printDrawable.getSurfaceHeight(), 0); printAWTTiles.renderer.attachAutoDrawable(printGLAD); if( DEBUG ) { System.err.println("AWT print.setup "+printAWTTiles); System.err.println("AWT print.setup AA "+printNumSamples+", "+caps); - System.err.println("AWT print.setup printGLAD: "+printGLAD.getWidth()+"x"+printGLAD.getHeight()+", "+printGLAD); - System.err.println("AWT print.setup printDraw: "+printDrawable.getWidth()+"x"+printDrawable.getHeight()+", "+printDrawable); + System.err.println("AWT print.setup printGLAD: "+printGLAD.getSurfaceWidth()+"x"+printGLAD.getSurfaceHeight()+", "+printGLAD); + System.err.println("AWT print.setup printDraw: "+printDrawable.getSurfaceWidth()+"x"+printDrawable.getSurfaceHeight()+", "+printDrawable); } } }; @@ -1122,6 +1133,16 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing } @Override + public int getSurfaceWidth() { + return getWidth() * getPixelScale(); + } + + @Override + public int getSurfaceHeight() { + return getHeight() * getPixelScale(); + } + + @Override public boolean isGLOriented() { final GLDrawable _drawable = drawable; return null != _drawable ? _drawable.isGLOriented() : true; @@ -1148,23 +1169,25 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing @Override public String toString() { final GLDrawable _drawable = drawable; - final int dw = (null!=_drawable) ? _drawable.getWidth() : -1; - final int dh = (null!=_drawable) ? _drawable.getHeight() : -1; + final int dw = (null!=_drawable) ? _drawable.getSurfaceWidth() : -1; + final int dh = (null!=_drawable) ? _drawable.getSurfaceHeight() : -1; return "AWT-GLCanvas[Realized "+isRealized()+ ",\n\t"+((null!=_drawable)?_drawable.getClass().getName():"null-drawable")+ ",\n\tFactory "+getFactory()+ ",\n\thandle 0x"+Long.toHexString(getHandle())+ - ",\n\tDrawable size "+dw+"x"+dh+ - ",\n\tAWT pos "+getX()+"/"+getY()+", size "+getWidth()+"x"+getHeight()+ + ",\n\tDrawable size "+dw+"x"+dh+" surface["+getSurfaceWidth()+"x"+getSurfaceHeight()+"]"+ + ",\n\tAWT[pos "+getX()+"/"+getY()+", size "+getWidth()+"x"+getHeight()+ ",\n\tvisible "+isVisible()+", displayable "+isDisplayable()+", showing "+isShowing+ - ",\n\t"+awtConfig+"]"; + ",\n\t"+awtConfig+"]]"; } //---------------------------------------------------------------------- // Internals only below this point // + private final int getPixelScale() { return pixelScale; } + private final Runnable destroyOnEDTAction = new Runnable() { @Override public void run() { @@ -1247,6 +1270,7 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing } jawtWindow=null; } + pixelScale = 1; if(null != awtConfig) { final AbstractGraphicsConfiguration aconfig = awtConfig.getNativeGraphicsConfiguration(); @@ -1278,11 +1302,11 @@ public class GLCanvas extends Canvas implements AWTGLAutoDrawable, WindowClosing public void run() { if (sendReshape) { if(DEBUG) { - System.err.println(getThreadName()+": Reshape: "+getWidth()+"x"+getHeight()); + System.err.println(getThreadName()+": Reshape: "+getSurfaceWidth()+"x"+getSurfaceHeight()); } // Note: we ignore the given x and y within the parent component // since we are drawing directly into this heavyweight component. - helper.reshape(GLCanvas.this, 0, 0, getWidth(), getHeight()); + helper.reshape(GLCanvas.this, 0, 0, getSurfaceWidth(), getSurfaceHeight()); sendReshape = false; } diff --git a/src/jogl/classes/javax/media/opengl/awt/GLJPanel.java b/src/jogl/classes/javax/media/opengl/awt/GLJPanel.java index 8bcf97ba1..65b61d3aa 100644 --- a/src/jogl/classes/javax/media/opengl/awt/GLJPanel.java +++ b/src/jogl/classes/javax/media/opengl/awt/GLJPanel.java @@ -175,8 +175,6 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing private static final boolean USE_GLSL_TEXTURE_RASTERIZER; private static final boolean SKIP_VERTICAL_FLIP_DEFAULT; - private static final boolean SKIP_HIDPI; - /** Indicates whether the Java 2D OpenGL pipeline is requested by user. */ private static final boolean java2dOGLEnabledByProp; @@ -192,7 +190,6 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing DEBUG_VIEWPORT = Debug.isPropertyDefined("jogl.debug.GLJPanel.Viewport", true); USE_GLSL_TEXTURE_RASTERIZER = !Debug.isPropertyDefined("jogl.gljpanel.noglsl", true); SKIP_VERTICAL_FLIP_DEFAULT = Debug.isPropertyDefined("jogl.gljpanel.noverticalflip", true); - SKIP_HIDPI = Debug.isPropertyDefined("jogl.gljpanel.nohidpi", true); boolean enabled = Debug.getBooleanProperty("sun.java2d.opengl", false); java2dOGLEnabledByProp = enabled && !Debug.isPropertyDefined("jogl.gljpanel.noogl", true); @@ -247,15 +244,15 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing private boolean handleReshape = false; private boolean sendReshape = true; + private volatile int pixelScale; + // For handling reshape events lazily: reshapeWidth -> panelWidth -> backend.width private int reshapeWidth; private int reshapeHeight; - private int reshapeScale; // Width of the actual GLJPanel: reshapeWidth -> panelWidth -> backend.width private int panelWidth = 0; private int panelHeight = 0; - private int panelScale = 0; // These are always set to (0, 0) except when the Java2D / OpenGL // pipeline is active @@ -371,6 +368,7 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing this.setFocusable(true); // allow keyboard input! this.addHierarchyListener(hierarchyListener); this.isShowing = isShowing(); + this.pixelScale = 1; } /** @@ -485,6 +483,7 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing animator.resume(); } } + pixelScale = 1; if(DEBUG) { System.err.println(getThreadName()+": GLJPanel.dispose() - stop"); @@ -563,8 +562,12 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing public void addNotify() { super.addNotify(); awtWindowClosingProtocol.addClosingListener(); + { + final int s = JAWTUtil.getPixelScale(this); + pixelScale = 0 < s ? s : 1; + } if (DEBUG) { - System.err.println(getThreadName()+": GLJPanel.addNotify()"); + System.err.println(getThreadName()+": GLJPanel.addNotify()"); } } @@ -607,7 +610,6 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing if( !printActive ) { reshapeWidth = scaledWidth; reshapeHeight = scaledHeight; - reshapeScale = scale; handleReshape = true; } } @@ -657,12 +659,12 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing final int printNumSamples = printAWTTiles.getNumSamples(caps); GLDrawable printDrawable = printGLAD.getDelegatedDrawable(); final boolean reqNewGLADSamples = printNumSamples != caps.getNumSamples(); - final boolean reqNewGLADSize = printAWTTiles.customTileWidth != -1 && printAWTTiles.customTileWidth != printDrawable.getWidth() || - printAWTTiles.customTileHeight != -1 && printAWTTiles.customTileHeight != printDrawable.getHeight(); + final boolean reqNewGLADSize = printAWTTiles.customTileWidth != -1 && printAWTTiles.customTileWidth != printDrawable.getSurfaceWidth() || + printAWTTiles.customTileHeight != -1 && printAWTTiles.customTileHeight != printDrawable.getSurfaceHeight(); final boolean reqNewGLAD = reqNewGLADSamples || reqNewGLADSize ; if( DEBUG ) { System.err.println("AWT print.setup: reqNewGLAD "+reqNewGLAD+"[ samples "+reqNewGLADSamples+", size "+reqNewGLADSize+"], "+ - ", drawableSize "+printDrawable.getWidth()+"x"+printDrawable.getHeight()+ + ", drawableSize "+printDrawable.getSurfaceWidth()+"x"+printDrawable.getSurfaceHeight()+ ", customTileSize "+printAWTTiles.customTileWidth+"x"+printAWTTiles.customTileHeight+ ", scaleMat "+printAWTTiles.scaleMatX+" x "+printAWTTiles.scaleMatY+ ", numSamples "+printAWTTiles.customNumSamples+" -> "+printNumSamples+", printAnimator "+printAnimator); @@ -680,13 +682,13 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing printDrawable = printGLAD.getDelegatedDrawable(); } printAWTTiles.setGLOrientation( !GLJPanel.this.skipGLOrientationVerticalFlip && printGLAD.isGLOriented(), printGLAD.isGLOriented() ); - printAWTTiles.renderer.setTileSize(printDrawable.getWidth(), printDrawable.getHeight(), 0); + printAWTTiles.renderer.setTileSize(printDrawable.getSurfaceWidth(), printDrawable.getSurfaceHeight(), 0); printAWTTiles.renderer.attachAutoDrawable(printGLAD); if( DEBUG ) { System.err.println("AWT print.setup "+printAWTTiles); System.err.println("AWT print.setup AA "+printNumSamples+", "+caps); - System.err.println("AWT print.setup printGLAD: "+printGLAD.getWidth()+"x"+printGLAD.getHeight()+", "+printGLAD); - System.err.println("AWT print.setup printDraw: "+printDrawable.getWidth()+"x"+printDrawable.getHeight()+", "+printDrawable); + System.err.println("AWT print.setup printGLAD: "+printGLAD.getSurfaceWidth()+"x"+printGLAD.getSurfaceHeight()+", "+printGLAD); + System.err.println("AWT print.setup printDraw: "+printDrawable.getSurfaceWidth()+"x"+printDrawable.getSurfaceHeight()+", "+printDrawable); } } }; @@ -727,16 +729,15 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing final int scaledAWTHeight= scale * awtHeight; final GLDrawable drawable = GLJPanel.this.getDelegatedDrawable(); if( scaledAWTWidth != panelWidth || scaledAWTHeight != panelHeight || - drawable.getWidth() != panelWidth || drawable.getHeight() != panelHeight ) { + drawable.getSurfaceWidth() != panelWidth || drawable.getSurfaceHeight() != panelHeight ) { // -> !( awtSize == panelSize == drawableSize ) if ( DEBUG ) { - System.err.println(getThreadName()+": GLJPanel.releasePrintOnEDT.0: resizeWithinPrint panel " +panelWidth+"x"+panelHeight + " @ scale "+panelScale+ - ", draw "+drawable.getWidth()+"x"+drawable.getHeight()+ + System.err.println(getThreadName()+": GLJPanel.releasePrintOnEDT.0: resizeWithinPrint panel " +panelWidth+"x"+panelHeight + " @ scale "+getPixelScale()+ + ", draw "+drawable.getSurfaceWidth()+"x"+drawable.getSurfaceHeight()+ " -> " + awtWidth+"x"+awtHeight+" * "+scale+" -> "+scaledAWTWidth+"x"+scaledAWTHeight); } reshapeWidth = scaledAWTWidth; reshapeHeight = scaledAWTHeight; - reshapeScale = scale; sendReshape = handleReshape(); // reshapeSize -> panelSize, backend reshape w/ GL reshape } else { sendReshape = true; // only GL reshape @@ -1017,6 +1018,16 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing return oglPipelineUsable(); } + @Override + public int getSurfaceWidth() { + return getWidth() * getPixelScale(); + } + + @Override + public int getSurfaceHeight() { + return getHeight() * getPixelScale(); + } + /** * {@inheritDoc} * <p> @@ -1142,15 +1153,14 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing if (DEBUG) { System.err.println(getThreadName()+": GLJPanel.createAndInitializeBackend: " + - panelWidth+"x"+panelHeight+" @ scale "+panelScale + " -> " + - reshapeWidth+"x"+reshapeHeight+" @ scale "+reshapeScale); + panelWidth+"x"+panelHeight+" @ scale "+getPixelScale() + " -> " + + reshapeWidth+"x"+reshapeHeight+" @ scale "+getPixelScale()); } // Pull down reshapeWidth and reshapeHeight into panelWidth and // panelHeight eagerly in order to complete initialization, and // force a reshape later panelWidth = reshapeWidth; panelHeight = reshapeHeight; - panelScale = reshapeScale; } if ( null == backend ) { @@ -1172,14 +1182,7 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing } } - protected final int getPixelScale() { - if( SKIP_HIDPI ) { - return 1; - } else { - final int s = JAWTUtil.getPixelScale(this); - return 0 < s ? s : 1; - } - } + private final int getPixelScale() { return pixelScale; } @Override public WindowClosingMode getDefaultCloseOperation() { @@ -1194,12 +1197,11 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing private boolean handleReshape() { if (DEBUG) { System.err.println(getThreadName()+": GLJPanel.handleReshape: "+ - panelWidth+"x"+panelHeight+" @ scale "+panelScale + " -> " + - reshapeWidth+"x"+reshapeHeight+" @ scale "+reshapeScale); + panelWidth+"x"+panelHeight+" @ scale "+getPixelScale() + " -> " + + reshapeWidth+"x"+reshapeHeight+" @ scale "+getPixelScale()); } panelWidth = reshapeWidth; panelHeight = reshapeHeight; - panelScale = reshapeScale; return backend.handleReshape(); } @@ -1234,7 +1236,7 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing } if (sendReshape) { if (DEBUG) { - System.err.println(getThreadName()+": GLJPanel.display: reshape(" + viewportX + "," + viewportY + " " + panelWidth + "x" + panelHeight + " @ scale "+panelScale+")"); + System.err.println(getThreadName()+": GLJPanel.display: reshape(" + viewportX + "," + viewportY + " " + panelWidth + "x" + panelHeight + " @ scale "+getPixelScale()+")"); } helper.reshape(GLJPanel.this, viewportX, viewportY, panelWidth, panelHeight); sendReshape = false; @@ -1433,7 +1435,6 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing private final boolean useSingletonBuffer; private AWTGLPixelBuffer pixelBuffer; private BufferedImage alignedImage; - private int alignedImageScale; // One of these is used to store the read back pixels before storing // in the BufferedImage @@ -1515,12 +1516,12 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing fboDrawable.setTextureUnit( GLJPanel.this.requestedTextureUnit ); try { fboFlipped = new FBObject(); - fboFlipped.reset(gl, fboDrawable.getWidth(), fboDrawable.getHeight(), 0, false); + fboFlipped.reset(gl, fboDrawable.getSurfaceWidth(), fboDrawable.getSurfaceHeight(), 0, false); fboFlipped.attachTexture2D(gl, 0, chosenCaps.getAlphaBits()>0); // fboFlipped.attachRenderbuffer(gl, Attachment.Type.DEPTH, 24); glslTextureRaster = new GLSLTextureRaster(fboDrawable.getTextureUnit(), true); glslTextureRaster.init(gl.getGL2ES2()); - glslTextureRaster.reshape(gl.getGL2ES2(), 0, 0, fboDrawable.getWidth(), fboDrawable.getHeight()); + glslTextureRaster.reshape(gl.getGL2ES2(), 0, 0, fboDrawable.getSurfaceWidth(), fboDrawable.getSurfaceHeight()); } catch (Exception ex) { ex.printStackTrace(); if(null != glslTextureRaster) { @@ -1674,19 +1675,18 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing System.err.println(getThreadName()+": GLJPanel.OffscreenBackend.postGL.0: "+GLJPanel.this.getName()+" pixelBufferProvider isSingletonBufferProvider "+useSingletonBuffer+", 0x"+Integer.toHexString(pixelBufferProvider.hashCode())+", "+pixelBufferProvider.getClass().getSimpleName()); System.err.println(getThreadName()+": GLJPanel.OffscreenBackend.postGL.0: "+GLJPanel.this.getName()+" pixelBuffer 0x"+Integer.toHexString(pixelBuffer.hashCode())+", "+pixelBuffer+", alignment "+alignment); System.err.println(getThreadName()+": GLJPanel.OffscreenBackend.postGL.0: "+GLJPanel.this.getName()+" flippedVertical "+flipVertical+", glslTextureRaster "+(null!=glslTextureRaster)); - System.err.println(getThreadName()+": GLJPanel.OffscreenBackend.postGL.0: "+GLJPanel.this.getName()+" panelSize "+panelWidth+"x"+panelHeight+" @ scale "+panelScale); + System.err.println(getThreadName()+": GLJPanel.OffscreenBackend.postGL.0: "+GLJPanel.this.getName()+" panelSize "+panelWidth+"x"+panelHeight+" @ scale "+getPixelScale()); } } - if( offscreenDrawable.getWidth() != panelWidth || offscreenDrawable.getHeight() != panelHeight ) { - throw new InternalError("OffscreenDrawable panelSize mismatch (reshape missed): panelSize "+panelWidth+"x"+panelHeight+" != drawable "+offscreenDrawable.getWidth()+"x"+offscreenDrawable.getHeight()+", on thread "+getThreadName()); + if( offscreenDrawable.getSurfaceWidth() != panelWidth || offscreenDrawable.getSurfaceHeight() != panelHeight ) { + throw new InternalError("OffscreenDrawable panelSize mismatch (reshape missed): panelSize "+panelWidth+"x"+panelHeight+" != drawable "+offscreenDrawable.getSurfaceWidth()+"x"+offscreenDrawable.getSurfaceHeight()+", on thread "+getThreadName()); } if( null == alignedImage || panelWidth != alignedImage.getWidth() || panelHeight != alignedImage.getHeight() || !pixelBuffer.isDataBufferSource(alignedImage) ) { alignedImage = pixelBuffer.getAlignedImage(panelWidth, panelHeight); - alignedImageScale = panelScale; if(DEBUG) { - System.err.println(getThreadName()+": GLJPanel.OffscreenBackend.postGL.0: "+GLJPanel.this.getName()+" new alignedImage "+alignedImage.getWidth()+"x"+alignedImage.getHeight()+" @ scale "+alignedImageScale+", "+alignedImage+", pixelBuffer "+pixelBuffer.width+"x"+pixelBuffer.height+", "+pixelBuffer); + System.err.println(getThreadName()+": GLJPanel.OffscreenBackend.postGL.0: "+GLJPanel.this.getName()+" new alignedImage "+alignedImage.getWidth()+"x"+alignedImage.getHeight()+" @ scale "+getPixelScale()+", "+alignedImage+", pixelBuffer "+pixelBuffer.width+"x"+pixelBuffer.height+", "+pixelBuffer); } } final IntBuffer readBackInts; @@ -1737,14 +1737,14 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing final int[] usrViewport = new int[] { 0, 0, 0, 0 }; gl.glGetIntegerv(GL.GL_VIEWPORT, usrViewport, 0); viewportChange = 0 != usrViewport[0] || 0 != usrViewport[1] || - offscreenDrawable.getWidth() != usrViewport[2] || offscreenDrawable.getHeight() != usrViewport[3]; + offscreenDrawable.getSurfaceWidth() != usrViewport[2] || offscreenDrawable.getSurfaceHeight() != usrViewport[3]; if( DEBUG_VIEWPORT ) { System.err.println(getThreadName()+": GLJPanel.OffscreenBackend.postGL: "+GLJPanel.this.getName()+" Viewport: change "+viewportChange+ ", "+usrViewport[0]+"/"+usrViewport[1]+" "+usrViewport[2]+"x"+usrViewport[3]+ - " -> 0/0 "+offscreenDrawable.getWidth()+"x"+offscreenDrawable.getHeight()); + " -> 0/0 "+offscreenDrawable.getSurfaceWidth()+"x"+offscreenDrawable.getSurfaceHeight()); } if( viewportChange ) { - gl.glViewport(0, 0, offscreenDrawable.getWidth(), offscreenDrawable.getHeight()); + gl.glViewport(0, 0, offscreenDrawable.getSurfaceWidth(), offscreenDrawable.getSurfaceHeight()); } // perform vert-flipping via OpenGL/FBO @@ -1813,7 +1813,7 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing System.err.println(getThreadName()+": GLJPanel.OffscreenBackend.doPaintComponent.drawImage: - frameCount "+frameCount); } // Draw resulting image in one shot - g.drawImage(alignedImage, 0, 0, alignedImage.getWidth()/alignedImageScale, alignedImage.getHeight()/alignedImageScale, null); // Null ImageObserver since image data is ready. + g.drawImage(alignedImage, 0, 0, alignedImage.getWidth()/getPixelScale(), alignedImage.getHeight()/getPixelScale(), null); // Null ImageObserver since image data is ready. } frameCount++; } @@ -1835,17 +1835,17 @@ public class GLJPanel extends JPanel implements AWTGLAutoDrawable, WindowClosing } } if (DEBUG) { - System.err.println(getThreadName()+": GLJPanel.OffscreenBackend.handleReshape: " +panelWidth+"x"+panelHeight + " @ scale "+panelScale + " -> " + _drawable.getWidth()+"x"+_drawable.getHeight()); + System.err.println(getThreadName()+": GLJPanel.OffscreenBackend.handleReshape: " +panelWidth+"x"+panelHeight + " @ scale "+getPixelScale() + " -> " + _drawable.getSurfaceWidth()+"x"+_drawable.getSurfaceHeight()); } - panelWidth = _drawable.getWidth(); - panelHeight = _drawable.getHeight(); + panelWidth = _drawable.getSurfaceWidth(); + panelHeight = _drawable.getSurfaceHeight(); if( null != glslTextureRaster ) { if( GLContext.CONTEXT_NOT_CURRENT < offscreenContext.makeCurrent() ) { try { final GL gl = offscreenContext.getGL(); - fboFlipped.reset(gl, _drawable.getWidth(), _drawable.getHeight(), 0, false); - glslTextureRaster.reshape(gl.getGL2ES2(), 0, 0, _drawable.getWidth(), _drawable.getHeight()); + fboFlipped.reset(gl, _drawable.getSurfaceWidth(), _drawable.getSurfaceHeight(), 0, false); + glslTextureRaster.reshape(gl.getGL2ES2(), 0, 0, _drawable.getSurfaceWidth(), _drawable.getSurfaceHeight()); } finally { offscreenContext.release(); } diff --git a/src/jogl/classes/jogamp/opengl/GLAutoDrawableBase.java b/src/jogl/classes/jogamp/opengl/GLAutoDrawableBase.java index 7cd685d5a..de7653570 100644 --- a/src/jogl/classes/jogamp/opengl/GLAutoDrawableBase.java +++ b/src/jogl/classes/jogamp/opengl/GLAutoDrawableBase.java @@ -393,7 +393,7 @@ public abstract class GLAutoDrawableBase implements GLAutoDrawable, GLStateKeepe public final void run() { // Lock: Locked Surface/Window by display _and_ MakeCurrent/Release if (sendReshape) { - helper.reshape(GLAutoDrawableBase.this, 0, 0, getWidth(), getHeight()); + helper.reshape(GLAutoDrawableBase.this, 0, 0, getSurfaceWidth(), getSurfaceHeight()); sendReshape = false; } helper.display(GLAutoDrawableBase.this); @@ -412,7 +412,7 @@ public abstract class GLAutoDrawableBase implements GLAutoDrawable, GLStateKeepe if( null == context ) { boolean contextCreated = false; final GLDrawableImpl _drawable = drawable; - if ( null != _drawable && _drawable.isRealized() && 0<_drawable.getWidth()*_drawable.getHeight() ) { + if ( null != _drawable && _drawable.isRealized() && 0<_drawable.getSurfaceWidth()*_drawable.getSurfaceHeight() ) { final GLContext[] shareWith = { null }; if( !helper.isSharedGLContextPending(shareWith) ) { if( !restoreGLEventListenerState() ) { @@ -669,7 +669,7 @@ public abstract class GLAutoDrawableBase implements GLAutoDrawable, GLStateKeepe _lock.lock(); try { final GLDrawable _drawable = drawable; - if( null == _drawable || realized && ( 0 >= _drawable.getWidth() || 0 >= _drawable.getHeight() ) ) { + if( null == _drawable || realized && ( 0 >= _drawable.getSurfaceWidth() || 0 >= _drawable.getSurfaceHeight() ) ) { return; } _drawable.setRealized(realized); @@ -688,15 +688,15 @@ public abstract class GLAutoDrawableBase implements GLAutoDrawable, GLStateKeepe } @Override - public int getWidth() { + public int getSurfaceWidth() { final GLDrawable _drawable = drawable; - return null != _drawable ? _drawable.getWidth() : 0; + return null != _drawable ? _drawable.getSurfaceWidth() : 0; } @Override - public int getHeight() { + public int getSurfaceHeight() { final GLDrawable _drawable = drawable; - return null != _drawable ? _drawable.getHeight() : 0; + return null != _drawable ? _drawable.getSurfaceHeight() : 0; } @Override diff --git a/src/jogl/classes/jogamp/opengl/GLContextImpl.java b/src/jogl/classes/jogamp/opengl/GLContextImpl.java index d2f69029e..c815556ff 100644 --- a/src/jogl/classes/jogamp/opengl/GLContextImpl.java +++ b/src/jogl/classes/jogamp/opengl/GLContextImpl.java @@ -634,7 +634,7 @@ public abstract class GLContextImpl extends GLContext { private final int makeCurrentWithinLock(int surfaceLockRes) throws GLException { if (!isCreated()) { - if( 0 >= drawable.getWidth() || 0 >= drawable.getHeight() ) { + if( 0 >= drawable.getSurfaceWidth() || 0 >= drawable.getSurfaceHeight() ) { if ( DEBUG_TRACE_SWITCH ) { System.err.println(getThreadName() + ": Create GL context REJECTED (zero surface size) obj " + toHexString(hashCode()) + ", surf "+toHexString(drawable.getHandle())+" for " + getClass().getName()); System.err.println(drawable.toString()); diff --git a/src/jogl/classes/jogamp/opengl/GLDrawableFactoryImpl.java b/src/jogl/classes/jogamp/opengl/GLDrawableFactoryImpl.java index c914b5e10..2dbd6dee3 100644 --- a/src/jogl/classes/jogamp/opengl/GLDrawableFactoryImpl.java +++ b/src/jogl/classes/jogamp/opengl/GLDrawableFactoryImpl.java @@ -417,9 +417,9 @@ public abstract class GLDrawableFactoryImpl extends GLDrawableFactory { * @param deviceReq which {@link javax.media.nativewindow.AbstractGraphicsDevice#getConnection() connection} denotes the shared device to be used, may be <code>null</code> for the platform's default device. * @param requestedCaps * @param chooser the custom chooser, may be null for default - * @param width the initial width as returned by {@link NativeSurface#getWidth()}, not the actual dummy surface width. + * @param width the initial width as returned by {@link NativeSurface#getSurfaceWidth()}, not the actual dummy surface width. * The latter is platform specific and small - * @param height the initial height as returned by {@link NativeSurface#getHeight()}, not the actual dummy surface height, + * @param height the initial height as returned by {@link NativeSurface#getSurfaceHeight()}, not the actual dummy surface height, * The latter is platform specific and small * * @return the created {@link ProxySurface} instance w/o defined surface handle but platform specific {@link UpstreamSurfaceHook}. @@ -446,9 +446,9 @@ public abstract class GLDrawableFactoryImpl extends GLDrawableFactory { * @param chosenCaps * @param requestedCaps * @param chooser the custom chooser, may be null for default - * @param width the initial width as returned by {@link NativeSurface#getWidth()}, not the actual dummy surface width. + * @param width the initial width as returned by {@link NativeSurface#getSurfaceWidth()}, not the actual dummy surface width. * The latter is platform specific and small - * @param height the initial height as returned by {@link NativeSurface#getHeight()}, not the actual dummy surface height, + * @param height the initial height as returned by {@link NativeSurface#getSurfaceHeight()}, not the actual dummy surface height, * The latter is platform specific and small * @return the created {@link ProxySurface} instance w/o defined surface handle but platform specific {@link UpstreamSurfaceHook}. */ diff --git a/src/jogl/classes/jogamp/opengl/GLDrawableHelper.java b/src/jogl/classes/jogamp/opengl/GLDrawableHelper.java index 0e135d5e0..6116a2886 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).setSize(newWidth, newHeight); + ((UpstreamSurfaceHook.MutableSize)ush).setPixelSize(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); } @@ -379,7 +379,7 @@ public class GLDrawableHelper { } finally { ns.unlockSurface(); } - if( validateSize && ( drawable.getWidth() != newWidth || drawable.getHeight() != newHeight ) ) { + if( validateSize && ( drawable.getSurfaceWidth() != newWidth || drawable.getSurfaceHeight() != newHeight ) ) { throw new InternalError("Incomplete resize operation: expected "+newWidth+"x"+newHeight+", has: "+drawable); } return drawable; @@ -616,7 +616,7 @@ public class GLDrawableHelper { private final void init(GLEventListener l, GLAutoDrawable drawable, boolean sendReshape, boolean setViewport) { l.init(drawable); if(sendReshape) { - reshape(l, drawable, 0, 0, drawable.getWidth(), drawable.getHeight(), setViewport, false /* checkInit */); + reshape(l, drawable, 0, 0, drawable.getSurfaceWidth(), drawable.getSurfaceHeight(), setViewport, false /* checkInit */); } } @@ -640,7 +640,7 @@ public class GLDrawableHelper { } } else { // Expose same GL initialization if not using GLEventListener - drawable.getGL().glViewport(0, 0, drawable.getWidth(), drawable.getHeight()); + drawable.getGL().glViewport(0, 0, drawable.getSurfaceWidth(), drawable.getSurfaceHeight()); } } } diff --git a/src/jogl/classes/jogamp/opengl/GLDrawableImpl.java b/src/jogl/classes/jogamp/opengl/GLDrawableImpl.java index d11274560..2070c2f4e 100644 --- a/src/jogl/classes/jogamp/opengl/GLDrawableImpl.java +++ b/src/jogl/classes/jogamp/opengl/GLDrawableImpl.java @@ -275,13 +275,13 @@ public abstract class GLDrawableImpl implements GLDrawable { } @Override - public int getWidth() { - return surface.getWidth(); + public int getSurfaceWidth() { + return surface.getSurfaceWidth(); } @Override - public int getHeight() { - return surface.getHeight(); + public int getSurfaceHeight() { + return surface.getSurfaceHeight(); } @Override diff --git a/src/jogl/classes/jogamp/opengl/GLFBODrawableImpl.java b/src/jogl/classes/jogamp/opengl/GLFBODrawableImpl.java index 5ab2fdf00..0e9d3c1bb 100644 --- a/src/jogl/classes/jogamp/opengl/GLFBODrawableImpl.java +++ b/src/jogl/classes/jogamp/opengl/GLFBODrawableImpl.java @@ -139,7 +139,7 @@ public class GLFBODrawableImpl extends GLDrawableImpl implements GLFBODrawable { for(int i=0; i<fbosN; i++) { fbos[i] = new FBObject(); - fbos[i].reset(gl, getWidth(), getHeight(), samples, false); + fbos[i].reset(gl, getSurfaceWidth(), getSurfaceHeight(), samples, false); if(fbos[i].getNumSamples() != samples) { throw new InternalError("Sample number mismatch: "+samples+", fbos["+i+"] "+fbos[i]); } @@ -211,7 +211,7 @@ public class GLFBODrawableImpl extends GLDrawableImpl implements GLFBODrawable { // resetQuirk fallback fbos[idx].destroy(gl); fbos[idx] = new FBObject(); - fbos[idx].reset(gl, getWidth(), getHeight(), samples, false); + fbos[idx].reset(gl, getSurfaceWidth(), getSurfaceHeight(), samples, false); if(fbos[idx].getNumSamples() != samples) { throw new InternalError("Sample number mismatch: "+samples+", fbos["+idx+"] "+fbos[idx]); } @@ -262,8 +262,8 @@ public class GLFBODrawableImpl extends GLDrawableImpl implements GLFBODrawable { if(DEBUG) { System.err.println("GLFBODrawableImpl.reset(): simple reconfig: "+samples+" -> "+newSamples+"/"+maxSamples); } - final int nWidth = getWidth(); - final int nHeight = getHeight(); + final int nWidth = getSurfaceWidth(); + final int nHeight = getSurfaceHeight(); samples = newSamples; pendingFBOReset = ( 1 < fbos.length ) ? fboIFront : -1; // pending-front reset only w/ double buffering (or zero samples) final GLCapabilitiesImmutable caps = (GLCapabilitiesImmutable) surface.getGraphicsConfiguration().getChosenCapabilities(); @@ -396,7 +396,7 @@ public class GLFBODrawableImpl extends GLDrawableImpl implements GLFBODrawable { // Safely reset the previous front FBO - after completing propagating swap if(0 <= pendingFBOReset) { final GLCapabilitiesImmutable caps = (GLCapabilitiesImmutable) surface.getGraphicsConfiguration().getChosenCapabilities(); - reset(glc.getGL(), pendingFBOReset, getWidth(), getHeight(), samples, caps.getAlphaBits(), caps.getStencilBits()); + reset(glc.getGL(), pendingFBOReset, getSurfaceWidth(), getSurfaceHeight(), samples, caps.getAlphaBits(), caps.getStencilBits()); pendingFBOReset = -1; } } @@ -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).setSize(newWidth, newHeight); + ((UpstreamSurfaceHook.MutableSize)ush).setPixelSize(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/egl/EGLDrawable.java b/src/jogl/classes/jogamp/opengl/egl/EGLDrawable.java index f184edae3..76c6e5beb 100644 --- a/src/jogl/classes/jogamp/opengl/egl/EGLDrawable.java +++ b/src/jogl/classes/jogamp/opengl/egl/EGLDrawable.java @@ -66,7 +66,7 @@ public abstract class EGLDrawable extends GLDrawableImpl { final EGLGraphicsConfiguration eglConfig = (EGLGraphicsConfiguration) eglws.getGraphicsConfiguration(); final NativeSurface upstreamSurface = eglws.getUpstreamSurface(); - long eglSurface = createSurface(eglConfig, eglws.getWidth(), eglws.getHeight(), upstreamSurface.getSurfaceHandle()); + long eglSurface = createSurface(eglConfig, eglws.getSurfaceWidth(), eglws.getSurfaceHeight(), upstreamSurface.getSurfaceHandle()); int eglError0; if (EGL.EGL_NO_SURFACE == eglSurface) { @@ -80,7 +80,7 @@ public abstract class EGLDrawable extends GLDrawableImpl { if(DEBUG) { System.err.println(getThreadName() + ": Info: Creation of window surface w/ surface handle failed: "+eglConfig+", error "+toHexString(eglError0)+", retry w/ windowHandle"); } - eglSurface = createSurface(eglConfig, eglws.getWidth(), eglws.getHeight(), nw.getWindowHandle()); + eglSurface = createSurface(eglConfig, eglws.getSurfaceWidth(), eglws.getSurfaceHeight(), nw.getWindowHandle()); if (EGL.EGL_NO_SURFACE == eglSurface) { eglError0 = EGL.eglGetError(); } diff --git a/src/jogl/classes/jogamp/opengl/egl/EGLDummyUpstreamSurfaceHook.java b/src/jogl/classes/jogamp/opengl/egl/EGLDummyUpstreamSurfaceHook.java index 818f32607..6deaa26c7 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#getWidth()} via {@link UpstreamSurfaceHook#getWidth(ProxySurface)}, + * @param width the initial width as returned by {@link NativeSurface#getSurfaceWidth()} via {@link UpstreamSurfaceHook#getPixelWidth(ProxySurface)}, * not the actual dummy surface width. * The latter is platform specific and small - * @param height the initial height as returned by {@link NativeSurface#getHeight()} via {@link UpstreamSurfaceHook#getHeight(ProxySurface)}, + * @param height the initial height as returned by {@link NativeSurface#getSurfaceHeight()} via {@link UpstreamSurfaceHook#getPixelHeight(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 5b911576e..8cc4580a7 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 setSize(int width, int height) { + public final void setPixelSize(int width, int height) { if(null != upstreamSurfaceHookMutableSize) { - upstreamSurfaceHookMutableSize.setSize(width, height); + upstreamSurfaceHookMutableSize.setPixelSize(width, height); } } @@ -199,19 +199,19 @@ public class EGLUpstreamSurfaceHook implements UpstreamSurfaceHook.MutableSize { } @Override - public final int getWidth(ProxySurface s) { - return upstreamSurface.getWidth(); + public final int getPixelWidth(ProxySurface s) { + return upstreamSurface.getSurfaceWidth(); } @Override - public final int getHeight(ProxySurface s) { - return upstreamSurface.getHeight(); + public final int getPixelHeight(ProxySurface s) { + return upstreamSurface.getSurfaceHeight(); } @Override public String toString() { final String us_s = null != upstreamSurface ? ( upstreamSurface.getClass().getName() + ": 0x" + Long.toHexString(upstreamSurface.getSurfaceHandle()) ) : "nil"; - return "EGLUpstreamSurfaceHook[ "+ upstreamSurface.getWidth() + "x" + upstreamSurface.getHeight() + ", " + us_s+ "]"; + return "EGLUpstreamSurfaceHook[ "+ upstreamSurface.getSurfaceWidth() + "x" + upstreamSurface.getSurfaceHeight() + ", " + us_s+ "]"; } } diff --git a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLContext.java b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLContext.java index 259c70641..d3cfffdea 100644 --- a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLContext.java +++ b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLContext.java @@ -364,8 +364,8 @@ public class MacOSXCGLContext extends GLContextImpl protected void drawableUpdatedNotify() throws GLException { if( drawable.getChosenGLCapabilities().isOnscreen() ) { final long _updateHandle = getUpdateHandle(); - final int w = drawable.getWidth(); - final int h = drawable.getHeight(); + final int w = drawable.getSurfaceWidth(); + final int h = drawable.getSurfaceHeight(); final boolean updateContext = ( 0!=_updateHandle && CGL.updateContextNeedsUpdate(_updateHandle) ) || w != lastWidth || h != lastHeight; if(updateContext) { @@ -681,14 +681,17 @@ public class MacOSXCGLContext extends GLContextImpl final long pbuffer; final int texID; final boolean isOpaque; - final int width; - final int height; + final int texWidth; + final int texHeight; + final int winWidth; + final int winHeight; /** Synchronized by instance's monitor */ long nsOpenGLLayer; /** Synchronized by instance's monitor */ boolean valid; - AttachGLLayerCmd(OffscreenLayerSurface ols, long ctx, int shaderProgram, long pfmt, long pbuffer, int texID, boolean isOpaque, int width, int height) { + AttachGLLayerCmd(OffscreenLayerSurface ols, long ctx, int shaderProgram, long pfmt, long pbuffer, int texID, + boolean isOpaque, int texWidth, int texHeight, int winWidth, int winHeight) { this.ols = ols; this.ctx = ctx; this.shaderProgram = shaderProgram; @@ -696,14 +699,16 @@ public class MacOSXCGLContext extends GLContextImpl this.pbuffer = pbuffer; this.texID = texID; this.isOpaque = isOpaque; - this.width = width; - this.height = height; + this.texWidth = texWidth; + this.texHeight = texHeight; + this.winWidth = winWidth; + this.winHeight = winHeight; this.valid = false; this.nsOpenGLLayer = 0; } public final String contentToString() { - return "valid "+valid+", size "+width+"x"+height+", ctx "+toHexString(ctx)+", opaque "+isOpaque+", texID "+texID+", pbuffer "+toHexString(pbuffer)+", nsOpenGLLayer "+toHexString(nsOpenGLLayer); + return "valid "+valid+", size tex["+texWidth+"x"+texHeight+"], win["+winWidth+"x"+winHeight+"], ctx "+toHexString(ctx)+", opaque "+isOpaque+", texID "+texID+", pbuffer "+toHexString(pbuffer)+", nsOpenGLLayer "+toHexString(nsOpenGLLayer); } @Override @@ -722,7 +727,8 @@ public class MacOSXCGLContext extends GLContextImpl try { if( MacOSXCGLContext.this.lock.tryLock( maxwait ) ) { try { - nsOpenGLLayer = CGL.createNSOpenGLLayer(ctx, shaderProgram, pfmt, pbuffer, texID, isOpaque, width, height); + nsOpenGLLayer = CGL.createNSOpenGLLayer(ctx, shaderProgram, pfmt, pbuffer, texID, isOpaque, + texWidth, texHeight, winWidth, winHeight); ols.attachSurfaceLayer(nsOpenGLLayer); final int currentInterval = MacOSXCGLContext.this.getSwapInterval(); final int interval = 0 <= currentInterval ? currentInterval : 1; @@ -838,8 +844,8 @@ public class MacOSXCGLContext extends GLContextImpl } else { throw new GLException("BackingLayerHost w/ unknown handle (!FBO, !PBuffer): "+drawable); } - lastWidth = drawable.getWidth(); - lastHeight = drawable.getHeight(); + lastWidth = drawable.getSurfaceWidth(); + lastHeight = drawable.getSurfaceHeight(); if(0>=lastWidth || 0>=lastHeight || !drawable.isRealized()) { throw new GLException("Drawable not realized yet or invalid texture size, texSize "+lastWidth+"x"+lastHeight+", "+drawable); } @@ -853,16 +859,21 @@ 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); + } attachGLLayerCmd = new AttachGLLayerCmd( backingLayerHost, ctx, gl3ShaderProgramName, pixelFormat, pbufferHandle, texID, - chosenCaps.isBackgroundOpaque(), lastWidth, lastHeight ); + chosenCaps.isBackgroundOpaque(), lastWidth, lastHeight, winSize[0], winSize[1] ); if(DEBUG) { System.err.println("MaxOSXCGLContext.NSOpenGLImpl.associateDrawable(true): "+attachGLLayerCmd); } OSXUtil.RunOnMainThread(false, attachGLLayerCmd); } else { // -> null == backingLayerHost - lastWidth = drawable.getWidth(); - lastHeight = drawable.getHeight(); + lastWidth = drawable.getSurfaceWidth(); + lastHeight = drawable.getSurfaceHeight(); boolean[] isPBuffer = { false }; boolean[] isFBO = { false }; CGL.setContextView(contextHandle, getNSViewHandle(isPBuffer, isFBO)); @@ -913,11 +924,11 @@ public class MacOSXCGLContext extends GLContextImpl /** Returns true if size has been updated, otherwise false (same size). */ private final boolean validateDrawableSizeConfig(long ctx) { - final int width = drawable.getWidth(); - final int height = drawable.getHeight(); + final int width = drawable.getSurfaceWidth(); + final int height = drawable.getSurfaceHeight(); if( lastWidth != width || lastHeight != height ) { - lastWidth = drawable.getWidth(); - lastHeight = drawable.getHeight(); + lastWidth = drawable.getSurfaceWidth(); + lastHeight = drawable.getSurfaceHeight(); if(DEBUG) { System.err.println("NS.validateDrawableConfig size changed"); } diff --git a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXExternalCGLContext.java b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXExternalCGLContext.java index ebb0fc6d1..150feac55 100644 --- a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXExternalCGLContext.java +++ b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXExternalCGLContext.java @@ -145,12 +145,12 @@ public class MacOSXExternalCGLContext extends MacOSXCGLContext { } @Override - public int getWidth() { + public int getSurfaceWidth() { throw new GLException("Should not call this"); } @Override - public int getHeight() { + public int getSurfaceHeight() { throw new GLException("Should not call this"); } diff --git a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXPbufferCGLDrawable.java b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXPbufferCGLDrawable.java index f6e8b8fa3..eba97a9ca 100644 --- a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXPbufferCGLDrawable.java +++ b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXPbufferCGLDrawable.java @@ -135,18 +135,18 @@ public class MacOSXPbufferCGLDrawable extends MacOSXCGLDrawable { pBufferTexTarget = GL.GL_TEXTURE_2D; if ( null!=sr && sr.isNPOTTextureAvailable() ) { - pBufferTexWidth = getWidth(); - pBufferTexHeight = getHeight(); + pBufferTexWidth = getSurfaceWidth(); + pBufferTexHeight = getSurfaceHeight(); } else { - pBufferTexWidth = GLBuffers.getNextPowerOf2(getWidth()); - pBufferTexHeight = GLBuffers.getNextPowerOf2(getHeight()); + pBufferTexWidth = GLBuffers.getNextPowerOf2(getSurfaceWidth()); + pBufferTexHeight = GLBuffers.getNextPowerOf2(getSurfaceHeight()); } final int internalFormat = GL.GL_RGBA; - final long pBuffer = impl.create(pBufferTexTarget, internalFormat, getWidth(), getHeight()); + final long pBuffer = impl.create(pBufferTexTarget, internalFormat, getSurfaceWidth(), getSurfaceHeight()); if(DEBUG) { System.err.println("MacOSXPbufferCGLDrawable tex: target "+toHexString(pBufferTexTarget)+ - ", pbufferSize "+getWidth()+"x"+getHeight()+ + ", pbufferSize "+getSurfaceWidth()+"x"+getSurfaceHeight()+ ", texSize "+pBufferTexWidth+"x"+pBufferTexHeight+ ", internal-fmt "+toHexString(internalFormat)); System.err.println("MacOSXPbufferCGLDrawable pBuffer: "+toHexString(pBuffer)); diff --git a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsBitmapWGLDrawable.java b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsBitmapWGLDrawable.java index f658a3598..1ad3fed8d 100644 --- a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsBitmapWGLDrawable.java +++ b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsBitmapWGLDrawable.java @@ -111,8 +111,8 @@ public class WindowsBitmapWGLDrawable extends WindowsWGLDrawable { } final WindowsWGLGraphicsConfiguration config = (WindowsWGLGraphicsConfiguration)ns.getGraphicsConfiguration(); final GLCapabilitiesImmutable capsChosen = (GLCapabilitiesImmutable)config.getChosenCapabilities(); - final int width = getWidth(); - final int height = getHeight(); + final int width = getSurfaceWidth(); + final int height = getSurfaceHeight(); // // 1. Create DIB Section diff --git a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsExternalWGLContext.java b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsExternalWGLContext.java index c46b3c9dd..2047a91b5 100644 --- a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsExternalWGLContext.java +++ b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsExternalWGLContext.java @@ -129,12 +129,12 @@ public class WindowsExternalWGLContext extends WindowsWGLContext { } @Override - public int getWidth() { + public int getSurfaceWidth() { throw new GLException("Should not call this"); } @Override - public int getHeight() { + public int getSurfaceHeight() { throw new GLException("Should not call this"); } diff --git a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsExternalWGLDrawable.java b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsExternalWGLDrawable.java index f8c237c9e..11e0202fd 100644 --- a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsExternalWGLDrawable.java +++ b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsExternalWGLDrawable.java @@ -51,7 +51,6 @@ import javax.media.opengl.GLProfile; import jogamp.nativewindow.WrappedSurface; import jogamp.nativewindow.windows.GDI; -import jogamp.nativewindow.windows.GDIUtil; public class WindowsExternalWGLDrawable extends WindowsWGLDrawable { @@ -86,12 +85,12 @@ public class WindowsExternalWGLDrawable extends WindowsWGLDrawable { } @Override - public int getWidth() { + public int getSurfaceWidth() { throw new GLException("Should not call this"); } @Override - public int getHeight() { + public int getSurfaceHeight() { throw new GLException("Should not call this"); } } diff --git a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsPbufferWGLDrawable.java b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsPbufferWGLDrawable.java index 2e60c682b..e0bf1f50b 100644 --- a/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsPbufferWGLDrawable.java +++ b/src/jogl/classes/jogamp/opengl/windows/wgl/WindowsPbufferWGLDrawable.java @@ -181,7 +181,7 @@ public class WindowsPbufferWGLDrawable extends WindowsWGLDrawable { iattributes.put(niattribs++, 0); - tmpBuffer = wglExt.wglCreatePbufferARB(sharedHdc, format, getWidth(), getHeight(), iattributes); + tmpBuffer = wglExt.wglCreatePbufferARB(sharedHdc, format, getSurfaceWidth(), getSurfaceHeight(), iattributes); if (tmpBuffer != 0) { // Done break; diff --git a/src/jogl/classes/jogamp/opengl/x11/glx/X11ExternalGLXContext.java b/src/jogl/classes/jogamp/opengl/x11/glx/X11ExternalGLXContext.java index ff9363ca0..45c666230 100644 --- a/src/jogl/classes/jogamp/opengl/x11/glx/X11ExternalGLXContext.java +++ b/src/jogl/classes/jogamp/opengl/x11/glx/X11ExternalGLXContext.java @@ -141,12 +141,12 @@ public class X11ExternalGLXContext extends X11GLXContext { } @Override - public int getWidth() { + public int getSurfaceWidth() { throw new GLException("Should not call this"); } @Override - public int getHeight() { + public int getSurfaceHeight() { throw new GLException("Should not call this"); } diff --git a/src/jogl/classes/jogamp/opengl/x11/glx/X11PbufferGLXDrawable.java b/src/jogl/classes/jogamp/opengl/x11/glx/X11PbufferGLXDrawable.java index 0e771fd0f..ae2982269 100644 --- a/src/jogl/classes/jogamp/opengl/x11/glx/X11PbufferGLXDrawable.java +++ b/src/jogl/classes/jogamp/opengl/x11/glx/X11PbufferGLXDrawable.java @@ -105,9 +105,9 @@ public class X11PbufferGLXDrawable extends X11GLXDrawable { IntBuffer iattributes = Buffers.newDirectIntBuffer(7); iattributes.put(niattribs++, GLX.GLX_PBUFFER_WIDTH); - iattributes.put(niattribs++, ms.getWidth()); + iattributes.put(niattribs++, ms.getSurfaceWidth()); iattributes.put(niattribs++, GLX.GLX_PBUFFER_HEIGHT); - iattributes.put(niattribs++, ms.getHeight()); + iattributes.put(niattribs++, ms.getSurfaceHeight()); iattributes.put(niattribs++, GLX.GLX_LARGEST_PBUFFER); // exact iattributes.put(niattribs++, 0); iattributes.put(niattribs++, 0); diff --git a/src/jogl/classes/jogamp/opengl/x11/glx/X11PixmapGLXDrawable.java b/src/jogl/classes/jogamp/opengl/x11/glx/X11PixmapGLXDrawable.java index c1388db8a..42d76097c 100644 --- a/src/jogl/classes/jogamp/opengl/x11/glx/X11PixmapGLXDrawable.java +++ b/src/jogl/classes/jogamp/opengl/x11/glx/X11PixmapGLXDrawable.java @@ -83,7 +83,7 @@ public class X11PixmapGLXDrawable extends X11GLXDrawable { int screen = aScreen.getIndex(); pixmap = X11Lib.XCreatePixmap(dpy, X11Lib.RootWindow(dpy, screen), - surface.getWidth(), surface.getHeight(), bitsPerPixel); + surface.getSurfaceWidth(), surface.getSurfaceHeight(), bitsPerPixel); if (pixmap == 0) { throw new GLException("XCreatePixmap failed"); } diff --git a/src/jogl/native/macosx/MacOSXWindowSystemInterface-calayer.m b/src/jogl/native/macosx/MacOSXWindowSystemInterface-calayer.m index 7ce8c58cf..fb6fd18e9 100644 --- a/src/jogl/native/macosx/MacOSXWindowSystemInterface-calayer.m +++ b/src/jogl/native/macosx/MacOSXWindowSystemInterface-calayer.m @@ -194,7 +194,9 @@ extern GLboolean glIsVertexArray (GLuint array); texIDArg: (GLuint) texID opaque: (Bool) opaque texWidth: (int) texWidth - texHeight: (int) texHeight; + texHeight: (int) texHeight + winWidth: (int)winWidth + winHeight: (int)winHeight; - (void)releaseLayer; - (void)deallocPBuffer; @@ -206,7 +208,7 @@ extern GLboolean glIsVertexArray (GLuint array); - (Bool)isGLSourceValid; - (void) setGLEnabled: (Bool) enable; -- (Bool) validateTexSize: (CGRect) lRect; +- (Bool) validateTexSize: (int)newTexWidth height:(int)newTexHeight; - (void) setTextureID: (int) _texID; - (Bool) isSamePBuffer: (NSOpenGLPixelBuffer*) p; @@ -274,7 +276,9 @@ static const GLfloat gl_verts[] = { texIDArg: (GLuint) texID opaque: (Bool) opaque texWidth: (int) _texWidth - texHeight: (int) _texHeight; + texHeight: (int) _texHeight + winWidth: (int) _winWidth + winHeight: (int) _winHeight { pthread_mutexattr_t renderLockAttr; pthread_mutexattr_init(&renderLockAttr); @@ -288,6 +292,13 @@ static const GLfloat gl_verts[] = { gl_texCoords[i] = 0.0f; } } + if( _texWidth != _winWidth ) { +NS_DURING + // Available >= 10.7 + [self setContentsScale: (CGFloat)_texWidth/(CGFloat)_winWidth]; +NS_HANDLER +NS_ENDHANDLER + } parentPixelFmt = [_parentPixelFmt retain]; // until destruction glContext = [[MyNSOpenGLContext alloc] initWithFormat:parentPixelFmt shareContext:parentCtx]; gl3ShaderProgramName = _gl3ShaderProgramName; @@ -301,8 +312,8 @@ static const GLfloat gl_verts[] = { shallDraw = NO; isGLEnabled = YES; dedicatedFrameSet = NO; - dedicatedFrame = CGRectMake(0, 0, _texWidth, _texHeight); - [self validateTexSize: dedicatedFrame]; + dedicatedFrame = CGRectMake(0, 0, _winWidth, _winHeight); + [self validateTexSize: _texWidth height:_texHeight]; [self setTextureID: texID]; newPBuffer = NULL; @@ -383,15 +394,17 @@ static const GLfloat gl_verts[] = { isGLEnabled = enable; } -- (Bool) validateTexSize: (CGRect) lRect +- (Bool) validateTexSize: (int)newTexWidth height:(int)newTexHeight { - const int lRectW = (int) (lRect.size.width + 0.5f); - const int lRectH = (int) (lRect.size.height + 0.5f); Bool changed; - if( lRectH != texHeight || lRectW != texWidth ) { - texWidth = lRectW; - texHeight = lRectH; + if( newTexHeight != texHeight || newTexWidth != texWidth ) { + #ifdef VERBOSE_ON + const int oldTexWidth = texWidth; + const int oldTexHeight = texHeight; + #endif + texWidth = newTexWidth; + texHeight = newTexHeight; changed = YES; GLfloat texCoordWidth, texCoordHeight; @@ -415,10 +428,14 @@ static const GLfloat gl_verts[] = { gl_texCoords[4] = texCoordWidth; gl_texCoords[6] = texCoordWidth; #ifdef VERBOSE_ON - DBG_PRINT("MyNSOpenGLLayer::validateTexSize %p -> tex %dx%d, bounds: %lf/%lf %lfx%lf (%dx%d), dedicatedFrame set:%d %lf/%lf %lfx%lf\n", - self, texWidth, texHeight, - lRect.origin.x, lRect.origin.y, lRect.size.width, lRect.size.height, lRectW, lRectH, - dedicatedFrameSet, dedicatedFrame.origin.x, dedicatedFrame.origin.y, dedicatedFrame.size.width, dedicatedFrame.size.height); +NS_DURING + // Available >= 10.7 + DBG_PRINT("MyNSOpenGLLayer::validateTexSize %p: tex %dx%d -> %dx%d, dedicatedFrame set:%d %lf/%lf %lfx%lf scale %lf\n", + self, oldTexWidth, oldTexHeight, newTexWidth, newTexHeight, + dedicatedFrameSet, dedicatedFrame.origin.x, dedicatedFrame.origin.y, dedicatedFrame.size.width, dedicatedFrame.size.height, + [self contentsScale]); +NS_HANDLER +NS_ENDHANDLER #endif } else { changed = NO; @@ -638,7 +655,15 @@ static const GLfloat gl_verts[] = { GLenum textureTarget; - Bool texSizeChanged = [self validateTexSize: ( dedicatedFrameSet ? dedicatedFrame : [self bounds] ) ]; + CGRect texDim = dedicatedFrameSet ? dedicatedFrame : [self bounds]; + CGFloat _contentsScale = 1; +NS_DURING + // Available >= 10.7 + _contentsScale = [self contentsScale]; +NS_HANDLER +NS_ENDHANDLER + Bool texSizeChanged = [self validateTexSize: (int)(texDim.size.width * _contentsScale + 0.5f) + height:(int)(texDim.size.height * _contentsScale + 0.5f)]; if( texSizeChanged ) { [context update]; } @@ -873,9 +898,10 @@ static const GLfloat gl_verts[] = { @end -NSOpenGLLayer* createNSOpenGLLayer(NSOpenGLContext* ctx, int gl3ShaderProgramName, NSOpenGLPixelFormat* fmt, NSOpenGLPixelBuffer* p, uint32_t texID, Bool opaque, int texWidth, int texHeight) { +NSOpenGLLayer* createNSOpenGLLayer(NSOpenGLContext* ctx, int gl3ShaderProgramName, NSOpenGLPixelFormat* fmt, NSOpenGLPixelBuffer* p, uint32_t texID, Bool opaque, int texWidth, int texHeight, int winWidth, int winHeight) { return [[[MyNSOpenGLLayer alloc] init] setupWithContext:ctx gl3ShaderProgramName: (GLuint)gl3ShaderProgramName pixelFormat: fmt pbuffer: p texIDArg: (GLuint)texID - opaque: opaque texWidth: texWidth texHeight: texHeight]; + opaque: opaque texWidth: texWidth texHeight: texHeight + winWidth: winWidth winHeight: winHeight]; } void setNSOpenGLLayerEnabled(NSOpenGLLayer* layer, Bool enable) { diff --git a/src/jogl/native/macosx/MacOSXWindowSystemInterface.h b/src/jogl/native/macosx/MacOSXWindowSystemInterface.h index 138accb22..b2d7f9db8 100644 --- a/src/jogl/native/macosx/MacOSXWindowSystemInterface.h +++ b/src/jogl/native/macosx/MacOSXWindowSystemInterface.h @@ -3,7 +3,7 @@ #import <OpenGL/CGLTypes.h> #import <jni.h> -// #define VERBOSE_ON 1 +#define VERBOSE_ON 1 #ifdef VERBOSE_ON #define DBG_PRINT(...) NSLog(@ __VA_ARGS__) diff --git a/src/nativewindow/classes/com/jogamp/nativewindow/DelegatedUpstreamSurfaceHookMutableSize.java b/src/nativewindow/classes/com/jogamp/nativewindow/DelegatedUpstreamSurfaceHookMutableSize.java index c98bf5436..7ae614158 100644 --- a/src/nativewindow/classes/com/jogamp/nativewindow/DelegatedUpstreamSurfaceHookMutableSize.java +++ b/src/nativewindow/classes/com/jogamp/nativewindow/DelegatedUpstreamSurfaceHookMutableSize.java @@ -32,7 +32,7 @@ public class DelegatedUpstreamSurfaceHookMutableSize extends UpstreamSurfaceHook @Override public String toString() { - return getClass().getSimpleName()+"[ "+ width + "x" + height + ", " + upstream + "]"; + return getClass().getSimpleName()+"[ "+ pixWidth + "x" + pixHeight + ", " + upstream + "]"; } } diff --git a/src/nativewindow/classes/com/jogamp/nativewindow/DelegatedUpstreamSurfaceHookWithSurfaceSize.java b/src/nativewindow/classes/com/jogamp/nativewindow/DelegatedUpstreamSurfaceHookWithSurfaceSize.java index 1557f4e51..db4a979d1 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 #getWidth(ProxySurface)} and {@link #getHeight(ProxySurface)} + * @param surface mandatory {@link NativeSurface} used for {@link #getPixelWidth(ProxySurface)} and {@link #getPixelHeight(ProxySurface)} */ public DelegatedUpstreamSurfaceHookWithSurfaceSize(UpstreamSurfaceHook upstream, NativeSurface surface) { this.upstream = upstream; @@ -35,18 +35,18 @@ public class DelegatedUpstreamSurfaceHookWithSurfaceSize implements UpstreamSurf } @Override - public final int getWidth(ProxySurface s) { - return surface.getWidth(); + public final int getPixelWidth(ProxySurface s) { + return surface.getSurfaceWidth(); } @Override - public final int getHeight(ProxySurface s) { - return surface.getHeight(); + public final int getPixelHeight(ProxySurface s) { + return surface.getSurfaceHeight(); } @Override public String toString() { - final String us_s = null != surface ? ( surface.getClass().getName() + ": 0x" + Long.toHexString(surface.getSurfaceHandle()) + " " +surface.getWidth() + "x" + surface.getHeight() ) : "nil"; + final String us_s = null != surface ? ( surface.getClass().getName() + ": 0x" + Long.toHexString(surface.getSurfaceHandle()) + " " +surface.getSurfaceWidth() + "x" + surface.getSurfaceHeight() ) : "nil"; return getClass().getSimpleName()+"["+upstream+", "+us_s+"]"; } diff --git a/src/nativewindow/classes/com/jogamp/nativewindow/UpstreamSurfaceHookMutableSize.java b/src/nativewindow/classes/com/jogamp/nativewindow/UpstreamSurfaceHookMutableSize.java index 5838c7a56..5910f5fea 100644 --- a/src/nativewindow/classes/com/jogamp/nativewindow/UpstreamSurfaceHookMutableSize.java +++ b/src/nativewindow/classes/com/jogamp/nativewindow/UpstreamSurfaceHookMutableSize.java @@ -4,31 +4,31 @@ import javax.media.nativewindow.ProxySurface; import javax.media.nativewindow.UpstreamSurfaceHook; public class UpstreamSurfaceHookMutableSize implements UpstreamSurfaceHook.MutableSize { - int width, height; + int pixWidth, pixHeight; /** * @param width initial width * @param height initial height */ public UpstreamSurfaceHookMutableSize(int width, int height) { - this.width = width; - this.height = height; + this.pixWidth = width; + this.pixHeight = height; } @Override - public final void setSize(int width, int height) { - this.width = width; - this.height = height; + public final void setPixelSize(int width, int height) { + this.pixWidth = width; + this.pixHeight = height; } @Override - public final int getWidth(ProxySurface s) { - return width; + public final int getPixelWidth(ProxySurface s) { + return pixWidth; } @Override - public final int getHeight(ProxySurface s) { - return height; + public final int getPixelHeight(ProxySurface s) { + return pixHeight; } @Override public void create(ProxySurface s) { /* nop */ } @@ -38,7 +38,7 @@ public class UpstreamSurfaceHookMutableSize implements UpstreamSurfaceHook.Mutab @Override public String toString() { - return getClass().getSimpleName()+"[ "+ width + "x" + height + "]"; + return getClass().getSimpleName()+"[pixel "+ pixWidth + "x" + pixHeight + "]"; } } diff --git a/src/nativewindow/classes/com/jogamp/nativewindow/UpstreamSurfaceHookMutableSizePos.java b/src/nativewindow/classes/com/jogamp/nativewindow/UpstreamSurfaceHookMutableSizePos.java deleted file mode 100644 index e6fcc049c..000000000 --- a/src/nativewindow/classes/com/jogamp/nativewindow/UpstreamSurfaceHookMutableSizePos.java +++ /dev/null @@ -1,36 +0,0 @@ -package com.jogamp.nativewindow; - -public class UpstreamSurfaceHookMutableSizePos extends UpstreamSurfaceHookMutableSize { - int x, y; - - /** - * @param width initial width - * @param height initial height - */ - public UpstreamSurfaceHookMutableSizePos(int x, int y, int width, int height) { - super(width, height); - this.x= x; - this.y= y; - } - - // @Override - public final void setPos(int x, int y) { - this.x= x; - this.y= y; - } - - public final int getX() { - return x; - } - - public final int getY() { - return y; - } - - @Override - public String toString() { - return getClass().getSimpleName()+"[ "+ x + "/" + y + " " + width + "x" + height + "]"; - } - -} - diff --git a/src/nativewindow/classes/com/jogamp/nativewindow/UpstreamWindowHookMutableSizePos.java b/src/nativewindow/classes/com/jogamp/nativewindow/UpstreamWindowHookMutableSizePos.java new file mode 100644 index 000000000..f761b522a --- /dev/null +++ b/src/nativewindow/classes/com/jogamp/nativewindow/UpstreamWindowHookMutableSizePos.java @@ -0,0 +1,53 @@ +package com.jogamp.nativewindow; + +public class UpstreamWindowHookMutableSizePos extends UpstreamSurfaceHookMutableSize { + int winX, winY, winWidth, winHeight; + + /** + * @param winX initial window x-pos + * @param winY initial window y-pos + * @param winWidth initial window width + * @param winHeight initial window height + * @param pixWidth initial surface pixel width, FIXME: pixel-dim == window-dim 'for now' ? + * @param pixHeight initial surface pixel height, FIXME: pixel-dim == window-dim 'for now' ? + */ + public UpstreamWindowHookMutableSizePos(int winX, int winY, int winWidth, int winHeight, int pixWidth, int pixHeight) { + super(pixWidth, pixHeight); + this.winX= winX; + this.winY= winY; + this.winWidth = winWidth; + this.winHeight = winHeight; + } + + // @Override + public final void setWinPos(int winX, int winY) { + this.winX= winX; + this.winY= winY; + } + // @Override + public final void setWinSize(int winWidth, int winHeight) { + this.winWidth= winWidth; + this.winHeight= winHeight; + } + + public final int getX() { + return winX; + } + + public final int getY() { + return winY; + } + public final int getWindowWidth() { + return winWidth; + } + public final int getWindowHeight() { + return winHeight; + } + + @Override + public String toString() { + return getClass().getSimpleName()+"[window "+ winX + "/" + winY + " " + winWidth + "x" + winHeight + ", pixel " + pixWidth + "x" + pixHeight + "]"; + } + +} + diff --git a/src/nativewindow/classes/com/jogamp/nativewindow/awt/JAWTWindow.java b/src/nativewindow/classes/com/jogamp/nativewindow/awt/JAWTWindow.java index 8d7c382ee..e35716c49 100644 --- a/src/nativewindow/classes/com/jogamp/nativewindow/awt/JAWTWindow.java +++ b/src/nativewindow/classes/com/jogamp/nativewindow/awt/JAWTWindow.java @@ -46,7 +46,6 @@ import com.jogamp.nativewindow.MutableGraphicsConfiguration; import java.awt.Component; import java.awt.Container; import java.awt.Cursor; -import java.awt.GraphicsDevice; import java.awt.Window; import java.awt.event.ComponentEvent; import java.awt.event.ComponentListener; @@ -99,7 +98,7 @@ public abstract class JAWTWindow implements NativeWindow, OffscreenLayerSurface, protected Rectangle bounds; protected Insets insets; private volatile long offscreenSurfaceLayer; - + private volatile int pixelScale; private long drawable_old; /** @@ -123,6 +122,7 @@ public abstract class JAWTWindow implements NativeWindow, OffscreenLayerSurface, invalidate(); this.isApplet = false; this.offscreenSurfaceLayer = 0; + this.pixelScale = 1; } private static String id(Object obj) { return ( null!=obj ? toHexString(obj.hashCode()) : "nil" ); } private String jawtStr() { return "JAWTWindow["+id(JAWTWindow.this)+"]"; } @@ -260,17 +260,26 @@ public abstract class JAWTWindow implements NativeWindow, OffscreenLayerSurface, drawable_old = 0; bounds = new Rectangle(); insets = new Insets(); + pixelScale = 1; } protected abstract void invalidateNative(); - protected final boolean updateBounds(JAWT_Rectangle jawtBounds) { + /** + * Updates bounds and pixelScale + */ + protected final boolean updateLockedData(JAWT_Rectangle jawtBounds) { final Rectangle jb = new Rectangle(jawtBounds.getX(), jawtBounds.getY(), jawtBounds.getWidth(), jawtBounds.getHeight()); - final boolean changed = !bounds.equals(jb); + final int newPixelScale; + { + final int s = JAWTUtil.getPixelScale(component); + newPixelScale = 0 < s ? s : 1; + } + final boolean changedBounds = !bounds.equals(jb); + final boolean changedPixelScale = newPixelScale != pixelScale; - if(changed) { - if(DEBUG) { + if( changedBounds ) { + if( DEBUG ) { System.err.println("JAWTWindow.updateBounds: "+bounds+" -> "+jb); - // Thread.dumpStack(); } bounds.set(jawtBounds.getX(), jawtBounds.getY(), jawtBounds.getWidth(), jawtBounds.getHeight()); @@ -279,12 +288,21 @@ public abstract class JAWTWindow implements NativeWindow, OffscreenLayerSurface, insets.set(contInsets.left, contInsets.right, contInsets.top, contInsets.bottom); } } - return changed; + if( changedPixelScale ) { + if( DEBUG ) { + System.err.println("JAWTWindow.updatePixelScale: "+pixelScale+" -> "+newPixelScale); + } + pixelScale = newPixelScale; + } + return changedBounds || changedPixelScale; } /** @return the JAWT_DrawingSurfaceInfo's (JAWT_Rectangle) bounds, updated with lock */ public final RectangleImmutable getBounds() { return bounds; } + /** @return the safe pixelScale value, i.e. never negative or zero. Updated with lock. */ + public final int getPixelScale() { return pixelScale; } + @Override public final InsetsImmutable getInsets() { return insets; } @@ -606,13 +624,13 @@ public abstract class JAWTWindow implements NativeWindow, OffscreenLayerSurface, } @Override - public final int getWidth() { - return component.getWidth(); + public final int getSurfaceWidth() { + return getWindowWidth() * getPixelScale(); } @Override - public final int getHeight() { - return component.getHeight(); + public final int getSurfaceHeight() { + return getWindowHeight() * getPixelScale(); } // @@ -620,6 +638,32 @@ public abstract class JAWTWindow implements NativeWindow, OffscreenLayerSurface, // @Override + public final int getWindowWidth() { + return component.getWidth(); + } + + @Override + public final int getWindowHeight() { + return component.getHeight(); + } + + @Override + public final int[] getWindowUnitXY(int[] result, final int[] pixelUnitXY) { + final int scale = getPixelScale(); + result[0] = pixelUnitXY[0] / scale; + result[1] = pixelUnitXY[1] / scale; + return result; + } + + @Override + public final int[] getPixelUnitXY(int[] result, final int[] windowUnitXY) { + final int scale = getPixelScale(); + result[0] = windowUnitXY[0] * scale; + result[1] = windowUnitXY[1] * scale; + return result; + } + + @Override public void destroy() { surfaceLock.lock(); try { @@ -751,25 +795,6 @@ public abstract class JAWTWindow implements NativeWindow, OffscreenLayerSurface, return component.hasFocus(); } - /** - * Returns the pixel scale factor of this {@link Component}'s {@link GraphicsDevice}, if supported. - * <p> - * If the component is not yet {@link Component#isDisplayable() displayable}, - * <code>zero</code> is returned. - * </p> - * <p> - * If the component does not support pixel scaling the default - * <code>one</code> is returned. - * </p> - * <p> - * Note: Currently only supported on OSX since 1.7.0_40 for HiDPI retina displays - * </p> - * @return the pixel scale factor - */ - protected final int getPixelScale() { - return JAWTUtil.getPixelScale(component); - } - protected StringBuilder jawt2String(StringBuilder sb) { if( null == sb ) { sb = new StringBuilder(); @@ -801,7 +826,8 @@ public abstract class JAWTWindow implements NativeWindow, OffscreenLayerSurface, ", surfaceHandle "+toHexString(getSurfaceHandle())+ ", bounds "+bounds+", insets "+insets ); - sb.append(", pos "+getX()+"/"+getY()+", size "+getWidth()+"x"+getHeight()+ + sb.append(", window ["+getX()+"/"+getY()+" "+getWindowWidth()+"x"+getWindowHeight()+ + "], pixels[x"+getPixelScale()+" -> "+getSurfaceWidth()+"x"+getSurfaceHeight()+"]"+ ", visible "+component.isVisible()); sb.append(", lockedExt "+isSurfaceLockedByOtherThread()+ ",\n\tconfig "+config+ diff --git a/src/nativewindow/classes/javax/media/nativewindow/NativeSurface.java b/src/nativewindow/classes/javax/media/nativewindow/NativeSurface.java index a755b1812..d5cc048a1 100644 --- a/src/nativewindow/classes/javax/media/nativewindow/NativeSurface.java +++ b/src/nativewindow/classes/javax/media/nativewindow/NativeSurface.java @@ -28,14 +28,20 @@ package javax.media.nativewindow; -/** Provides low-level information required for - hardware-accelerated rendering using a surface in a platform-independent manner.<P> - - A NativeSurface created for a particular on- or offscreen component is - expected to have the same lifetime as that component. As long as - the component is alive and realized/visible, NativeSurface must be able - provide information such as the surface handle while it is locked.<P> -*/ +/** + * Provides low-level information required for + * hardware-accelerated rendering using a surface in a platform-independent manner. + * <p> + * All values of this interface are represented in pixel units, + * see {@link NativeWindow}. + * </p> + * <p> + * A NativeSurface created for a particular on- or offscreen component is + * expected to have the same lifetime as that component. As long as + * the component is alive and realized/visible, NativeSurface must be able + * provide information such as the surface handle while it is locked. + * </p> + */ public interface NativeSurface extends SurfaceUpdatedListener { /** Unlocked state */ public static final int LOCK_SURFACE_UNLOCKED = 0; @@ -172,16 +178,36 @@ public interface NativeSurface extends SurfaceUpdatedListener { public long getSurfaceHandle(); /** - * Returns the width of the client area excluding insets (window decorations). - * @return width of the client area + * 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[]) + */ + public int getSurfaceWidth(); + + /** + * 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[]) + */ + 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 */ - public int getWidth(); + public int[] getWindowUnitXY(int[] result, final int[] pixelUnitXY); /** - * Returns the height of the client area excluding insets (window decorations). - * @return height of the client area + * 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 */ - public int getHeight(); + public int[] getPixelUnitXY(int[] result, final int[] windowUnitXY); /** * Returns the graphics configuration corresponding to this window. diff --git a/src/nativewindow/classes/javax/media/nativewindow/NativeWindow.java b/src/nativewindow/classes/javax/media/nativewindow/NativeWindow.java index a740ebbe0..242f25d43 100644 --- a/src/nativewindow/classes/javax/media/nativewindow/NativeWindow.java +++ b/src/nativewindow/classes/javax/media/nativewindow/NativeWindow.java @@ -43,14 +43,21 @@ package javax.media.nativewindow; import javax.media.nativewindow.util.InsetsImmutable; import javax.media.nativewindow.util.Point; -/** Extend the {@link NativeSurface} interface with windowing - information such as window handle and position.<P> - - A window toolkit such as the AWT may either implement this interface - directly with one of its components, or provide and register an - implementation of {@link NativeWindowFactory NativeWindowFactory} - which can create NativeWindow objects for its components. <P> -*/ +/** + * Extend the {@link NativeSurface} interface with windowing + * information such as {@link #getWindowHandle() window-handle}, + * {@link #getWindowWidth() window-size} and {@link #getX() window-position}. + * <p> + * All values of this interface are represented in window units. + * see {@link NativeSurface}. + * </p> + * <p> + * A window toolkit such as the AWT may either implement this interface + * directly with one of its components, or provide and register an + * implementation of {@link NativeWindowFactory NativeWindowFactory} + * which can create NativeWindow objects for its components. + * </p> + */ public interface NativeWindow extends NativeSurface { /** @@ -76,8 +83,10 @@ public interface NativeWindow extends NativeSurface { /** * Returns the insets defined as the width and height of the window decoration - * on the left, right, top and bottom.<br> + * on the left, right, top and bottom in window units. + * <p> * Insets are zero if the window is undecorated, including child windows. + * </p> * * <p> * Insets are available only after the native window has been created, @@ -85,14 +94,14 @@ public interface NativeWindow extends NativeSurface { * * The top-level window area's top-left corner is located at * <pre> - * getX() - getInsets().{@link InsetsImmutable#getLeftWidth() getLeftWidth()} - * getY() - getInsets().{@link InsetsImmutable#getTopHeight() getTopHeight()} + * {@link #getX()} - getInsets().{@link InsetsImmutable#getLeftWidth() getLeftWidth()} + * {@link #getY()} - getInsets().{@link InsetsImmutable#getTopHeight() getTopHeight()} * </pre> * * The top-level window size is * <pre> - * getWidth() + getInsets().{@link InsetsImmutable#getTotalWidth() getTotalWidth()} - * getHeight() + getInsets().{@link InsetsImmutable#getTotalHeight() getTotalHeight()} + * {@link #getWindowWidth()} + getInsets().{@link InsetsImmutable#getTotalWidth() getTotalWidth()} + * {@link #getWindowHeight()} + getInsets().{@link InsetsImmutable#getTotalHeight() getTotalHeight()} * </pre> * * @return insets @@ -103,7 +112,7 @@ public interface NativeWindow extends NativeSurface { /** * @return the current x position of the top-left corner - * of the client area relative to it's parent. + * of the client area relative to it's parent in window units. * Since the position reflects the client area, it does not include the insets. * @see #getInsets() */ @@ -111,15 +120,29 @@ public interface NativeWindow extends NativeSurface { /** * @return the current y position of the top-left corner - * of the client area relative to it's parent. + * of the client area relative to it's parent in window units. * Since the position reflects the client area, it does not include the insets. * @see #getInsets() */ public int getY(); /** + * Returns the width of the client area excluding insets (window decorations) in window units. + * @return width of the client area in window units + * @see NativeSurface#getSurfaceWidth() + */ + public int getWindowWidth(); + + /** + * Returns the height of the client area excluding insets (window decorations) in window units. + * @return height of the client area in window units + * @see NativeSurface#getSurfaceHeight() + */ + public int getWindowHeight(); + + /** * Returns the current position of the top-left corner - * of the client area in screen coordinates. + * of the client area in window units. * <p> * Since the position reflects the client area, it does not include the insets. * </p> diff --git a/src/nativewindow/classes/javax/media/nativewindow/NativeWindowFactory.java b/src/nativewindow/classes/javax/media/nativewindow/NativeWindowFactory.java index 034bf2456..1546bd909 100644 --- a/src/nativewindow/classes/javax/media/nativewindow/NativeWindowFactory.java +++ b/src/nativewindow/classes/javax/media/nativewindow/NativeWindowFactory.java @@ -56,7 +56,7 @@ import jogamp.nativewindow.x11.X11Lib; import com.jogamp.common.os.Platform; import com.jogamp.common.util.ReflectionUtil; -import com.jogamp.nativewindow.UpstreamSurfaceHookMutableSizePos; +import com.jogamp.nativewindow.UpstreamWindowHookMutableSizePos; import com.jogamp.nativewindow.awt.AWTGraphicsDevice; import com.jogamp.nativewindow.awt.AWTGraphicsScreen; import com.jogamp.nativewindow.macosx.MacOSXGraphicsDevice; @@ -669,7 +669,7 @@ public abstract class NativeWindowFactory { /** * Creates a wrapped {@link NativeWindow} with given native handles and {@link AbstractGraphicsScreen}. * <p> - * The given {@link UpstreamSurfaceHookMutableSizePos} maybe used to reflect resizes and repositioning of the native window. + * The given {@link UpstreamWindowHookMutableSizePos} maybe used to reflect resizes and repositioning of the native window. * </p> * <p> * The {@link AbstractGraphicsScreen} may be created via {@link #createScreen(AbstractGraphicsDevice, int)}. @@ -680,7 +680,7 @@ public abstract class NativeWindowFactory { * </p> */ public static NativeWindow createWrappedWindow(AbstractGraphicsScreen aScreen, long surfaceHandle, long windowHandle, - UpstreamSurfaceHookMutableSizePos hook) { + UpstreamWindowHookMutableSizePos hook) { final CapabilitiesImmutable caps = new Capabilities(); final AbstractGraphicsConfiguration config = new DefaultGraphicsConfiguration(aScreen, caps, caps); return new WrappedWindow(config, surfaceHandle, hook, true, windowHandle); diff --git a/src/nativewindow/classes/javax/media/nativewindow/UpstreamSurfaceHook.java b/src/nativewindow/classes/javax/media/nativewindow/UpstreamSurfaceHook.java index f08a6c938..39e316856 100644 --- a/src/nativewindow/classes/javax/media/nativewindow/UpstreamSurfaceHook.java +++ b/src/nativewindow/classes/javax/media/nativewindow/UpstreamSurfaceHook.java @@ -38,15 +38,15 @@ public interface UpstreamSurfaceHook { /** called within {@link ProxySurface#destroyNotify()} within lock, before clearing fields. */ public void destroy(ProxySurface s); - /** Returns the width of the upstream surface, used if {@link ProxySurface#UPSTREAM_PROVIDES_SIZE} is set. */ - public int getWidth(ProxySurface s); - /** Returns the height of the upstream surface, used if {@link ProxySurface#UPSTREAM_PROVIDES_SIZE} is set. */ - public int getHeight(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); + /** Returns the height of the upstream surface in pixels, used if {@link ProxySurface#UPSTREAM_PROVIDES_SIZE} is set. */ + public int getPixelHeight(ProxySurface s); /** * {@link UpstreamSurfaceHook} w/ mutable size, allowing it's {@link ProxySurface} user to resize. */ public interface MutableSize extends UpstreamSurfaceHook { - public void setSize(int width, int height); + public void setPixelSize(int width, int height); } } diff --git a/src/nativewindow/classes/javax/media/nativewindow/util/Insets.java b/src/nativewindow/classes/javax/media/nativewindow/util/Insets.java index 3644916fe..dfe78b06f 100644 --- a/src/nativewindow/classes/javax/media/nativewindow/util/Insets.java +++ b/src/nativewindow/classes/javax/media/nativewindow/util/Insets.java @@ -28,11 +28,15 @@ package javax.media.nativewindow.util; +/** + * Mutable insets representing rectangular window decoration insets on all four edges + * in window units. + */ public class Insets implements Cloneable, InsetsImmutable { static final InsetsImmutable zeroInsets = new Insets(); public static final InsetsImmutable getZero() { return zeroInsets; } - int l, r, t, b; + private int l, r, t, b; public Insets() { this(0, 0, 0, 0); @@ -72,12 +76,35 @@ public class Insets implements Cloneable, InsetsImmutable { @Override public final int getTotalHeight() { return t + b; } + /** + * Set the inset values of this instance in window units. + * @param left left inset width in window units. + * @param right right inset width in window units. + * @param top top inset width in window units. + * @param bottom bottom inset width in window units. + */ public final void set(int left, int right, int top, int bottom) { l = left; r = right; t = top; b = bottom; } + /** + * Set the left inset value of this instance in window units. + * @param left left inset width in window units. + */ public final void setLeftWidth(int left) { l = left; } + /** + * Set the right inset value of this instance in window units. + * @param right right inset width in window units. + */ public final void setRightWidth(int right) { r = right; } + /** + * Set the top inset value of this instance in window units. + * @param top top inset width in window units. + */ public final void setTopHeight(int top) { t = top; } + /** + * Set the bottom inset value of this instance in window units. + * @param bottom bottom inset width in window units. + */ public final void setBottomHeight(int bottom) { b = bottom; } @Override diff --git a/src/nativewindow/classes/javax/media/nativewindow/util/InsetsImmutable.java b/src/nativewindow/classes/javax/media/nativewindow/util/InsetsImmutable.java index 8256068cd..0f8ba0158 100644 --- a/src/nativewindow/classes/javax/media/nativewindow/util/InsetsImmutable.java +++ b/src/nativewindow/classes/javax/media/nativewindow/util/InsetsImmutable.java @@ -30,25 +30,28 @@ package javax.media.nativewindow.util; import com.jogamp.common.type.WriteCloneable; -/** Immutable Rectangle interface */ +/** + * Immutable insets representing rectangular window decoration insets on all four edges + * in window units. + */ public interface InsetsImmutable extends WriteCloneable { - /** @return left inset width */ + /** @return left inset width in window units. */ int getLeftWidth(); - /** @return right inset width */ + /** @return right inset width in window units. */ int getRightWidth(); - /** @return total width, ie. <code>left_width + right_width</code> */ + /** @return total width in window units, ie. <code>left_width + right_width</code> */ int getTotalWidth(); - /** @return top inset height */ + /** @return top inset height in window units. */ int getTopHeight(); - /** @return bottom inset height */ + /** @return bottom inset height in window units. */ int getBottomHeight(); - /** @return total height, ie. <code>top_height + bottom_height</code> */ + /** @return total height in window units, ie. <code>top_height + bottom_height</code> */ int getTotalHeight(); /** diff --git a/src/nativewindow/classes/jogamp/nativewindow/ProxySurfaceImpl.java b/src/nativewindow/classes/jogamp/nativewindow/ProxySurfaceImpl.java index fbff7128e..dd1b6f185 100644 --- a/src/nativewindow/classes/jogamp/nativewindow/ProxySurfaceImpl.java +++ b/src/nativewindow/classes/jogamp/nativewindow/ProxySurfaceImpl.java @@ -149,13 +149,13 @@ public abstract class ProxySurfaceImpl implements ProxySurface { public abstract void setSurfaceHandle(long surfaceHandle); @Override - public final int getWidth() { - return upstream.getWidth(this); + public final int getSurfaceWidth() { + return upstream.getPixelWidth(this); } @Override - public final int getHeight() { - return upstream.getHeight(this); + public final int getSurfaceHeight() { + return upstream.getPixelHeight(this); } @Override @@ -303,7 +303,7 @@ public abstract class ProxySurfaceImpl implements ProxySurface { } sink.append("displayHandle 0x" + Long.toHexString(getDisplayHandle())). append("\n, surfaceHandle 0x" + Long.toHexString(getSurfaceHandle())). - append("\n, size " + getWidth() + "x" + getHeight()).append("\n, "); + append("\n, size " + getSurfaceWidth() + "x" + getSurfaceHeight()).append("\n, "); getUpstreamOptionBits(sink); sink.append("\n, "+config). append("\n, surfaceLock "+surfaceLock+"\n, "). diff --git a/src/nativewindow/classes/jogamp/nativewindow/WrappedSurface.java b/src/nativewindow/classes/jogamp/nativewindow/WrappedSurface.java index f622db8cc..5601dac02 100644 --- a/src/nativewindow/classes/jogamp/nativewindow/WrappedSurface.java +++ b/src/nativewindow/classes/jogamp/nativewindow/WrappedSurface.java @@ -97,4 +97,21 @@ public class WrappedSurface extends ProxySurfaceImpl { protected final void unlockSurfaceImpl() { } + @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; + } + + @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; + } + + } diff --git a/src/nativewindow/classes/jogamp/nativewindow/WrappedWindow.java b/src/nativewindow/classes/jogamp/nativewindow/WrappedWindow.java index edb65eb06..3cbfcd4d9 100644 --- a/src/nativewindow/classes/jogamp/nativewindow/WrappedWindow.java +++ b/src/nativewindow/classes/jogamp/nativewindow/WrappedWindow.java @@ -9,28 +9,36 @@ import javax.media.nativewindow.util.Insets; import javax.media.nativewindow.util.InsetsImmutable; import javax.media.nativewindow.util.Point; -import com.jogamp.nativewindow.UpstreamSurfaceHookMutableSizePos; +import com.jogamp.nativewindow.UpstreamWindowHookMutableSizePos; public class WrappedWindow extends WrappedSurface implements NativeWindow { private final InsetsImmutable insets = new Insets(0, 0, 0, 0); private long windowHandle; /** - * Utilizes a {@link UpstreamSurfaceHookMutableSizePos} to hold the size and postion information, + * Utilizes a {@link UpstreamWindowHookMutableSizePos} to hold the size and postion information, * which is being passed to the {@link ProxySurface} instance. * * @param cfg the {@link AbstractGraphicsConfiguration} to be used * @param surfaceHandle the wrapped pre-existing native surface handle, maybe 0 if not yet determined - * @param initialX - * @param initialY - * @param initialWidth - * @param initialHeight + * @param initialWinX + * @param initialWinY + * @param initialWinWidth + * @param initialWinHeight + * @param initialPixelWidth FIXME: pixel-dim == window-dim 'for now' ? + * @param initialPixelHeight FIXME: pixel-dim == window-dim 'for now' ? * @param ownsDevice <code>true</code> if this {@link ProxySurface} instance * owns the {@link AbstractGraphicsConfiguration}'s {@link AbstractGraphicsDevice}, * otherwise <code>false</code>. Owning the device implies closing it at {@link #destroyNotify()}. */ - public WrappedWindow(AbstractGraphicsConfiguration cfg, long surfaceHandle, int initialX, int initialY, int initialWidth, int initialHeight, boolean ownsDevice, long windowHandle) { - this(cfg, surfaceHandle, new UpstreamSurfaceHookMutableSizePos(initialX, initialY, initialWidth, initialHeight), ownsDevice, windowHandle); + public WrappedWindow(AbstractGraphicsConfiguration cfg, long surfaceHandle, + int initialWinX, int initialWinY, int initialWinWidth, int initialWinHeight, + int initialPixelWidth, int initialPixelHeight, + boolean ownsDevice, long windowHandle) { + this(cfg, surfaceHandle, + new UpstreamWindowHookMutableSizePos(initialWinX, initialWinY, initialWinWidth, initialWinHeight, + initialPixelWidth, initialPixelHeight), + ownsDevice, windowHandle); } /** @@ -41,7 +49,7 @@ public class WrappedWindow extends WrappedSurface implements NativeWindow { * owns the {@link AbstractGraphicsConfiguration}'s {@link AbstractGraphicsDevice}, * otherwise <code>false</code>. */ - public WrappedWindow(AbstractGraphicsConfiguration cfg, long surfaceHandle, UpstreamSurfaceHookMutableSizePos upstream, boolean ownsDevice, long windowHandle) { + public WrappedWindow(AbstractGraphicsConfiguration cfg, long surfaceHandle, UpstreamWindowHookMutableSizePos upstream, boolean ownsDevice, long windowHandle) { super(cfg, surfaceHandle, upstream, ownsDevice); this.windowHandle = windowHandle; } @@ -74,12 +82,22 @@ public class WrappedWindow extends WrappedSurface implements NativeWindow { @Override public int getX() { - return ((UpstreamSurfaceHookMutableSizePos)getUpstreamSurfaceHook()).getX(); + return ((UpstreamWindowHookMutableSizePos)getUpstreamSurfaceHook()).getX(); } @Override public int getY() { - return ((UpstreamSurfaceHookMutableSizePos)getUpstreamSurfaceHook()).getY(); + return ((UpstreamWindowHookMutableSizePos)getUpstreamSurfaceHook()).getY(); + } + + @Override + public int getWindowWidth() { + return ((UpstreamWindowHookMutableSizePos)getUpstreamSurfaceHook()).getWindowWidth(); + } + + @Override + public int getWindowHeight() { + return ((UpstreamWindowHookMutableSizePos)getUpstreamSurfaceHook()).getWindowHeight(); } @Override diff --git a/src/nativewindow/classes/jogamp/nativewindow/jawt/JAWTUtil.java b/src/nativewindow/classes/jogamp/nativewindow/jawt/JAWTUtil.java index fb979d440..387f40f89 100644 --- a/src/nativewindow/classes/jogamp/nativewindow/jawt/JAWTUtil.java +++ b/src/nativewindow/classes/jogamp/nativewindow/jawt/JAWTUtil.java @@ -64,6 +64,8 @@ import com.jogamp.common.util.locks.RecursiveLock; public class JAWTUtil { public static final boolean DEBUG = Debug.debug("JAWT"); + private static final boolean SKIP_AWT_HIDPI; + /** OSX JAWT version option to use CALayer */ public static final int JAWT_MACOSX_USE_CALAYER = 0x80000000; @@ -298,8 +300,10 @@ public class JAWTUtil { } static { + SKIP_AWT_HIDPI = Debug.isPropertyDefined("nativewindow.awt.nohidpi", true); + if(DEBUG) { - System.err.println("JAWTUtil initialization (JAWT/JNI/..."); + System.err.println("JAWTUtil initialization (JAWT/JNI/...); SKIP_AWT_HIDPI "+SKIP_AWT_HIDPI); // Thread.dumpStack(); } @@ -542,13 +546,15 @@ public class JAWTUtil { * @return the pixel scale factor */ public static final int getPixelScale(final GraphicsDevice device) { - if( null != getScaleFactorMethod ) { - try { - final Object res = getScaleFactorMethod.invoke(device); - if (res instanceof Integer) { - return ((Integer)res).intValue(); - } - } catch (Throwable t) {} + if( !SKIP_AWT_HIDPI ) { + if( null != getScaleFactorMethod ) { + try { + final Object res = getScaleFactorMethod.invoke(device); + if (res instanceof Integer) { + return ((Integer)res).intValue(); + } + } catch (Throwable t) {} + } } return 1; } diff --git a/src/nativewindow/classes/jogamp/nativewindow/jawt/macosx/MacOSXJAWTWindow.java b/src/nativewindow/classes/jogamp/nativewindow/jawt/macosx/MacOSXJAWTWindow.java index 8d46d805a..58dc7e47e 100644 --- a/src/nativewindow/classes/jogamp/nativewindow/jawt/macosx/MacOSXJAWTWindow.java +++ b/src/nativewindow/classes/jogamp/nativewindow/jawt/macosx/MacOSXJAWTWindow.java @@ -143,7 +143,7 @@ public class MacOSXJAWTWindow extends JAWTWindow implements MutableSurface { } else if( DEBUG ) { System.err.println("JAWTWindow.attachSurfaceLayerImpl: "+toHexString(layerHandle) + ", [ins "+outterInsets+"], p0 "+p0+" -> "+p1+", bounds "+bounds); } - OSXUtil.AddCASublayer(rootSurfaceLayer, layerHandle, p1.getX(), p1.getY(), getWidth(), getHeight(), JAWTUtil.getOSXCALayerQuirks()); + OSXUtil.AddCASublayer(rootSurfaceLayer, layerHandle, p1.getX(), p1.getY(), getWindowWidth(), getWindowHeight(), getPixelScale(), JAWTUtil.getOSXCALayerQuirks()); } } ); } @@ -177,7 +177,7 @@ public class MacOSXJAWTWindow extends JAWTWindow implements MutableSurface { System.err.println("JAWTWindow.layoutSurfaceLayerImpl: "+toHexString(layerHandle) + ", quirks "+caLayerQuirks+", visible "+visible+ ", [ins "+outterInsets+"], p0 "+p0+" -> "+p1+", bounds "+bounds); } - OSXUtil.FixCALayerLayout(rootSurfaceLayer, layerHandle, visible, p1.getX(), p1.getY(), getWidth(), getHeight(), caLayerQuirks); + OSXUtil.FixCALayerLayout(rootSurfaceLayer, layerHandle, visible, p1.getX(), p1.getY(), getWindowWidth(), getWindowHeight(), caLayerQuirks); } @Override @@ -256,7 +256,7 @@ public class MacOSXJAWTWindow extends JAWTWindow implements MutableSurface { unlockSurfaceImpl(); return NativeWindow.LOCK_SURFACE_NOT_READY; } - updateBounds(dsi.getBounds()); + updateLockedData(dsi.getBounds()); if (DEBUG && firstLock ) { dumpInfo(); } @@ -309,7 +309,7 @@ public class MacOSXJAWTWindow extends JAWTWindow implements MutableSurface { public void run() { String errMsg = null; if(0 == rootSurfaceLayer && 0 != jawtSurfaceLayersHandle) { - rootSurfaceLayer = OSXUtil.CreateCALayer(bounds.getWidth(), bounds.getHeight()); + rootSurfaceLayer = OSXUtil.CreateCALayer(bounds.getWidth(), bounds.getHeight(), getPixelScale()); if(0 == rootSurfaceLayer) { errMsg = "Could not create root CALayer"; } else { diff --git a/src/nativewindow/classes/jogamp/nativewindow/jawt/windows/WindowsJAWTWindow.java b/src/nativewindow/classes/jogamp/nativewindow/jawt/windows/WindowsJAWTWindow.java index 54bdb34f6..90688258d 100644 --- a/src/nativewindow/classes/jogamp/nativewindow/jawt/windows/WindowsJAWTWindow.java +++ b/src/nativewindow/classes/jogamp/nativewindow/jawt/windows/WindowsJAWTWindow.java @@ -98,7 +98,7 @@ public class WindowsJAWTWindow extends JAWTWindow { unlockSurfaceImpl(); return LOCK_SURFACE_NOT_READY; } - updateBounds(dsi.getBounds()); + updateLockedData(dsi.getBounds()); win32dsi = (JAWT_Win32DrawingSurfaceInfo) dsi.platformInfo(getJAWT()); if (win32dsi == null) { unlockSurfaceImpl(); diff --git a/src/nativewindow/classes/jogamp/nativewindow/jawt/x11/X11JAWTWindow.java b/src/nativewindow/classes/jogamp/nativewindow/jawt/x11/X11JAWTWindow.java index 4599b9021..b5a519fcc 100644 --- a/src/nativewindow/classes/jogamp/nativewindow/jawt/x11/X11JAWTWindow.java +++ b/src/nativewindow/classes/jogamp/nativewindow/jawt/x11/X11JAWTWindow.java @@ -93,7 +93,7 @@ public class X11JAWTWindow extends JAWTWindow { unlockSurfaceImpl(); return LOCK_SURFACE_NOT_READY; } - updateBounds(dsi.getBounds()); + updateLockedData(dsi.getBounds()); x11dsi = (JAWT_X11DrawingSurfaceInfo) dsi.platformInfo(getJAWT()); if (x11dsi == null) { unlockSurfaceImpl(); diff --git a/src/nativewindow/classes/jogamp/nativewindow/macosx/OSXDummyUpstreamSurfaceHook.java b/src/nativewindow/classes/jogamp/nativewindow/macosx/OSXDummyUpstreamSurfaceHook.java index b71af1042..5a51aca3e 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#getWidth()} via {@link UpstreamSurfaceHook#getWidth(ProxySurface)}, + * @param width the initial width as returned by {@link NativeSurface#getSurfaceWidth()} via {@link UpstreamSurfaceHook#getPixelWidth(ProxySurface)}, * not the actual dummy surface width. * The latter is platform specific and small - * @param height the initial height as returned by {@link NativeSurface#getHeight()} via {@link UpstreamSurfaceHook#getHeight(ProxySurface)}, + * @param height the initial height as returned by {@link NativeSurface#getSurfaceHeight()} via {@link UpstreamSurfaceHook#getPixelHeight(ProxySurface)}, * not the actual dummy surface height, * The latter is platform specific and small */ diff --git a/src/nativewindow/classes/jogamp/nativewindow/macosx/OSXUtil.java b/src/nativewindow/classes/jogamp/nativewindow/macosx/OSXUtil.java index bac07b85a..88ba531d1 100644 --- a/src/nativewindow/classes/jogamp/nativewindow/macosx/OSXUtil.java +++ b/src/nativewindow/classes/jogamp/nativewindow/macosx/OSXUtil.java @@ -137,11 +137,15 @@ public class OSXUtil implements ToolkitProperties { /** * Create a CALayer suitable to act as a root CALayer. + * @param width width of the CALayer in window units (points) + * @param height height of the CALayer in window units (points) + * @param contentsScale scale for HiDPI support: pixel-dim = window-dim x scale + * @return the new CALayer object * @see #DestroyCALayer(long) * @see #AddCASublayer(long, long) */ - public static long CreateCALayer(final int width, final int height) { - final long l = CreateCALayer0(width, height); + public static long CreateCALayer(final int width, final int height, final float contentsScale) { + final long l = CreateCALayer0(width, height, contentsScale); if(DEBUG) { System.err.println("OSXUtil.CreateCALayer: 0x"+Long.toHexString(l)+" - "+Thread.currentThread().getName()); } @@ -158,18 +162,27 @@ public class OSXUtil implements ToolkitProperties { * Hence it is important that related resources are not locked <i>if</i> * they will be used for creation. * </p> - * @param caLayerQuirks TODO - * @see #CreateCALayer(int, int) + * @param rootCALayer + * @param subCALayer + * @param x x-coord of the sub-CALayer in window units (points) + * @param y y-coord of the sub-CALayer in window units (points) + * @param width width of the sub-CALayer in window units (points) + * @param height height of the sub-CALayer in window units (points) + * @param contentsScale scale for HiDPI support: pixel-dim = window-dim x scale + * @param caLayerQuirks + * @see #CreateCALayer(int, int, float) * @see #RemoveCASublayer(long, long, boolean) */ - public static void AddCASublayer(final long rootCALayer, final long subCALayer, final int x, final int y, final int width, final int height, final int caLayerQuirks) { + public static void AddCASublayer(final long rootCALayer, final long subCALayer, + final int x, final int y, final int width, final int height, + final float contentsScale, final int caLayerQuirks) { if(0==rootCALayer || 0==subCALayer) { throw new IllegalArgumentException("rootCALayer 0x"+Long.toHexString(rootCALayer)+", subCALayer 0x"+Long.toHexString(subCALayer)); } if(DEBUG) { System.err.println("OSXUtil.AttachCALayer: caLayerQuirks "+caLayerQuirks+", 0x"+Long.toHexString(subCALayer)+" - "+Thread.currentThread().getName()); } - AddCASublayer0(rootCALayer, subCALayer, x, y, width, height, caLayerQuirks); + AddCASublayer0(rootCALayer, subCALayer, x, y, width, height, contentsScale, caLayerQuirks); } /** @@ -186,8 +199,8 @@ public class OSXUtil implements ToolkitProperties { * @param rootCALayer the root surface layer, maybe null. * @param subCALayer the client surface layer, maybe null. * @param visible TODO - * @param width the expected width - * @param height the expected height + * @param width the expected width in window units (points) + * @param height the expected height in window units (points) * @param caLayerQuirks TODO */ public static void FixCALayerLayout(final long rootCALayer, final long subCALayer, final boolean visible, final int x, final int y, final int width, final int height, final int caLayerQuirks) { @@ -212,7 +225,7 @@ public class OSXUtil implements ToolkitProperties { /** * Destroy a CALayer. - * @see #CreateCALayer(int, int) + * @see #CreateCALayer(int, int, float) */ public static void DestroyCALayer(final long caLayer) { if(0==caLayer) { @@ -356,8 +369,8 @@ public class OSXUtil implements ToolkitProperties { private static native void DestroyNSWindow0(long nsWindow); private static native long GetNSView0(long nsWindow); private static native long GetNSWindow0(long nsView); - private static native long CreateCALayer0(int width, int height); - private static native void AddCASublayer0(long rootCALayer, long subCALayer, int x, int y, int width, int height, int caLayerQuirks); + private static native long CreateCALayer0(int width, int height, float contentsScale); + private static native void AddCASublayer0(long rootCALayer, long subCALayer, int x, int y, int width, int height, float contentsScale, int caLayerQuirks); private static native void FixCALayerLayout0(long rootCALayer, long subCALayer, boolean visible, int x, int y, int width, int height, int caLayerQuirks); private static native void RemoveCASublayer0(long rootCALayer, long subCALayer); private static native void DestroyCALayer0(long caLayer); diff --git a/src/nativewindow/classes/jogamp/nativewindow/windows/GDIDummyUpstreamSurfaceHook.java b/src/nativewindow/classes/jogamp/nativewindow/windows/GDIDummyUpstreamSurfaceHook.java index e5de43c0a..9c74950e0 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#getWidth()} via {@link UpstreamSurfaceHook#getWidth(ProxySurface)}, + * @param width the initial width as returned by {@link NativeSurface#getSurfaceWidth()} via {@link UpstreamSurfaceHook#getPixelWidth(ProxySurface)}, * not the actual dummy surface width. * The latter is platform specific and small - * @param height the initial height as returned by {@link NativeSurface#getHeight()} via {@link UpstreamSurfaceHook#getHeight(ProxySurface)}, + * @param height the initial height as returned by {@link NativeSurface#getSurfaceHeight()} via {@link UpstreamSurfaceHook#getPixelHeight(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 3e07b2a9e..c4ec0f653 100644 --- a/src/nativewindow/classes/jogamp/nativewindow/windows/GDISurface.java +++ b/src/nativewindow/classes/jogamp/nativewindow/windows/GDISurface.java @@ -128,4 +128,21 @@ public class GDISurface extends ProxySurfaceImpl { final public long getSurfaceHandle() { return surfaceHandle; } + + @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; + } + + @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; + } + } diff --git a/src/nativewindow/classes/jogamp/nativewindow/x11/X11DummyUpstreamSurfaceHook.java b/src/nativewindow/classes/jogamp/nativewindow/x11/X11DummyUpstreamSurfaceHook.java index 2c8ef642c..31d168fea 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#getWidth()} via {@link UpstreamSurfaceHook#getWidth(ProxySurface)}, + * @param width the initial width as returned by {@link NativeSurface#getSurfaceWidth()} via {@link UpstreamSurfaceHook#getPixelWidth(ProxySurface)}, * not the actual dummy surface width. * The latter is platform specific and small - * @param height the initial height as returned by {@link NativeSurface#getHeight()} via {@link UpstreamSurfaceHook#getHeight(ProxySurface)}, + * @param height the initial height as returned by {@link NativeSurface#getSurfaceHeight()} via {@link UpstreamSurfaceHook#getPixelHeight(ProxySurface)}, * not the actual dummy surface height, * The latter is platform specific and small */ diff --git a/src/nativewindow/native/macosx/OSXmisc.m b/src/nativewindow/native/macosx/OSXmisc.m index d95d1cdbf..15547ffee 100644 --- a/src/nativewindow/native/macosx/OSXmisc.m +++ b/src/nativewindow/native/macosx/OSXmisc.m @@ -41,7 +41,7 @@ #include <jawt_md.h> -// #define VERBOSE 1 +#define VERBOSE 1 // #ifdef VERBOSE // #define DBG_PRINT(...) NSLog(@ ## __VA_ARGS__) @@ -544,19 +544,27 @@ JNIEXPORT jlong JNICALL Java_jogamp_nativewindow_macosx_OSXUtil_GetNSWindow0 /* * Class: Java_jogamp_nativewindow_macosx_OSXUtil * Method: CreateCALayer0 - * Signature: (II)J + * Signature: (IIF)J */ JNIEXPORT jlong JNICALL Java_jogamp_nativewindow_macosx_OSXUtil_CreateCALayer0 - (JNIEnv *env, jclass unused, jint width, jint height) + (JNIEnv *env, jclass unused, jint width, jint height, jfloat contentsScale) { NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init]; MyCALayer* layer = [[MyCALayer alloc] init]; - DBG_PRINT("CALayer::CreateCALayer.0: root %p 0/0 %dx%d (refcnt %d)\n", layer, (int)width, (int)height, (int)[layer retainCount]); + DBG_PRINT("CALayer::CreateCALayer.0: root %p 0/0 %dx%d @ scale %lf (refcnt %d)\n", layer, (int)width, (int)height, (double)contentsScale, (int)[layer retainCount]); // avoid zero size if(0 == width) { width = 32; } if(0 == height) { height = 32; } + if( 1.0 != contentsScale ) { +NS_DURING + // Available >= 10.7 + [layer setContentsScale: (CGFloat)contentsScale]; +NS_HANDLER +NS_ENDHANDLER + } + // initial dummy size ! CGRect lFrame = [layer frame]; lFrame.origin.x = 0; @@ -580,10 +588,10 @@ JNIEXPORT jlong JNICALL Java_jogamp_nativewindow_macosx_OSXUtil_CreateCALayer0 /* * Class: Java_jogamp_nativewindow_macosx_OSXUtil * Method: AddCASublayer0 - * Signature: (JJIIIII)V + * Signature: (JJIIIIIF)V */ JNIEXPORT void JNICALL Java_jogamp_nativewindow_macosx_OSXUtil_AddCASublayer0 - (JNIEnv *env, jclass unused, jlong rootCALayer, jlong subCALayer, jint x, jint y, jint width, jint height, jint caLayerQuirks) + (JNIEnv *env, jclass unused, jlong rootCALayer, jlong subCALayer, jint x, jint y, jint width, jint height, jfloat contentsScale, jint caLayerQuirks) { NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init]; MyCALayer* rootLayer = (MyCALayer*) ((intptr_t) rootCALayer); @@ -596,9 +604,18 @@ JNIEXPORT void JNICALL Java_jogamp_nativewindow_macosx_OSXUtil_AddCASublayer0 [subLayer retain]; // Pairs w/ RemoveCASublayer CGRect lRectRoot = [rootLayer frame]; - DBG_PRINT("CALayer::AddCASublayer0.0: Quirks %d, Root %p (refcnt %d), Sub %p (refcnt %d), frame0: %lf/%lf %lfx%lf\n", + + // Available >= 10.7 + DBG_PRINT("CALayer::AddCASublayer0.0: Quirks %d, Root %p (refcnt %d), Sub %p (refcnt %d), frame0: %lf/%lf %lfx%lf scale %lf\n", caLayerQuirks, rootLayer, (int)[rootLayer retainCount], subLayer, (int)[subLayer retainCount], - lRectRoot.origin.x, lRectRoot.origin.y, lRectRoot.size.width, lRectRoot.size.height); + lRectRoot.origin.x, lRectRoot.origin.y, lRectRoot.size.width, lRectRoot.size.height, (float)contentsScale); + + if( 1.0 != contentsScale ) { +NS_DURING + [subLayer setContentsScale: (CGFloat)contentsScale]; +NS_HANDLER +NS_ENDHANDLER + } [subLayer setFrame:lRectRoot]; [rootLayer addSublayer:subLayer]; diff --git a/src/newt/classes/com/jogamp/newt/NewtFactory.java b/src/newt/classes/com/jogamp/newt/NewtFactory.java index 9685200eb..3b31861f0 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.getWidth(), parentWindow.getHeight()); + win.setSize(parentWindow.getSurfaceWidth(), parentWindow.getSurfaceHeight()); if ( null != newtParentWindow ) { newtParentWindow.addChild(win); win.setVisible(newtParentWindow.isVisible()); diff --git a/src/newt/classes/com/jogamp/newt/Window.java b/src/newt/classes/com/jogamp/newt/Window.java index 4816e62e5..9cf67c56f 100644 --- a/src/newt/classes/com/jogamp/newt/Window.java +++ b/src/newt/classes/com/jogamp/newt/Window.java @@ -232,7 +232,7 @@ public interface Window extends NativeWindow, WindowClosingProtocol { // /** - * Sets the size of the window's client area, excluding decorations. + * Sets the size of the window's client area in window units, excluding decorations. * * <p> * Zero size semantics are respected, see {@link #setVisible(boolean)}:<br> @@ -248,22 +248,22 @@ public interface Window extends NativeWindow, WindowClosingProtocol { * <p> * This call is ignored if in fullscreen mode.<br></p> * - * @param width of the window's client area - * @param height of the window's client area + * @param width of the window's client area in window units + * @param height of the window's client area in window units * * @see #getInsets() */ void setSize(int width, int height); /** - * Sets the size of the top-level window including insets (window decorations). + * Sets the size of the top-level window including insets (window decorations) in window units. * * <p> * Note: Insets (if supported) are available only after the window is set visible and hence has been created. * </p> * - * @param width of the top-level window area - * @param height of the top-level window area + * @param width of the top-level window area in window units + * @param height of the top-level window area in window units * * @see #setSize(int, int) * @see #getInsets() @@ -271,19 +271,19 @@ public interface Window extends NativeWindow, WindowClosingProtocol { void setTopLevelSize(int width, int height); /** - * Sets the location of the window's client area, excluding insets (window decorations).<br> + * Sets the location of the window's client area excluding insets (window decorations) in window units.<br> * * This call is ignored if in fullscreen mode.<br> * - * @param x coord of the client-area's top left corner - * @param y coord of the client-area's top left corner + * @param x coord of the client-area's top left corner in window units + * @param y coord of the client-area's top left corner in window units * * @see #getInsets() */ void setPosition(int x, int y); /** - * Sets the location of the top-level window inclusive insets (window decorations).<br> + * Sets the location of the top-level window inclusive insets (window decorations) in window units.<br> * * <p> * Note: Insets (if supported) are available only after the window is set visible and hence has been created. @@ -291,8 +291,8 @@ public interface Window extends NativeWindow, WindowClosingProtocol { * * This call is ignored if in fullscreen mode.<br> * - * @param x coord of the top-level left corner - * @param y coord of the top-level left corner + * @param x coord of the top-level left corner in window units + * @param y coord of the top-level left corner in window units * * @see #setPosition(int, int) * @see #getInsets() @@ -356,10 +356,10 @@ public interface Window extends NativeWindow, WindowClosingProtocol { void confinePointer(boolean confine); /** - * Moves the pointer to x/y relative to this window's origin. + * Moves the pointer to x/y relative to this window's origin in pixel units. * - * @param x relative pointer x position within this window - * @param y relative pointer y position within this window + * @param x relative pointer x position within this window in pixel units + * @param y relative pointer y position within this window in pixel units * * @see #confinePointer(boolean) */ @@ -431,8 +431,8 @@ public interface Window extends NativeWindow, WindowClosingProtocol { * this window is added to it's list of children.<br></P> * * @param newParent The new parent NativeWindow. If null, this Window becomes a top level window. - * @param x new top-level position, use -1 for default position. - * @param y new top-level position, use -1 for default position. + * @param x new top-level position in window units, use -1 for default position. + * @param y new top-level position in window units, use -1 for default position. * @param hints May contain hints (bitfield values) like {@link #REPARENT_HINT_FORCE_RECREATION} or {@link #REPARENT_HINT_BECOMES_VISIBLE}. * * @return The issued reparent action type (strategy) as defined in Window.ReparentAction @@ -520,6 +520,13 @@ public interface Window extends NativeWindow, WindowClosingProtocol { */ void requestFocus(boolean wait); + /** + * Trigger window repaint while passing the dirty region in pixel units. + * @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 + */ void windowRepaint(int x, int y, int width, int height); void enqueueEvent(boolean wait, com.jogamp.newt.event.NEWTEvent event); diff --git a/src/newt/classes/com/jogamp/newt/awt/NewtCanvasAWT.java b/src/newt/classes/com/jogamp/newt/awt/NewtCanvasAWT.java index f0cc68903..891843cb7 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.getWidth(), w.getHeight()); + java.awt.Dimension minSize = new java.awt.Dimension(w.getSurfaceWidth(), w.getSurfaceHeight()); setMinimumSize(minSize); setPreferredSize(minSize); } @@ -645,8 +645,8 @@ public class NewtCanvasAWT extends java.awt.Canvas implements WindowClosingProto final int printNumSamples = printAWTTiles.getNumSamples(caps); GLDrawable printDrawable = printGLAD.getDelegatedDrawable(); final boolean reqNewGLADSamples = printNumSamples != caps.getNumSamples(); - final boolean reqNewGLADSize = printAWTTiles.customTileWidth != -1 && printAWTTiles.customTileWidth != printDrawable.getWidth() || - printAWTTiles.customTileHeight != -1 && printAWTTiles.customTileHeight != printDrawable.getHeight(); + final boolean reqNewGLADSize = printAWTTiles.customTileWidth != -1 && printAWTTiles.customTileWidth != printDrawable.getSurfaceWidth() || + printAWTTiles.customTileHeight != -1 && printAWTTiles.customTileHeight != printDrawable.getSurfaceHeight(); final boolean reqNewGLADOnscrn = caps.isOnscreen(); // It is desired to use a new offscreen GLAD, however Bug 830 forbids this for AA onscreen context. @@ -654,7 +654,7 @@ public class NewtCanvasAWT extends java.awt.Canvas implements WindowClosingProto final boolean reqNewGLAD = !caps.getSampleBuffers() && ( reqNewGLADOnscrn || reqNewGLADSamples || reqNewGLADSize ); if( DEBUG ) { System.err.println("AWT print.setup: reqNewGLAD "+reqNewGLAD+"[ onscreen "+reqNewGLADOnscrn+", samples "+reqNewGLADSamples+", size "+reqNewGLADSize+"], "+ - ", drawableSize "+printDrawable.getWidth()+"x"+printDrawable.getHeight()+ + ", drawableSize "+printDrawable.getSurfaceWidth()+"x"+printDrawable.getSurfaceHeight()+ ", customTileSize "+printAWTTiles.customTileWidth+"x"+printAWTTiles.customTileHeight+ ", scaleMat "+printAWTTiles.scaleMatX+" x "+printAWTTiles.scaleMatY+ ", numSamples "+printAWTTiles.customNumSamples+" -> "+printNumSamples+", printAnimator "+printAnimator); @@ -674,13 +674,13 @@ public class NewtCanvasAWT extends java.awt.Canvas implements WindowClosingProto printDrawable = printGLAD.getDelegatedDrawable(); } printAWTTiles.setGLOrientation(printGLAD.isGLOriented(), printGLAD.isGLOriented()); - printAWTTiles.renderer.setTileSize(printDrawable.getWidth(), printDrawable.getHeight(), 0); + printAWTTiles.renderer.setTileSize(printDrawable.getSurfaceWidth(), printDrawable.getSurfaceHeight(), 0); printAWTTiles.renderer.attachAutoDrawable(printGLAD); if( DEBUG ) { System.err.println("AWT print.setup "+printAWTTiles); System.err.println("AWT print.setup AA "+printNumSamples+", "+caps); - System.err.println("AWT print.setup printGLAD: "+printGLAD.getWidth()+"x"+printGLAD.getHeight()+", "+printGLAD); - System.err.println("AWT print.setup printDraw: "+printDrawable.getWidth()+"x"+printDrawable.getHeight()+", "+printDrawable); + System.err.println("AWT print.setup printGLAD: "+printGLAD.getSurfaceWidth()+"x"+printGLAD.getSurfaceHeight()+", "+printGLAD); + System.err.println("AWT print.setup printDraw: "+printDrawable.getSurfaceWidth()+"x"+printDrawable.getSurfaceHeight()+", "+printDrawable); } } } diff --git a/src/newt/classes/com/jogamp/newt/event/MouseEvent.java b/src/newt/classes/com/jogamp/newt/event/MouseEvent.java index fb74b5a09..43cac31bb 100644 --- a/src/newt/classes/com/jogamp/newt/event/MouseEvent.java +++ b/src/newt/classes/com/jogamp/newt/event/MouseEvent.java @@ -42,6 +42,11 @@ package com.jogamp.newt.event; * <p> * http://www.w3.org/Submission/pointer-events/#pointerevent-interface * </p> + * <a name="coordUnit"><h5>Unit of Coordinates</h5></a> + * <p> + * All pointer coordinates of this interface are represented in pixel units, + * see {@link NativeSurface} and {@link NativeWindow}. + * </p> * <a name="multiPtrEvent"><h5>Multiple-Pointer Events</h5></a> * <p> * In case an instance represents a multiple-pointer event, i.e. {@link #getPointerCount()} is > 1, @@ -349,10 +354,18 @@ public class MouseEvent extends InputEvent return clickCount; } + /** + * See details for <a href="#multiPtrEvent">multiple-pointer events</a>. + * @return X-Coord of the triggering pointer-index zero in pixel units. + */ public final int getX() { return x[0]; } + /** + * See details for <a href="#multiPtrEvent">multiple-pointer events</a>. + * @return Y-Coord of the triggering pointer-index zero in pixel units. + */ public final int getY() { return y[0]; } @@ -360,7 +373,7 @@ public class MouseEvent extends InputEvent /** * See details for <a href="#multiPtrEvent">multiple-pointer events</a>. * @param index pointer-index within [0 .. {@link #getPointerCount()}-1] - * @return X-Coord associated with the pointer-index. + * @return X-Coord associated with the pointer-index in pixel units. * @see getPointerId(index) */ public final int getX(final int index) { @@ -370,7 +383,7 @@ public class MouseEvent extends InputEvent /** * See details for <a href="#multiPtrEvent">multiple-pointer events</a>. * @param index pointer-index within [0 .. {@link #getPointerCount()}-1] - * @return Y-Coord associated with the pointer-index. + * @return Y-Coord associated with the pointer-index in pixel units. * @see getPointerId(index) */ public final int getY(final int index) { @@ -379,7 +392,7 @@ public class MouseEvent extends InputEvent /** * See details for <a href="#multiPtrEvent">multiple-pointer events</a>. - * @return array of all X-Coords for all pointers + * @return array of all X-Coords for all pointers in pixel units. */ public final int[] getAllX() { return x; @@ -387,7 +400,7 @@ public class MouseEvent extends InputEvent /** * See details for <a href="#multiPtrEvent">multiple-pointer events</a>. - * @return array of all Y-Coords for all pointers + * @return array of all Y-Coords for all pointers in pixel units. */ public final int[] getAllY() { return y; diff --git a/src/newt/classes/com/jogamp/newt/event/PinchToZoomGesture.java b/src/newt/classes/com/jogamp/newt/event/PinchToZoomGesture.java index 7d22128cf..1521036d6 100644 --- a/src/newt/classes/com/jogamp/newt/event/PinchToZoomGesture.java +++ b/src/newt/classes/com/jogamp/newt/event/PinchToZoomGesture.java @@ -173,7 +173,7 @@ public class PinchToZoomGesture implements GestureHandler { } final int eventType = pe.getEventType(); - final boolean useY = surface.getWidth() >= surface.getHeight(); // use smallest dimension + final boolean useY = surface.getSurfaceWidth() >= surface.getSurfaceHeight(); // use smallest dimension switch ( eventType ) { case MouseEvent.EVENT_MOUSE_PRESSED: { if( 1 == pointerDownCount ) { @@ -221,7 +221,7 @@ public class PinchToZoomGesture implements GestureHandler { } else if( zoomMode ) { final int d = Math.abs(edge0-edge1); final int dd = d - zoomLastEdgeDist; - final float screenEdge = useY ? surface.getHeight() : surface.getWidth(); + final float screenEdge = useY ? surface.getSurfaceHeight() : surface.getSurfaceWidth(); final float delta = dd / screenEdge; // [-1..1] if(DEBUG) { System.err.println("XXX2: id0 "+pIds[0]+" -> idx0 "+p0Idx+", id1 "+pIds[1]+" -> idx1 "+p1Idx); diff --git a/src/newt/classes/com/jogamp/newt/opengl/GLWindow.java b/src/newt/classes/com/jogamp/newt/opengl/GLWindow.java index 4b740927b..c4a5fcab1 100644 --- a/src/newt/classes/com/jogamp/newt/opengl/GLWindow.java +++ b/src/newt/classes/com/jogamp/newt/opengl/GLWindow.java @@ -130,7 +130,7 @@ public class GLWindow extends GLAutoDrawableBase implements GLAutoDrawable, Wind @Override public void windowResized(WindowEvent e) { - defaultWindowResizedOp(getWidth(), getHeight()); + defaultWindowResizedOp(getSurfaceWidth(), getSurfaceHeight()); } }); @@ -353,13 +353,33 @@ public class GLWindow extends GLAutoDrawableBase implements GLAutoDrawable, Wind } @Override - public final int getWidth() { - return window.getWidth(); + public final int getWindowWidth() { + return window.getWindowWidth(); } @Override - public final int getHeight() { - return window.getHeight(); + public final int getWindowHeight() { + return window.getWindowHeight(); + } + + @Override + public final int[] getWindowUnitXY(int[] result, final int[] pixelUnitXY) { + return window.getWindowUnitXY(result, pixelUnitXY); + } + + @Override + public final int[] getPixelUnitXY(int[] result, final int[] windowUnitXY) { + return window.getPixelUnitXY(result, windowUnitXY); + } + + @Override + public final int getSurfaceWidth() { + return window.getSurfaceWidth(); + } + + @Override + public final int getSurfaceHeight() { + return window.getSurfaceHeight(); } @Override @@ -516,7 +536,7 @@ public class GLWindow extends GLAutoDrawableBase implements GLAutoDrawable, Wind t0 = 0; } - if (null == drawable && visible && 0 != window.getWindowHandle() && 0<getWidth()*getHeight()) { + if (null == drawable && visible && 0 != window.getWindowHandle() && 0<getSurfaceWidth()*getSurfaceHeight()) { if( ( null != context ) ) { throw new InternalError("GLWindow.LifecycleHook.setVisiblePost: "+WindowImpl.getThreadName()+" - Null drawable, but valid context - "+GLWindow.this); } @@ -626,7 +646,7 @@ public class GLWindow extends GLAutoDrawableBase implements GLAutoDrawable, Wind } finally { lock.unlock(); } - if( !done && ( 0 < getWidth() && 0 < getHeight() ) ) { + if( !done && ( 0 < getSurfaceWidth() && 0 < getSurfaceHeight() ) ) { // retry drawable and context creation, will itself issue resize -> display setVisible(true); } diff --git a/src/newt/classes/com/jogamp/newt/swt/NewtCanvasSWT.java b/src/newt/classes/com/jogamp/newt/swt/NewtCanvasSWT.java index 6f4be75f5..ee01212cb 100644 --- a/src/newt/classes/com/jogamp/newt/swt/NewtCanvasSWT.java +++ b/src/newt/classes/com/jogamp/newt/swt/NewtCanvasSWT.java @@ -460,12 +460,38 @@ public class NewtCanvasSWT extends Canvas implements WindowClosingProtocol { } @Override - public int getWidth() { + public int getWindowWidth() { + return getSurfaceWidth(); // FIXME: Use 'scale' or an actual window-width + } + + @Override + public int getWindowHeight() { + return getSurfaceHeight(); // FIXME: Use 'scale' or an actual window-width + } + + @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; + } + + @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; + } + + @Override + public int getSurfaceWidth() { return clientArea.width; } @Override - public int getHeight() { + public int getSurfaceHeight() { return clientArea.height; } 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 8123126ee..8a3e5616d 100644 --- a/src/newt/classes/com/jogamp/newt/util/applet/JOGLNewtApplet3Run.java +++ b/src/newt/classes/com/jogamp/newt/util/applet/JOGLNewtApplet3Run.java @@ -44,7 +44,7 @@ import javax.media.opengl.FPSCounter; import javax.media.opengl.GLCapabilities; import javax.media.opengl.GLProfile; -import com.jogamp.nativewindow.UpstreamSurfaceHookMutableSizePos; +import com.jogamp.nativewindow.UpstreamWindowHookMutableSizePos; import com.jogamp.newt.NewtFactory; import com.jogamp.newt.Window; import com.jogamp.newt.opengl.GLWindow; @@ -103,7 +103,7 @@ public class JOGLNewtApplet3Run implements Applet3 { int glXd=Integer.MAX_VALUE, glYd=Integer.MAX_VALUE, glWidth=Integer.MAX_VALUE, glHeight=Integer.MAX_VALUE; Applet3Context ctx; boolean glStandalone = false; - UpstreamSurfaceHookMutableSizePos upstreamSizePosHook; + UpstreamWindowHookMutableSizePos upstreamSizePosHook; PointImmutable upstreamLocOnScreen; NativeWindow browserWin; @@ -147,8 +147,9 @@ public class JOGLNewtApplet3Run implements Applet3 { final AbstractGraphicsDevice aDevice = NativeWindowFactory.createDevice(upstreamWin.getDisplayConnection(), true /* own */); // open and own! (for upstreamLocOnScreen) final AbstractGraphicsScreen aScreen = NativeWindowFactory.createScreen(aDevice, upstreamWin.getScreenIndex()); - upstreamSizePosHook = new UpstreamSurfaceHookMutableSizePos(upstreamWin.getX(), upstreamWin.getY(), - upstreamWin.getWidth(), upstreamWin.getHeight()); + upstreamSizePosHook = new UpstreamWindowHookMutableSizePos(upstreamWin.getX(), upstreamWin.getY(), + upstreamWin.getWidth(), upstreamWin.getHeight(), + upstreamWin.getWidth(), upstreamWin.getHeight()); // FIXME: pixel-dim == window-dim 'for now' ? browserWin = NativeWindowFactory.createWrappedWindow(aScreen, 0 /* surfaceHandle */, upstreamWin.getWindowHandle(), upstreamSizePosHook); upstreamLocOnScreen = NativeWindowFactory.getLocationOnScreen(browserWin); @@ -171,7 +172,7 @@ public class JOGLNewtApplet3Run implements Applet3 { glWindow = GLWindow.create(w); glWindow.setUndecorated(glUndecorated); glWindow.setAlwaysOnTop(glAlwaysOnTop); - glWindow.setSize(browserWin.getWidth(), browserWin.getHeight()); + glWindow.setSize(browserWin.getSurfaceWidth(), browserWin.getSurfaceHeight()); return new NativeWindowDownstream() { @Override @@ -183,7 +184,7 @@ public class JOGLNewtApplet3Run implements Applet3 { @Override public void setSize(int width, int height) { - upstreamSizePosHook.setSize(width, height); + upstreamSizePosHook.setPixelSize(width, height); if( null != glWindow ) { glWindow.setSize(width, height); } @@ -226,7 +227,7 @@ public class JOGLNewtApplet3Run implements Applet3 { @Override public void notifyPositionChanged(NativeWindowUpstream nw) { - upstreamSizePosHook.setPos(nw.getX(), nw.getY()); + upstreamSizePosHook.setWinPos(nw.getX(), nw.getY()); if( null != glWindow ) { glWindow.setPosition(nw.getX(), nw.getY()); } diff --git a/src/newt/classes/com/jogamp/newt/util/applet/JOGLNewtAppletBase.java b/src/newt/classes/com/jogamp/newt/util/applet/JOGLNewtAppletBase.java index bbe6b8527..eee8ab23e 100644 --- a/src/newt/classes/com/jogamp/newt/util/applet/JOGLNewtAppletBase.java +++ b/src/newt/classes/com/jogamp/newt/util/applet/JOGLNewtAppletBase.java @@ -377,7 +377,7 @@ public class JOGLNewtAppletBase implements KeyListener, GLEventListener { new Thread() { public void run() { System.err.println("[set mouse pos pre]"); - glWindow.warpPointer(glWindow.getWidth()/2, glWindow.getHeight()/2); + glWindow.warpPointer(glWindow.getSurfaceWidth()/2, glWindow.getSurfaceHeight()/2); System.err.println("[set mouse pos post]"); } }.start(); } diff --git a/src/newt/classes/jogamp/newt/WindowImpl.java b/src/newt/classes/jogamp/newt/WindowImpl.java index afb1ad020..a9fc28a33 100644 --- a/src/newt/classes/jogamp/newt/WindowImpl.java +++ b/src/newt/classes/jogamp/newt/WindowImpl.java @@ -148,8 +148,9 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer private volatile long windowHandle = 0; // lifecycle critical private volatile boolean visible = false; // lifecycle critical private volatile boolean hasFocus = false; - private volatile int width = 128, height = 128; // client-area size w/o insets, default: may be overwritten by user - private volatile int x = 64, y = 64; // client-area pos w/o insets + private volatile int pixWidth = 128, pixHeight = 128; // client-area size w/o insets in pixel units, default: may be overwritten by user + private volatile int winWidth = 128, winHeight = 128; // client-area size w/o insets in window units, default: may be overwritten by user + private volatile int x = 64, y = 64; // client-area pos w/o insets in window units private volatile Insets insets = new Insets(); // insets of decoration (if top-level && decorated) private boolean blockInsetsChange = false; // block insets change (from same thread) @@ -910,7 +911,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer @Override public final MonitorDevice getMainMonitor() { - return screen.getMainMonitor(new Rectangle(getX(), getY(), getWidth(), getHeight())); + return screen.getMainMonitor(new Rectangle(getX(), getY(), getSurfaceWidth(), getSurfaceHeight())); } protected final void setVisibleImpl(boolean visible, int x, int y, int width, int height) { @@ -934,7 +935,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer } } if(!isNativeValid() && visible) { - if( 0<getWidth()*getHeight() ) { + if( 0<getSurfaceWidth()*getSurfaceHeight() ) { nativeWindowCreated = createNative(); madeVisible = nativeWindowCreated; } @@ -942,7 +943,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer WindowImpl.this.visible = true; } else if(WindowImpl.this.visible != visible) { if(isNativeValid()) { - setVisibleImpl(visible, getX(), getY(), getWidth(), getHeight()); + setVisibleImpl(visible, getX(), getY(), getSurfaceWidth(), getSurfaceHeight()); WindowImpl.this.waitForVisible(visible, false); madeVisible = visible; } else { @@ -965,7 +966,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer } } if(DEBUG_IMPLEMENTATION) { - System.err.println("Window setVisible: END ("+getThreadName()+") "+getX()+"/"+getY()+" "+getWidth()+"x"+getHeight()+", fs "+fullscreen+", windowHandle "+toHexString(windowHandle)+", visible: "+WindowImpl.this.visible+", nativeWindowCreated: "+nativeWindowCreated+", madeVisible: "+madeVisible); + 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); } } finally { if(null!=lifecycleHook) { @@ -993,7 +994,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()+" "+getWidth()+"x"+getHeight()+", fs "+fullscreen+", windowHandle "+toHexString(windowHandle)+", visible: "+this.visible+" -> "+visible+", parentWindowHandle "+toHexString(parentWindowHandle)+", parentWindow "+(null!=parentWindow)); + 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)); } runOnEDTIfAvail(wait, new VisibleAction(visible)); } @@ -1018,9 +1019,9 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer final RecursiveLock _lock = windowLock; _lock.lock(); try { - if ( ( disregardFS || !isFullscreen() ) && ( getWidth() != width || getHeight() != height ) ) { + if ( ( disregardFS || !isFullscreen() ) && ( getSurfaceWidth() != width || getSurfaceHeight() != height ) ) { if(DEBUG_IMPLEMENTATION) { - System.err.println("Window setSize: START "+getWidth()+"x"+getHeight()+" -> "+width+"x"+height+", fs "+fullscreen+", windowHandle "+toHexString(windowHandle)+", visible "+visible); + System.err.println("Window setSize: START "+getSurfaceWidth()+"x"+getSurfaceHeight()+" -> "+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 ) ) { @@ -1040,7 +1041,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer defineSize(width, height); } if(DEBUG_IMPLEMENTATION) { - System.err.println("Window setSize: END "+getWidth()+"x"+getHeight()+", visibleAction "+visibleAction); + System.err.println("Window setSize: END "+getSurfaceWidth()+"x"+getSurfaceHeight()+", visibleAction "+visibleAction); } switch(visibleAction) { case 1: setVisibleActionImpl(false); break; @@ -1247,8 +1248,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 = getWidth(); - final int oldHeight = getHeight(); + final int oldWidth = getSurfaceWidth(); + final int oldHeight = getSurfaceHeight(); final int x, y; int width = oldWidth; int height = oldHeight; @@ -1299,11 +1300,11 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer y = 0; // refit if size is bigger than parent - if( width > newParentWindow.getWidth() ) { - width = newParentWindow.getWidth(); + if( width > newParentWindow.getSurfaceWidth() ) { + width = newParentWindow.getSurfaceWidth(); } - if( height > newParentWindow.getHeight() ) { - height = newParentWindow.getHeight(); + if( height > newParentWindow.getSurfaceHeight() ) { + height = newParentWindow.getSurfaceHeight(); } // Case: Child Window @@ -1510,7 +1511,7 @@ 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()+" "+getWidth()+"x"+getHeight()); + 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()); } } finally { if(null!=lifecycleHook) { @@ -1534,7 +1535,7 @@ 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()+" "+getWidth()+"x"+getHeight()); + 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()); } } } @@ -1611,8 +1612,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 = getWidth(); - final int height = getHeight(); + final int width = getSurfaceWidth(); + final int height = getSurfaceHeight(); DisplayImpl display = (DisplayImpl) screen.getDisplay(); display.dispatchMessagesNative(); // status up2date @@ -1657,8 +1658,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 = getWidth(); - final int height = getHeight(); + final int width = getSurfaceWidth(); + final int height = getSurfaceHeight(); DisplayImpl display = (DisplayImpl) screen.getDisplay(); display.dispatchMessagesNative(); // status up2date @@ -1823,7 +1824,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer if(!setVal) { if(confine) { requestFocus(); - warpPointer(getWidth()/2, getHeight()/2); + warpPointer(getSurfaceWidth()/2, getSurfaceHeight()/2); } setVal = confinePointerImpl(confine); if(confine) { @@ -1857,13 +1858,39 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer } @Override - public final int getWidth() { - return width; + public final int getSurfaceWidth() { + return pixWidth; } @Override - public final int getHeight() { - return height; + public final int getSurfaceHeight() { + return pixHeight; + } + + @Override + public final int getWindowWidth() { + return getSurfaceWidth(); // FIXME: Use 'scale' or an actual pixel-width + } + + @Override + public final int getWindowHeight() { + return getSurfaceHeight(); // FIXME: Use 'scale' or an actual pixel-width + } + + @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; + } + + @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; } @Override @@ -1888,13 +1915,13 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer this.x = x; this.y = y; } - /** Sets the size fields {@link #width} and {@link #height} to the given values. */ + /** Sets the size fields {@link #pixWidth} and {@link #pixHeight} to the given values. */ protected final void defineSize(int width, int height) { if(DEBUG_IMPLEMENTATION) { - System.err.println("defineSize: "+this.width+"x"+this.height+" -> "+width+"x"+height); + System.err.println("defineSize: "+this.pixWidth+"x"+this.pixHeight+" -> "+width+"x"+height); // Thread.dumpStack(); } - this.width = width; this.height = height; + this.pixWidth = width; this.pixHeight = height; } @Override @@ -1965,7 +1992,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer "\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 "+getWidth()+"x"+getHeight()+ + "\n, Pos "+getX()+"/"+getY()+" (auto "+autoPosition()+"), size "+getSurfaceWidth()+"x"+getSurfaceHeight()+ "\n, Visible "+isVisible()+", focus "+hasFocus()+ "\n, Undecorated "+undecorated+" ("+isUndecorated()+")"+ "\n, AlwaysOnTop "+alwaysOnTop+", Fullscreen "+fullscreen+ @@ -2111,7 +2138,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, getWidth(), getHeight(), getReconfigureFlags(0, isVisible())); + reconfigureWindowImpl(x, y, getSurfaceWidth(), getSurfaceHeight(), getReconfigureFlags(0, isVisible())); if( null == parentWindow ) { // Wait until custom position is reached within tolerances waitForPosition(true, x, y, Window.TIMEOUT_NATIVEWINDOW); @@ -2159,8 +2186,8 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer try { final int oldX = getX(); final int oldY = getY(); - final int oldWidth = getWidth(); - final int oldHeight = getHeight(); + final int oldWidth = getSurfaceWidth(); + final int oldHeight = getSurfaceHeight(); int x,y,w,h; @@ -2213,11 +2240,11 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer y = 0; // refit if size is bigger than parent - if( w > parentWindow.getWidth() ) { - w = parentWindow.getWidth(); + if( w > parentWindow.getSurfaceWidth() ) { + w = parentWindow.getSurfaceWidth(); } - if( h > parentWindow.getHeight() ) { - h = parentWindow.getHeight(); + if( h > parentWindow.getSurfaceHeight() ) { + h = parentWindow.getSurfaceHeight(); } } } @@ -2388,10 +2415,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(), getWidth(), getHeight()); + final RectangleImmutable rect = new Rectangle(getX(), getY(), getSurfaceWidth(), getSurfaceHeight()); final RectangleImmutable isect = viewport.intersection(rect); - if ( getHeight() > isect.getHeight() || - getWidth() > isect.getWidth() ) { + if ( getSurfaceHeight() > isect.getHeight() || + getSurfaceWidth() > isect.getWidth() ) { if(DEBUG_IMPLEMENTATION) { System.err.println("Window.monitorModeChanged: fit window "+rect+" into screen viewport "+viewport+ ", due to minimal intersection "+isect); @@ -2414,7 +2441,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(), getWidth(), getHeight()); + final RectangleImmutable rect = new Rectangle(getX(), getY(), getSurfaceWidth(), getSurfaceHeight()); 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 @@ -2735,7 +2762,7 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer // int x = pX[0]; int y = pY[0]; - final boolean insideWindow = x >= 0 && y >= 0 && x < getWidth() && y < getHeight(); + final boolean insideWindow = x >= 0 && y >= 0 && x < getSurfaceWidth() && y < getSurfaceHeight(); final Point movePositionP0 = pState1.getMovePosition(pID[0]); switch( eventType ) { case MouseEvent.EVENT_MOUSE_EXITED: @@ -2774,8 +2801,8 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer return; } // clip coordinates to window dimension - x = Math.min(Math.max(x, 0), getWidth()-1); - y = Math.min(Math.max(y, 0), getHeight()-1); + x = Math.min(Math.max(x, 0), getSurfaceWidth()-1); + y = Math.min(Math.max(y, 0), getSurfaceHeight()-1); break; case MouseEvent.EVENT_MOUSE_MOVED: @@ -2938,7 +2965,8 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer int y = pe.getY(); if(DEBUG_MOUSE_EVENT) { - System.err.println("consumePointerEvent.in: "+pe+", "+pState0+", pos "+x+"/"+y+" clientSize["+getWidth()+"x"+getHeight()+"]"); + System.err.println("consumePointerEvent.in: "+pe+", "+pState0+", pos "+x+"/"+y+", win["+getX()+"/"+getY()+" "+getWindowWidth()+"x"+getWindowHeight()+ + "], pixel["+getSurfaceWidth()+"x"+getSurfaceHeight()+"]"); } // @@ -2962,8 +2990,8 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer // Fall through intended ! case MouseEvent.EVENT_MOUSE_ENTERED: // clip coordinates to window dimension - x = Math.min(Math.max(x, 0), getWidth()-1); - y = Math.min(Math.max(y, 0), getHeight()-1); + x = Math.min(Math.max(x, 0), getSurfaceWidth()-1); + y = Math.min(Math.max(y, 0), getSurfaceHeight()-1); pState0.clearButton(); if( eventType == MouseEvent.EVENT_MOUSE_ENTERED ) { insideWindow = true; @@ -2986,20 +3014,20 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer // Fall through intended ! default: - insideWindow = x >= 0 && y >= 0 && x < getWidth() && y < getHeight(); + insideWindow = x >= 0 && y >= 0 && x < getSurfaceWidth() && y < getWindowHeight(); if( pe.getPointerType(0) == PointerType.Mouse ) { if( !pState0.insideWindow && insideWindow ) { // ENTER .. use clipped coordinates eEntered = new MouseEvent(MouseEvent.EVENT_MOUSE_ENTERED, pe.getSource(), pe.getWhen(), pe.getModifiers(), - Math.min(Math.max(x, 0), getWidth()-1), - Math.min(Math.max(y, 0), getHeight()-1), + 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 ) { // EXIT .. use clipped coordinates eExited = new MouseEvent(MouseEvent.EVENT_MOUSE_EXITED, pe.getSource(), pe.getWhen(), pe.getModifiers(), - Math.min(Math.max(x, 0), getWidth()-1), - Math.min(Math.max(y, 0), getHeight()-1), + 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 = true; } @@ -3505,7 +3533,8 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer protected void consumeWindowEvent(WindowEvent e) { if(DEBUG_IMPLEMENTATION) { - System.err.println("consumeWindowEvent: "+e+", visible "+isVisible()+" "+getX()+"/"+getY()+" "+getWidth()+"x"+getHeight()); + System.err.println("consumeWindowEvent: "+e+", visible "+isVisible()+" "+getX()+"/"+getY()+", win["+getX()+"/"+getY()+" "+getWindowWidth()+"x"+getWindowHeight()+ + "], pixel["+getSurfaceWidth()+"x"+getSurfaceHeight()+"]"); } for(int i = 0; !e.isConsumed() && i < windowListeners.size(); i++ ) { WindowListener l = windowListeners.get(i); @@ -3597,9 +3626,9 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer /** Triggered by implementation's WM events to update the client-area size w/o insets/decorations. */ protected void sizeChanged(boolean defer, int newWidth, int newHeight, boolean force) { - if(force || getWidth() != newWidth || getHeight() != newHeight) { + if(force || getSurfaceWidth() != newWidth || getSurfaceHeight() != newHeight) { if(DEBUG_IMPLEMENTATION) { - System.err.println("Window.sizeChanged: ("+getThreadName()+"): (defer: "+defer+") force "+force+", "+getWidth()+"x"+getHeight()+" -> "+newWidth+"x"+newHeight+" - windowHandle "+toHexString(windowHandle)+" parentWindowHandle "+toHexString(parentWindowHandle)); + System.err.println("Window.sizeChanged: ("+getThreadName()+"): (defer: "+defer+") force "+force+", "+getSurfaceWidth()+"x"+getSurfaceHeight()+" -> "+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)"); @@ -3619,12 +3648,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!=getWidth() && h!=getHeight(); sleep-=10 ) { + for(sleep = timeOut; 0<sleep && w!=getSurfaceWidth() && h!=getSurfaceHeight(); 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 "+getWidth()+"x"+getHeight(); + final String msg = "Size/Pos not reached as requested within "+timeOut+"ms : requested "+w+"x"+h+", is "+getSurfaceWidth()+"x"+getSurfaceHeight(); if(failFast) { throw new NativeWindowException(msg); } else if (DEBUG_IMPLEMENTATION) { @@ -3775,10 +3804,15 @@ 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 */ protected final void windowRepaint(boolean defer, int x, int y, int width, int height) { - width = ( 0 >= width ) ? getWidth() : width; - height = ( 0 >= height ) ? getHeight() : height; + width = ( 0 >= width ) ? getSurfaceWidth() : width; + height = ( 0 >= height ) ? getSurfaceHeight() : height; if(DEBUG_IMPLEMENTATION) { System.err.println("Window.windowRepaint "+getThreadName()+" (defer: "+defer+") "+x+"/"+y+" "+width+"x"+height); } diff --git a/src/newt/classes/jogamp/newt/awt/event/AWTParentWindowAdapter.java b/src/newt/classes/jogamp/newt/awt/event/AWTParentWindowAdapter.java index 770502326..8b6bb95a9 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.getWidth() != cw || newtChild.getHeight() != ch ) { + if( newtChild.getSurfaceWidth() != cw || newtChild.getSurfaceHeight() != 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 76eb890e2..5fe378f2c 100644 --- a/src/newt/classes/jogamp/newt/driver/android/NewtBaseActivity.java +++ b/src/newt/classes/jogamp/newt/driver/android/NewtBaseActivity.java @@ -228,8 +228,8 @@ public class NewtBaseActivity extends Activity { androidWindow.clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN); } - if(newtWindow.getWidth()>0 && newtWindow.getHeight()>0 && !newtWindow.isFullscreen()) { - androidWindow.setLayout(newtWindow.getWidth(), newtWindow.getHeight()); + if(newtWindow.getSurfaceWidth()>0 && newtWindow.getSurfaceHeight()>0 && !newtWindow.isFullscreen()) { + androidWindow.setLayout(newtWindow.getSurfaceWidth(), newtWindow.getSurfaceHeight()); } } diff --git a/src/newt/classes/jogamp/newt/driver/android/NewtVersionActivity.java b/src/newt/classes/jogamp/newt/driver/android/NewtVersionActivity.java index 259acb8f3..09de62326 100644 --- a/src/newt/classes/jogamp/newt/driver/android/NewtVersionActivity.java +++ b/src/newt/classes/jogamp/newt/driver/android/NewtVersionActivity.java @@ -83,7 +83,7 @@ public class NewtVersionActivity extends NewtBaseActivity { glWindow.setSize(32, 32); glWindow.setPosition(0, 0); final android.view.View androidGLView = ((WindowDriver)glWindow.getDelegatedWindow()).getAndroidView(); - viewGroup.addView(androidGLView, new android.widget.FrameLayout.LayoutParams(glWindow.getWidth(), glWindow.getHeight(), Gravity.BOTTOM|Gravity.RIGHT)); + viewGroup.addView(androidGLView, new android.widget.FrameLayout.LayoutParams(glWindow.getSurfaceWidth(), glWindow.getSurfaceHeight(), Gravity.BOTTOM|Gravity.RIGHT)); registerNEWTWindow(glWindow); glWindow.addGLEventListener(new GLEventListener() { diff --git a/src/newt/classes/jogamp/newt/driver/android/WindowDriver.java b/src/newt/classes/jogamp/newt/driver/android/WindowDriver.java index 9af455445..20163f96c 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(getWidth(), getHeight(), Gravity.BOTTOM|Gravity.RIGHT)); + viewGroup.addView(androidView, new android.widget.FrameLayout.LayoutParams(getSurfaceWidth(), getSurfaceHeight(), 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 ) { @@ -334,7 +334,9 @@ public class WindowDriver extends jogamp.newt.WindowImpl implements Callback2 { final DefaultGraphicsScreen eglScreen = new DefaultGraphicsScreen(eglDevice, aScreen.getIndex()); Log.d(MD.TAG, "createNativeImpl 0 - eglDevice 0x"+Integer.toHexString(eglDevice.hashCode())+", "+eglDevice+", surfaceHandle 0x"+Long.toHexString(surfaceHandle)+ - ", format [a "+androidFormat+", n "+nativeFormat+"], "+getX()+"/"+getY()+" "+getWidth()+"x"+getHeight()+" - on thread "+Thread.currentThread().getName()); + ", format [a "+androidFormat+", n "+nativeFormat+"], win["+getX()+"/"+getY()+" "+getWindowWidth()+"x"+getWindowHeight()+ + "], pixel["+getSurfaceWidth()+"x"+getSurfaceHeight()+ + "] - on thread "+Thread.currentThread().getName()); if(0!=getParentWindowHandle()) { throw new NativeWindowException("Window parenting not supported (yet)"); @@ -379,7 +381,9 @@ public class WindowDriver extends jogamp.newt.WindowImpl implements Callback2 { Log.d(MD.TAG, "closeNativeImpl 0 - eglDevice 0x"+Integer.toHexString(eglDevice.hashCode())+", "+eglDevice+", surfaceHandle 0x"+Long.toHexString(surfaceHandle)+ ", eglSurfaceHandle 0x"+Long.toHexString(eglSurface)+ - ", format [a "+androidFormat+", n "+nativeFormat+"], "+getX()+"/"+getY()+" "+getWidth()+"x"+getHeight()+" - on thread "+Thread.currentThread().getName()); + ", format [a "+androidFormat+", n "+nativeFormat+"], win["+getX()+"/"+getY()+" "+getWindowWidth()+"x"+getWindowHeight()+ + "], pixel["+getSurfaceWidth()+"x"+getSurfaceHeight()+"],"+ + " - on thread "+Thread.currentThread().getName()); if(WindowImpl.DEBUG_IMPLEMENTATION) { Thread.dumpStack(); } @@ -458,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(getWidth() != width || getHeight() != height) { + if(getSurfaceWidth() != width || getSurfaceHeight() != height) { if(0!=getWindowHandle()) { Log.d(MD.TAG, "reconfigureWindowImpl.setSize n/a"); res = false; @@ -544,7 +548,7 @@ public class WindowDriver extends jogamp.newt.WindowImpl implements Callback2 { @Override public final void surfaceCreated(SurfaceHolder holder) { - Log.d(MD.TAG, "surfaceCreated: "+getX()+"/"+getY()+" "+getWidth()+"x"+getHeight()+" - on thread "+Thread.currentThread().getName()); + Log.d(MD.TAG, "surfaceCreated: "+getX()+"/"+getY()+" "+getSurfaceWidth()+"x"+getSurfaceHeight()+" - on thread "+Thread.currentThread().getName()); } @Override @@ -611,7 +615,7 @@ public class WindowDriver extends jogamp.newt.WindowImpl implements Callback2 { @Override public final void surfaceRedrawNeeded(SurfaceHolder holder) { Log.d(MD.TAG, "surfaceRedrawNeeded - on thread "+Thread.currentThread().getName()); - windowRepaint(0, 0, getWidth(), getHeight()); + windowRepaint(0, 0, getSurfaceWidth(), getSurfaceHeight()); } protected boolean handleKeyCodeBack(KeyEvent.DispatcherState state, android.view.KeyEvent event) { diff --git a/src/newt/classes/jogamp/newt/driver/awt/WindowDriver.java b/src/newt/classes/jogamp/newt/driver/awt/WindowDriver.java index 9854524d9..965426d4e 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(), getWidth(), getHeight(), getReconfigureFlags(FLAG_CHANGE_VISIBILITY | FLAG_CHANGE_DECORATION, true)); + reconfigureWindowImpl(getX(), getY(), getSurfaceWidth(), getSurfaceHeight(), getReconfigureFlags(FLAG_CHANGE_VISIBILITY | FLAG_CHANGE_DECORATION, true)); // throws exception if failed .. final NativeWindow nw = awtCanvas.getNativeWindow(); @@ -297,7 +297,7 @@ public class WindowDriver extends WindowImpl { System.err.println("Window Resized: "+awtCanvas); } WindowDriver.this.sizeChanged(false, awtCanvas.getWidth(), awtCanvas.getHeight(), true); - WindowDriver.this.windowRepaint(false, 0, 0, getWidth(), getHeight()); + WindowDriver.this.windowRepaint(false, 0, 0, getSurfaceWidth(), getSurfaceHeight()); } } @Override @@ -322,7 +322,7 @@ public class WindowDriver extends WindowImpl { if(DEBUG_IMPLEMENTATION) { System.err.println("Window Repaint: "+awtCanvas); } - WindowDriver.this.windowRepaint(false, 0, 0, getWidth(), getHeight()); + WindowDriver.this.windowRepaint(false, 0, 0, getSurfaceWidth(), getSurfaceHeight()); } } } 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 39f168e0f..5b0d21c66 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, getWidth(), getHeight())); + setWindowHandle(realizeWindow(true, getSurfaceWidth(), getSurfaceHeight())); 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:getWidth(), (height>0)?height:getHeight()); + defineSize((width>0)?width:getSurfaceWidth(), (height>0)?height:getSurfaceHeight()); } } 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 c3cb8a84c..817ce3aeb 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(), getWidth(), getHeight(), + nativeWindowHandle = CreateWindow0(display.getBCMHandle(), layer, getX(), getY(), getSurfaceWidth(), getSurfaceHeight(), 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 0e96c65d0..d86cf7471 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,7 @@ 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(), getWidth(), getHeight()); + surfaceHandle = CreateSurface(aDevice.getHandle(), getScreen().getWidth(), getScreen().getHeight(), getX(), getY(), getSurfaceWidth(), getSurfaceHeight()); 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 158e6ab2f..35e9227d3 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:getWidth(); - height=(height>0)?height:getHeight(); + width=(width>0)?width:getSurfaceWidth(); + height=(height>0)?height:getSurfaceHeight(); 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(getWidth(), getHeight()); + ((ScreenDriver)getScreen()).sizeChanged(getSurfaceWidth(), getSurfaceHeight()); } 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 e2a57debc..8f3eb1e89 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(), getWidth(), getHeight(), getReconfigureFlags(FLAG_CHANGE_VISIBILITY, true)); + reconfigureWindowImpl(getX(), getY(), getSurfaceWidth(), getSurfaceHeight(), getReconfigureFlags(FLAG_CHANGE_VISIBILITY, true)); if (0 == getWindowHandle()) { throw new NativeWindowException("Error creating window"); } @@ -236,7 +236,7 @@ public class WindowDriver extends WindowImpl implements MutableSurface, DriverCl if( 0 != handle && !isOffscreenInstance ) { final NativeWindow parent = getParent(); final boolean useParent = useParent(parent); - if( useParent && ( getWidth() != newWidth || getHeight() != newHeight ) ) { + if( useParent && ( getSurfaceWidth() != newWidth || getSurfaceHeight() != 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 a48fe2f62..0fc38f92d 100644 --- a/src/newt/classes/jogamp/newt/driver/windows/WindowDriver.java +++ b/src/newt/classes/jogamp/newt/driver/windows/WindowDriver.java @@ -145,7 +145,7 @@ 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(), getWidth(), getHeight(), autoPosition(), flags); + getParentWindowHandle(), getX(), getY(), getSurfaceWidth(), getSurfaceHeight(), autoPosition(), flags); if ( 0 == _windowHandle ) { throw new NativeWindowException("Error creating window"); } @@ -252,7 +252,7 @@ public class WindowDriver extends WindowImpl { public void run() { final Point p0 = getLocationOnScreenImpl(0, 0); res[0] = Boolean.valueOf(confinePointer0(getWindowHandle(), confine, - p0.getX(), p0.getY(), p0.getX()+getWidth(), p0.getY()+getHeight())); + p0.getX(), p0.getY(), p0.getX()+getSurfaceWidth(), p0.getY()+getSurfaceHeight())); } }); return res[0].booleanValue(); diff --git a/src/newt/classes/jogamp/newt/driver/x11/WindowDriver.java b/src/newt/classes/jogamp/newt/driver/x11/WindowDriver.java index 0eda37eac..2f4ccbfea 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(), getWidth(), getHeight(), autoPosition(), flags, + getX(), getY(), getSurfaceWidth(), getSurfaceHeight(), 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(), getWidth(), getHeight(), flags); + getX(), getY(), getSurfaceWidth(), getSurfaceHeight(), flags); return null; } }); diff --git a/src/test/com/jogamp/opengl/test/android/MovieSimpleActivity1.java b/src/test/com/jogamp/opengl/test/android/MovieSimpleActivity1.java index 1a81215ba..fc08301cb 100644 --- a/src/test/com/jogamp/opengl/test/android/MovieSimpleActivity1.java +++ b/src/test/com/jogamp/opengl/test/android/MovieSimpleActivity1.java @@ -123,7 +123,7 @@ public class MovieSimpleActivity1 extends NewtBaseActivity { glWindowMain.setSize(scrn.getWidth()-padding, scrn.getHeight()-padding); glWindowMain.setUndecorated(true); // setContentView(getWindow(), glWindowMain); - viewGroup.addView(androidView, new android.widget.FrameLayout.LayoutParams(glWindowMain.getWidth(), glWindowMain.getHeight(), Gravity.BOTTOM|Gravity.RIGHT)); + viewGroup.addView(androidView, new android.widget.FrameLayout.LayoutParams(glWindowMain.getSurfaceWidth(), glWindowMain.getSurfaceHeight(), Gravity.BOTTOM|Gravity.RIGHT)); registerNEWTWindow(glWindowMain); } anim.add(glWindowMain); @@ -219,7 +219,7 @@ public class MovieSimpleActivity1 extends NewtBaseActivity { public void run() { final android.view.View androidView = ((jogamp.newt.driver.android.WindowDriver)glWindowHUD.getDelegatedWindow()).getAndroidView(); // addContentView(getWindow(), glWindowHUD, new android.view.ViewGroup.LayoutParams(glWindowHUD.getWidth(), glWindowHUD.getHeight())); - viewGroup.addView(androidView, new android.widget.FrameLayout.LayoutParams(glWindowHUD.getWidth(), glWindowHUD.getHeight(), Gravity.TOP|Gravity.LEFT)); + viewGroup.addView(androidView, new android.widget.FrameLayout.LayoutParams(glWindowHUD.getSurfaceWidth(), glWindowHUD.getSurfaceHeight(), Gravity.TOP|Gravity.LEFT)); registerNEWTWindow(glWindowHUD); anim.add(glWindowHUD); glWindowHUD.setVisible(true); diff --git a/src/test/com/jogamp/opengl/test/bugs/Issue326Test2.java b/src/test/com/jogamp/opengl/test/bugs/Issue326Test2.java index ac5d819b3..2a8fd3a39 100644 --- a/src/test/com/jogamp/opengl/test/bugs/Issue326Test2.java +++ b/src/test/com/jogamp/opengl/test/bugs/Issue326Test2.java @@ -47,7 +47,7 @@ public class Issue326Test2 extends Frame implements GLEventListener { gl.glClearColor(0, 0, 0, 0); gl.glClear(GL2.GL_COLOR_BUFFER_BIT|GL2.GL_DEPTH_BUFFER_BIT); - tr.beginRendering(drawable.getWidth(), drawable.getHeight()); + tr.beginRendering(drawable.getSurfaceWidth(), drawable.getSurfaceHeight()); tr.draw("LA CLAPI\u00c8RE \nAlt: 1100-1700m \nGlissement de terrain majeur", 16, 80); tr.draw("dans la haute Tin\u00e9e, sur un flanc du Parc du Mercantour.", 16, 16); tr.endRendering(); diff --git a/src/test/com/jogamp/opengl/test/junit/graph/TestTextRendererNEWT00.java b/src/test/com/jogamp/opengl/test/junit/graph/TestTextRendererNEWT00.java index ae435961e..ad95b3502 100644 --- a/src/test/com/jogamp/opengl/test/junit/graph/TestTextRendererNEWT00.java +++ b/src/test/com/jogamp/opengl/test/junit/graph/TestTextRendererNEWT00.java @@ -334,7 +334,7 @@ public class TestTextRendererNEWT00 extends UITestCase { final String modeS = Region.getRenderModeString(renderModes); final String bname = String.format("%s-msaa%02d-fontsz%02.1f-%03dx%03d-%s%04d", objName, drawable.getChosenGLCapabilities().getNumSamples(), - TestTextRendererNEWT00.fontSizeFixed, drawable.getWidth(), drawable.getHeight(), modeS, vbaaSampleCount[0]); + TestTextRendererNEWT00.fontSizeFixed, drawable.getSurfaceWidth(), drawable.getSurfaceHeight(), modeS, vbaaSampleCount[0]); final String filename = dir + bname +".png"; if(screenshot.readPixels(drawable.getGL(), false)) { screenshot.write(new File(filename)); diff --git a/src/test/com/jogamp/opengl/test/junit/graph/TestTextRendererNEWT10.java b/src/test/com/jogamp/opengl/test/junit/graph/TestTextRendererNEWT10.java index 0235a78c2..de71f65d3 100644 --- a/src/test/com/jogamp/opengl/test/junit/graph/TestTextRendererNEWT10.java +++ b/src/test/com/jogamp/opengl/test/junit/graph/TestTextRendererNEWT10.java @@ -150,10 +150,10 @@ public class TestTextRendererNEWT10 extends UITestCase { rs.setColorStatic(0.1f, 0.1f, 0.1f, 1.0f); // reshape - gl.glViewport(0, 0, drawable.getWidth(), drawable.getHeight()); + gl.glViewport(0, 0, drawable.getSurfaceWidth(), drawable.getSurfaceHeight()); // renderer.reshapePerspective(gl, 45.0f, drawable.getWidth(), drawable.getHeight(), 0.1f, 1000.0f); - renderer.reshapeOrtho(drawable.getWidth(), drawable.getHeight(), 0.1f, 1000.0f); + renderer.reshapeOrtho(drawable.getSurfaceWidth(), drawable.getSurfaceHeight(), 0.1f, 1000.0f); // display gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT); @@ -181,7 +181,7 @@ public class TestTextRendererNEWT10 extends UITestCase { int lastRow = -1; void renderString(GLDrawable drawable, GL2ES2 gl, RegionRenderer renderer, TextRegionUtil textRenderUtil, String text, int column, int row, int z0) { - final int height = drawable.getHeight(); + final int height = drawable.getSurfaceHeight(); int dx = 0; int dy = height; diff --git a/src/test/com/jogamp/opengl/test/junit/graph/TextRendererGLELBase.java b/src/test/com/jogamp/opengl/test/junit/graph/TextRendererGLELBase.java index ebd526899..f948b9beb 100644 --- a/src/test/com/jogamp/opengl/test/junit/graph/TextRendererGLELBase.java +++ b/src/test/com/jogamp/opengl/test/junit/graph/TextRendererGLELBase.java @@ -246,7 +246,7 @@ public abstract class TextRendererGLELBase implements GLEventListener { if( !exclusivePMVMatrix ) { dy = 1f-ty; } else { - final int height = drawable.getHeight(); + final int height = drawable.getSurfaceHeight(); dy = height-ty; } final int newLineCount = TextRegionUtil.getCharCount(text, '\n'); diff --git a/src/test/com/jogamp/opengl/test/junit/graph/demos/GPURendererListenerBase01.java b/src/test/com/jogamp/opengl/test/junit/graph/demos/GPURendererListenerBase01.java index 72c2509cc..ef72b3d45 100644 --- a/src/test/com/jogamp/opengl/test/junit/graph/demos/GPURendererListenerBase01.java +++ b/src/test/com/jogamp/opengl/test/junit/graph/demos/GPURendererListenerBase01.java @@ -234,7 +234,7 @@ public abstract class GPURendererListenerBase01 implements GLEventListener { public void printScreen(GLAutoDrawable drawable, String dir, String tech, String objName, boolean exportAlpha) throws GLException, IOException { StringWriter sw = new StringWriter(); PrintWriter pw = new PrintWriter(sw); - pw.printf("-%03dx%03d-Z%04d-S%02d-%s", drawable.getWidth(), drawable.getHeight(), (int)Math.abs(zTran), sampleCount[0], objName); + pw.printf("-%03dx%03d-Z%04d-S%02d-%s", drawable.getSurfaceWidth(), drawable.getSurfaceHeight(), (int)Math.abs(zTran), sampleCount[0], objName); final String filename = dir + tech + sw +".png"; if(screenshot.readPixels(drawable.getGL(), false)) { diff --git a/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUTextRendererListenerBase01.java b/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUTextRendererListenerBase01.java index 891151e38..89aa4d0ee 100644 --- a/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUTextRendererListenerBase01.java +++ b/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUTextRendererListenerBase01.java @@ -199,8 +199,8 @@ public abstract class GPUTextRendererListenerBase01 extends GPURendererListenerB @Override public void display(GLAutoDrawable drawable) { - final int width = drawable.getWidth(); - final int height = drawable.getHeight(); + final int width = drawable.getSurfaceWidth(); + final int height = drawable.getSurfaceHeight(); GL2ES2 gl = drawable.getGL().getGL2ES2(); gl.glClearColor(1.0f, 1.0f, 1.0f, 1.0f); diff --git a/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUUISceneGLListener0A.java b/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUUISceneGLListener0A.java index a2c3faecf..b52668294 100644 --- a/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUUISceneGLListener0A.java +++ b/src/test/com/jogamp/opengl/test/junit/graph/demos/GPUUISceneGLListener0A.java @@ -631,7 +631,7 @@ public class GPUUISceneGLListener0A implements GLEventListener { sceneUIController.setRenderer(renderer); - final float pixelSizeFixed = fontSizeFixedPVP * drawable.getHeight(); + final float pixelSizeFixed = fontSizeFixedPVP * drawable.getSurfaceHeight(); jogampLabel = new Label(renderer.getRenderState().getVertexFactory(), renderModes, font, pixelSizeFixed, jogamp); jogampLabel.addMouseListener(dragZoomRotateListener); sceneUIController.addShape(jogampLabel); @@ -650,7 +650,7 @@ public class GPUUISceneGLListener0A implements GLEventListener { * [Label] Display 112.88889 dpi, fontSize 12.0 ppi -> pixelSize 18.814816 * [FPS] Display 112.88889 dpi, fontSize 12.0 ppi -> pixelSize 15.679012 */ - final float pixelSizeFPS = fontSizeFpsPVP * drawable.getHeight(); + final float pixelSizeFPS = fontSizeFpsPVP * drawable.getSurfaceHeight(); fpsLabel = new Label(renderer.getRenderState().getVertexFactory(), renderModes, font, pixelSizeFPS, "Nothing there yet"); fpsLabel.addMouseListener(dragZoomRotateListener); sceneUIController.addShape(fpsLabel); @@ -663,7 +663,7 @@ public class GPUUISceneGLListener0A implements GLEventListener { crossHairCtr.setEnabled(true); crossHairCtr.translate(0f, 0f, -1f); - initButtons(gl, drawable.getWidth(), drawable.getHeight(), renderer); + initButtons(gl, drawable.getSurfaceWidth(), drawable.getSurfaceHeight(), renderer); for(int i=0; i<buttons.size(); i++) { sceneUIController.addShape(buttons.get(i)); } @@ -713,9 +713,9 @@ public class GPUUISceneGLListener0A implements GLEventListener { final GL2ES2 gl = drawable.getGL().getGL2ES2(); if(null == labels[currentText]) { - final float pixelSizeFixed = fontSizeFixedPVP * drawable.getHeight(); - final float dyTop = drawable.getHeight() - 2f*jogampLabel.getLineHeight(); - final float dxRight = drawable.getWidth() * relMiddle; + final float pixelSizeFixed = fontSizeFixedPVP * drawable.getSurfaceHeight(); + final float dyTop = drawable.getSurfaceHeight() - 2f*jogampLabel.getLineHeight(); + final float dxRight = drawable.getSurfaceWidth() * relMiddle; labels[currentText] = new Label(renderer.getRenderState().getVertexFactory(), renderModes, font, pixelSizeFixed, strings[currentText]); labels[currentText].setColor(0.1f, 0.1f, 0.1f, 1.0f); labels[currentText].setEnabled(enableOthers); @@ -780,7 +780,7 @@ public class GPUUISceneGLListener0A implements GLEventListener { for(int i=buttonsLeftCount; i<buttons.size(); i++) { buttons.get(i).translate(dxRight, dyTop, dz); } - final float dyTopLabel = drawable.getHeight() - 2f*jogampLabel.getLineHeight(); + final float dyTopLabel = drawable.getSurfaceHeight() - 2f*jogampLabel.getLineHeight(); jogampLabel.translate(dxMiddle, dyTopLabel, dz); truePtSizeLabel.translate(dxMiddle, dyTopLabel, dz); fpsLabel.translate(0f, 0f, 0f); 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 9eb32c6f8..ae2cf6c5a 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 @@ -110,7 +110,7 @@ public class GLEventListenerButton extends TextureSeqButton { final FBObject.TextureAttachment texA01 = fboGLAD.getTextureBuffer(GL.GL_FRONT); final Texture tex = new Texture(texA01.getName(), imgSeq.getTextureTarget(), - fboGLAD.getWidth(), fboGLAD.getHeight(), fboGLAD.getWidth(), fboGLAD.getHeight(), + fboGLAD.getSurfaceWidth(), fboGLAD.getSurfaceHeight(), fboGLAD.getSurfaceWidth(), fboGLAD.getSurfaceHeight(), false /* mustFlipVertically */); imgSeq.addFrame(gl, tex); markStateDirty(); diff --git a/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/UIListenerBase01.java b/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/UIListenerBase01.java index 638ddac3c..a2bc57a8b 100644 --- a/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/UIListenerBase01.java +++ b/src/test/com/jogamp/opengl/test/junit/graph/demos/ui/UIListenerBase01.java @@ -180,7 +180,7 @@ public abstract class UIListenerBase01 implements GLEventListener { public void printScreen(GLAutoDrawable drawable, String dir, String tech, String objName, boolean exportAlpha) throws GLException, IOException { StringWriter sw = new StringWriter(); PrintWriter pw = new PrintWriter(sw); - pw.printf("-%03dx%03d-Z%04d-T%04d-%s", drawable.getWidth(), drawable.getHeight(), (int)Math.abs(zoom), 0, objName); + pw.printf("-%03dx%03d-Z%04d-T%04d-%s", drawable.getSurfaceWidth(), drawable.getSurfaceHeight(), (int)Math.abs(zoom), 0, objName); final String filename = dir + tech + sw +".png"; if(screenshot.readPixels(drawable.getGL(), false)) { diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/GLReadBuffer00Base.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/GLReadBuffer00Base.java index 35b2242ae..f4504dbc7 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/GLReadBuffer00Base.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/GLReadBuffer00Base.java @@ -79,7 +79,7 @@ public abstract class GLReadBuffer00Base extends UITestCase { @Override public void display(GLAutoDrawable drawable) { - final String text = String.format("Frame %04d (%03d): %04dx%04d", frameNo, userCounter, drawable.getWidth(), drawable.getHeight()); + final String text = String.format("Frame %04d (%03d): %04dx%04d", frameNo, userCounter, drawable.getSurfaceWidth(), drawable.getSurfaceHeight()); System.err.println("TextRendererGLEL.display: "+text); if( null != renderer ) { final float pixelSize = font.getPixelSize(14f, dpiH); 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 cc06136d6..3ad1b90dc 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 @@ -266,7 +266,7 @@ public class TestFBOAutoDrawableFactoryNEWT extends UITestCase { // 2, 3 (resize + display) szStep = 1; glad.setSize(widthStep*szStep, heightStep*szStep); // SWAP_EVEN - Assert.assertTrue("Size not reached: Expected "+(widthStep*szStep)+"x"+(heightStep*szStep)+", Is "+glad.getWidth()+"x"+glad.getHeight(), + 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(); glad.display(); // - SWAP_ODD @@ -310,7 +310,7 @@ public class TestFBOAutoDrawableFactoryNEWT extends UITestCase { // 4, 5 (resize + display) szStep = 4; glad.setSize(widthStep*szStep, heightStep*szStep); // SWAP_ODD - Assert.assertTrue("Size not reached: Expected "+(widthStep*szStep)+"x"+(heightStep*szStep)+", Is "+glad.getWidth()+"x"+glad.getHeight(), + 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(); glad.display(); // - SWAP_EVEN @@ -362,7 +362,7 @@ public class TestFBOAutoDrawableFactoryNEWT extends UITestCase { // 8, 9 (resize + samples + display) szStep = 3; glad.setSize(widthStep*szStep, heightStep*szStep); - Assert.assertTrue("Size not reached: Expected "+(widthStep*szStep)+"x"+(heightStep*szStep)+", Is "+glad.getWidth()+"x"+glad.getHeight(), + 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(); glad.display(); diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestFBOMRTNEWT01.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestFBOMRTNEWT01.java index 7ec8715a4..49db27af9 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestFBOMRTNEWT01.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestFBOMRTNEWT01.java @@ -166,7 +166,7 @@ public class TestFBOMRTNEWT01 extends UITestCase { // FBO w/ 2 texture2D color buffers final FBObject fbo_mrt = new FBObject(); - fbo_mrt.reset(gl, drawable.getWidth(), drawable.getHeight()); + fbo_mrt.reset(gl, drawable.getSurfaceWidth(), drawable.getSurfaceHeight()); final TextureAttachment texA0 = fbo_mrt.attachTexture2D(gl, texA0Point, true, GL.GL_NEAREST, GL.GL_NEAREST, GL.GL_CLAMP_TO_EDGE, GL.GL_CLAMP_TO_EDGE); final TextureAttachment texA1; if(fbo_mrt.getMaxColorAttachments() > 1) { @@ -224,7 +224,7 @@ public class TestFBOMRTNEWT01 extends UITestCase { texCoords0.enableBuffer(gl, true); gl.glDrawBuffers(1, bck_buffers, 0); - gl.glViewport(0, 0, drawable.getWidth(), drawable.getHeight()); + gl.glViewport(0, 0, drawable.getSurfaceWidth(), drawable.getSurfaceHeight()); gl.glActiveTexture(GL.GL_TEXTURE0 + texUnit0.intValue()); fbo_mrt.use(gl, texA0); @@ -241,11 +241,11 @@ public class TestFBOMRTNEWT01 extends UITestCase { { final NativeSurface ns = gl.getContext().getGLReadDrawable().getNativeSurface(); - if(last_snap_size[0] != ns.getWidth() && last_snap_size[1] != ns.getHeight()) { + if(last_snap_size[0] != ns.getSurfaceWidth() && last_snap_size[1] != ns.getSurfaceHeight()) { gl.glFinish(); // sync .. no swap buffers yet! snapshot(step_i, null, gl, screenshot, TextureIO.PNG, null); // overwrite ok - last_snap_size[0] = ns.getWidth(); - last_snap_size[1] = ns.getHeight(); + last_snap_size[0] = ns.getSurfaceWidth(); + last_snap_size[1] = ns.getSurfaceHeight(); } } diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestFBOMix2DemosES2NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestFBOMix2DemosES2NEWT.java index 42f7ba652..d337bf938 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestFBOMix2DemosES2NEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestFBOMix2DemosES2NEWT.java @@ -102,8 +102,8 @@ public class TestFBOMix2DemosES2NEWT extends UITestCase { public void display(GLAutoDrawable drawable) { if(mainRun) return; - final int dw = drawable.getWidth(); - final int dh = drawable.getHeight(); + final int dw = drawable.getSurfaceWidth(); + final int dh = drawable.getSurfaceHeight(); c++; if(dw<800) { @@ -147,10 +147,10 @@ public class TestFBOMix2DemosES2NEWT extends UITestCase { glWindow.addWindowListener(new WindowAdapter() { public void windowResized(WindowEvent e) { - System.err.println("window resized: "+glWindow.getX()+"/"+glWindow.getY()+" "+glWindow.getWidth()+"x"+glWindow.getHeight()); + System.err.println("window resized: "+glWindow.getX()+"/"+glWindow.getY()+" "+glWindow.getSurfaceWidth()+"x"+glWindow.getSurfaceHeight()); } public void windowMoved(WindowEvent e) { - System.err.println("window moved: "+glWindow.getX()+"/"+glWindow.getY()+" "+glWindow.getWidth()+"x"+glWindow.getHeight()); + System.err.println("window moved: "+glWindow.getX()+"/"+glWindow.getY()+" "+glWindow.getSurfaceWidth()+"x"+glWindow.getSurfaceHeight()); } }); @@ -163,9 +163,9 @@ public class TestFBOMix2DemosES2NEWT extends UITestCase { if(e.getKeyChar()=='f') { new Thread() { public void run() { - System.err.println("[set fullscreen pre]: "+glWindow.getX()+"/"+glWindow.getY()+" "+glWindow.getWidth()+"x"+glWindow.getHeight()+", f "+glWindow.isFullscreen()+", a "+glWindow.isAlwaysOnTop()+", "+glWindow.getInsets()); + System.err.println("[set fullscreen pre]: "+glWindow.getX()+"/"+glWindow.getY()+" "+glWindow.getSurfaceWidth()+"x"+glWindow.getSurfaceHeight()+", f "+glWindow.isFullscreen()+", a "+glWindow.isAlwaysOnTop()+", "+glWindow.getInsets()); glWindow.setFullscreen(!glWindow.isFullscreen()); - System.err.println("[set fullscreen post]: "+glWindow.getX()+"/"+glWindow.getY()+" "+glWindow.getWidth()+"x"+glWindow.getHeight()+", f "+glWindow.isFullscreen()+", a "+glWindow.isAlwaysOnTop()+", "+glWindow.getInsets()); + System.err.println("[set fullscreen post]: "+glWindow.getX()+"/"+glWindow.getY()+" "+glWindow.getSurfaceWidth()+"x"+glWindow.getSurfaceHeight()+", f "+glWindow.isFullscreen()+", a "+glWindow.isAlwaysOnTop()+", "+glWindow.getInsets()); } }.start(); } else if(e.getKeyChar()=='d') { demo.setDemo0Only(!demo.getDemo0Only()); @@ -187,7 +187,7 @@ public class TestFBOMix2DemosES2NEWT extends UITestCase { System.err.println("NW chosen: "+glWindow.getDelegatedWindow().getChosenCapabilities()); System.err.println("GL chosen: "+glWindow.getChosenCapabilities()); - System.err.println("window pos/siz: "+glWindow.getX()+"/"+glWindow.getY()+" "+glWindow.getWidth()+"x"+glWindow.getHeight()+", "+glWindow.getInsets()); + System.err.println("window pos/siz: "+glWindow.getX()+"/"+glWindow.getY()+" "+glWindow.getSurfaceWidth()+"x"+glWindow.getSurfaceHeight()+", "+glWindow.getInsets()); animator.setUpdateFPSFrames(60, showFPS ? System.err : null); 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 51dd9df37..f1c019f2c 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 @@ -134,7 +134,7 @@ public class TestFBOOffThreadSharedContextMix2DemosES2NEWT extends UITestCase { // FBOD1 final GLOffscreenAutoDrawable.FBO fbod1 = (GLOffscreenAutoDrawable.FBO) - factory.createOffscreenAutoDrawable(null, fbodCaps, null, glWindow.getWidth(), glWindow.getHeight()); + factory.createOffscreenAutoDrawable(null, fbodCaps, null, glWindow.getSurfaceWidth(), glWindow.getSurfaceHeight()); fbod1.setSharedAutoDrawable(glWindow); fbod1.setUpstreamWidget(glWindow); // connect the real GLWindow (mouse/key) to offscreen! fbod1.setTextureUnit(fbod1_texUnit); @@ -155,7 +155,7 @@ public class TestFBOOffThreadSharedContextMix2DemosES2NEWT extends UITestCase { // FBOD2 final GLOffscreenAutoDrawable.FBO fbod2 = (GLOffscreenAutoDrawable.FBO) - factory.createOffscreenAutoDrawable(null, fbodCaps, null, glWindow.getWidth(), glWindow.getHeight()); + factory.createOffscreenAutoDrawable(null, fbodCaps, null, glWindow.getSurfaceWidth(), glWindow.getSurfaceHeight()); fbod2.setSharedAutoDrawable(glWindow); fbod2.setTextureUnit(fbod2_texUnit); fbod2.addGLEventListener(new RedSquareES2(-1)); @@ -181,8 +181,8 @@ public class TestFBOOffThreadSharedContextMix2DemosES2NEWT extends UITestCase { public void display(GLAutoDrawable drawable) { if(mainRun) return; - final int dw = drawable.getWidth(); - final int dh = drawable.getHeight(); + final int dw = drawable.getSurfaceWidth(); + final int dh = drawable.getSurfaceHeight(); c++; if(dw<800) { @@ -222,10 +222,10 @@ public class TestFBOOffThreadSharedContextMix2DemosES2NEWT extends UITestCase { glWindow.addWindowListener(new WindowAdapter() { public void windowResized(WindowEvent e) { - System.err.println("window resized: "+glWindow.getX()+"/"+glWindow.getY()+" "+glWindow.getWidth()+"x"+glWindow.getHeight()); + System.err.println("window resized: "+glWindow.getX()+"/"+glWindow.getY()+" "+glWindow.getSurfaceWidth()+"x"+glWindow.getSurfaceHeight()); } public void windowMoved(WindowEvent e) { - System.err.println("window moved: "+glWindow.getX()+"/"+glWindow.getY()+" "+glWindow.getWidth()+"x"+glWindow.getHeight()); + System.err.println("window moved: "+glWindow.getX()+"/"+glWindow.getY()+" "+glWindow.getSurfaceWidth()+"x"+glWindow.getSurfaceHeight()); } }); @@ -237,7 +237,7 @@ public class TestFBOOffThreadSharedContextMix2DemosES2NEWT extends UITestCase { System.err.println("NW chosen: "+glWindow.getDelegatedWindow().getChosenCapabilities()); System.err.println("GL chosen: "+glWindow.getChosenCapabilities()); - System.err.println("window pos/siz: "+glWindow.getX()+"/"+glWindow.getY()+" "+glWindow.getWidth()+"x"+glWindow.getHeight()+", "+glWindow.getInsets()); + System.err.println("window pos/siz: "+glWindow.getX()+"/"+glWindow.getY()+" "+glWindow.getSurfaceWidth()+"x"+glWindow.getSurfaceHeight()+", "+glWindow.getInsets()); animator0.setUpdateFPSFrames(30, showFPS ? System.err : null); animator1.setUpdateFPSFrames(60, showFPS ? System.err : null); 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 3c6c61f80..baa8a965b 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 @@ -131,7 +131,7 @@ public class TestFBOOnThreadSharedContext1DemoES2NEWT extends UITestCase { // FBOD1 final GLOffscreenAutoDrawable.FBO fbod1 = (GLOffscreenAutoDrawable.FBO) - factory.createOffscreenAutoDrawable(null, fbodCaps, null, glWindow.getWidth(), glWindow.getHeight()); + factory.createOffscreenAutoDrawable(null, fbodCaps, null, glWindow.getSurfaceWidth(), glWindow.getSurfaceHeight()); fbod1.setSharedAutoDrawable(glWindow); fbod1.setUpstreamWidget(glWindow); // connect the real GLWindow (mouse/key) to offscreen! fbod1.setTextureUnit(fbod1_texUnit); @@ -156,7 +156,7 @@ public class TestFBOOnThreadSharedContext1DemoES2NEWT extends UITestCase { glWindow.addWindowListener(new WindowAdapter() { @Override public void windowResized(WindowEvent e) { - fbod1.setSize(glWindow.getWidth(), glWindow.getHeight()); + fbod1.setSize(glWindow.getSurfaceWidth(), glWindow.getSurfaceHeight()); } }); glWindow.addGLEventListener(mixerDemo); @@ -167,8 +167,8 @@ public class TestFBOOnThreadSharedContext1DemoES2NEWT extends UITestCase { public void display(GLAutoDrawable drawable) { if(mainRun) return; - final int dw = drawable.getWidth(); - final int dh = drawable.getHeight(); + final int dw = drawable.getSurfaceWidth(); + final int dh = drawable.getSurfaceHeight(); c++; if(dw<800) { @@ -202,10 +202,10 @@ public class TestFBOOnThreadSharedContext1DemoES2NEWT extends UITestCase { glWindow.addWindowListener(new WindowAdapter() { public void windowResized(WindowEvent e) { - System.err.println("window resized: "+glWindow.getX()+"/"+glWindow.getY()+" "+glWindow.getWidth()+"x"+glWindow.getHeight()); + System.err.println("window resized: "+glWindow.getX()+"/"+glWindow.getY()+" "+glWindow.getSurfaceWidth()+"x"+glWindow.getSurfaceHeight()); } public void windowMoved(WindowEvent e) { - System.err.println("window moved: "+glWindow.getX()+"/"+glWindow.getY()+" "+glWindow.getWidth()+"x"+glWindow.getHeight()); + System.err.println("window moved: "+glWindow.getX()+"/"+glWindow.getY()+" "+glWindow.getSurfaceWidth()+"x"+glWindow.getSurfaceHeight()); } }); @@ -216,7 +216,7 @@ public class TestFBOOnThreadSharedContext1DemoES2NEWT extends UITestCase { System.err.println("NW chosen: "+glWindow.getDelegatedWindow().getChosenCapabilities()); System.err.println("GL chosen: "+glWindow.getChosenCapabilities()); - System.err.println("window pos/siz: "+glWindow.getX()+"/"+glWindow.getY()+" "+glWindow.getWidth()+"x"+glWindow.getHeight()+", "+glWindow.getInsets()); + System.err.println("window pos/siz: "+glWindow.getX()+"/"+glWindow.getY()+" "+glWindow.getSurfaceWidth()+"x"+glWindow.getSurfaceHeight()+", "+glWindow.getInsets()); animator1.setUpdateFPSFrames(60, showFPS ? System.err : null); diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLAutoDrawableDelegateNEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLAutoDrawableDelegateNEWT.java index 91bae16d7..597d72269 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLAutoDrawableDelegateNEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLAutoDrawableDelegateNEWT.java @@ -111,7 +111,7 @@ public class TestGLAutoDrawableDelegateNEWT extends UITestCase { @Override public void windowResized(WindowEvent e) { - glad.windowResizedOp(window.getWidth(), window.getHeight()); + glad.windowResizedOp(window.getSurfaceWidth(), window.getSurfaceHeight()); } }); diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLAutoDrawableDelegateOnOffscrnCapsNEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLAutoDrawableDelegateOnOffscrnCapsNEWT.java index 3d49a0dce..82fa6422d 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLAutoDrawableDelegateOnOffscrnCapsNEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLAutoDrawableDelegateOnOffscrnCapsNEWT.java @@ -185,7 +185,7 @@ public class TestGLAutoDrawableDelegateOnOffscrnCapsNEWT extends UITestCase { @Override public void windowResized(WindowEvent e) { - glad.windowResizedOp(window.getWidth(), window.getHeight()); + glad.windowResizedOp(window.getSurfaceWidth(), window.getSurfaceHeight()); } }); @@ -197,7 +197,7 @@ public class TestGLAutoDrawableDelegateOnOffscrnCapsNEWT extends UITestCase { glad.display(); // initial resize/display // 1 - szStep = 2 - Assert.assertTrue("Size not reached: Expected "+(widthStep*szStep)+"x"+(heightStep*szStep)+", Is "+glad.getWidth()+"x"+glad.getHeight(), + 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(); glad.display(); @@ -205,7 +205,7 @@ public class TestGLAutoDrawableDelegateOnOffscrnCapsNEWT extends UITestCase { // 2, 3 (resize + display) szStep = 1; window.setSize(widthStep*szStep, heightStep*szStep); - Assert.assertTrue("Size not reached: Expected "+(widthStep*szStep)+"x"+(heightStep*szStep)+", Is "+glad.getWidth()+"x"+glad.getHeight(), + 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(); glad.display(); @@ -213,7 +213,7 @@ public class TestGLAutoDrawableDelegateOnOffscrnCapsNEWT extends UITestCase { // 4, 5 (resize + display) szStep = 4; window.setSize(widthStep*szStep, heightStep*szStep); - Assert.assertTrue("Size not reached: Expected "+(widthStep*szStep)+"x"+(heightStep*szStep)+", Is "+glad.getWidth()+"x"+glad.getHeight(), + 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(); glad.display(); 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 a5799a6cb..33c0508a1 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 @@ -127,7 +127,7 @@ public class TestGLAutoDrawableFactoryES2OffscrnCapsNEWT extends UITestCase { glad.display(); // initial resize/display // 1 - szStep = 2 - Assert.assertTrue("Size not reached: Expected "+(widthStep*szStep)+"x"+(heightStep*szStep)+", Is "+glad.getWidth()+"x"+glad.getHeight(), + 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(); glad.display(); @@ -135,7 +135,7 @@ public class TestGLAutoDrawableFactoryES2OffscrnCapsNEWT extends UITestCase { // 2, 3 (resize + display) szStep = 1; glad.setSize(widthStep*szStep, heightStep*szStep); - Assert.assertTrue("Size not reached: Expected "+(widthStep*szStep)+"x"+(heightStep*szStep)+", Is "+glad.getWidth()+"x"+glad.getHeight(), + 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(); glad.display(); @@ -143,7 +143,7 @@ public class TestGLAutoDrawableFactoryES2OffscrnCapsNEWT extends UITestCase { // 4, 5 (resize + display) szStep = 4; glad.setSize(widthStep*szStep, heightStep*szStep); - Assert.assertTrue("Size not reached: Expected "+(widthStep*szStep)+"x"+(heightStep*szStep)+", Is "+glad.getWidth()+"x"+glad.getHeight(), + 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(); glad.display(); 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 09e211332..f482a4468 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 @@ -127,7 +127,7 @@ public class TestGLAutoDrawableFactoryGL2OffscrnCapsNEWT extends UITestCase { glad.display(); // initial resize/display // 1 - szStep = 2 - Assert.assertTrue("Size not reached: Expected "+(widthStep*szStep)+"x"+(heightStep*szStep)+", Is "+glad.getWidth()+"x"+glad.getHeight(), + 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(); glad.display(); @@ -135,7 +135,7 @@ public class TestGLAutoDrawableFactoryGL2OffscrnCapsNEWT extends UITestCase { // 2, 3 (resize + display) szStep = 1; glad.setSize(widthStep*szStep, heightStep*szStep); - Assert.assertTrue("Size not reached: Expected "+(widthStep*szStep)+"x"+(heightStep*szStep)+", Is "+glad.getWidth()+"x"+glad.getHeight(), + 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(); glad.display(); @@ -143,7 +143,7 @@ public class TestGLAutoDrawableFactoryGL2OffscrnCapsNEWT extends UITestCase { // 4, 5 (resize + display) szStep = 4; glad.setSize(widthStep*szStep, heightStep*szStep); - Assert.assertTrue("Size not reached: Expected "+(widthStep*szStep)+"x"+(heightStep*szStep)+", Is "+glad.getWidth()+"x"+glad.getHeight(), + 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(); glad.display(); 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 f35f8c8b0..2f3c8c7e8 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 @@ -119,7 +119,7 @@ public class TestGLAutoDrawableFactoryGLnBitmapCapsNEWT extends UITestCase { glad.display(); // initial resize/display // 1 - szStep = 2 - Assert.assertTrue("Size not reached: Expected "+(widthStep*szStep)+"x"+(heightStep*szStep)+", Is "+glad.getWidth()+"x"+glad.getHeight(), + 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(); glad.display(); @@ -127,7 +127,7 @@ public class TestGLAutoDrawableFactoryGLnBitmapCapsNEWT extends UITestCase { // 2, 3 (resize + display) szStep = 1; glad.setSize(widthStep*szStep, heightStep*szStep); - Assert.assertTrue("Size not reached: Expected "+(widthStep*szStep)+"x"+(heightStep*szStep)+", Is "+glad.getWidth()+"x"+glad.getHeight(), + 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(); glad.display(); @@ -135,7 +135,7 @@ public class TestGLAutoDrawableFactoryGLnBitmapCapsNEWT extends UITestCase { // 4, 5 (resize + display) szStep = 4; glad.setSize(widthStep*szStep, heightStep*szStep); - Assert.assertTrue("Size not reached: Expected "+(widthStep*szStep)+"x"+(heightStep*szStep)+", Is "+glad.getWidth()+"x"+glad.getHeight(), + 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(); glad.display(); diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLAutoDrawableGLCanvasOnOffscrnCapsAWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLAutoDrawableGLCanvasOnOffscrnCapsAWT.java index ab64b5def..888572444 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLAutoDrawableGLCanvasOnOffscrnCapsAWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLAutoDrawableGLCanvasOnOffscrnCapsAWT.java @@ -196,7 +196,7 @@ public class TestGLAutoDrawableGLCanvasOnOffscrnCapsAWT extends UITestCase { glad.display(); // initial resize/display // 1 - szStep = 2 - Assert.assertTrue("Size not reached: Expected "+(widthStep*szStep)+"x"+(heightStep*szStep)+", Is "+glad.getWidth()+"x"+glad.getHeight(), + 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(); glad.display(); @@ -204,7 +204,7 @@ public class TestGLAutoDrawableGLCanvasOnOffscrnCapsAWT extends UITestCase { // 2, 3 (resize + display) szStep = 1; setGLCanvasSize(frame, glad, widthStep*szStep, heightStep*szStep); - Assert.assertTrue("Size not reached: Expected "+(widthStep*szStep)+"x"+(heightStep*szStep)+", Is "+glad.getWidth()+"x"+glad.getHeight(), + Assert.assertTrue("Size not reached: Expected "+(widthStep*szStep)+"x"+(heightStep*szStep)+", Is "+glad.getSurfaceWidth()+"x"+glad.getSurfaceHeight(), AWTRobotUtil.waitForSize(glad, widthStep*szStep, heightStep*szStep)); glad.display(); snapshotGLEventListener.setMakeSnapshot(); @@ -213,7 +213,7 @@ public class TestGLAutoDrawableGLCanvasOnOffscrnCapsAWT extends UITestCase { // 4, 5 (resize + display) szStep = 4; setGLCanvasSize(frame, glad, widthStep*szStep, heightStep*szStep); - Assert.assertTrue("Size not reached: Expected "+(widthStep*szStep)+"x"+(heightStep*szStep)+", Is "+glad.getWidth()+"x"+glad.getHeight(), + Assert.assertTrue("Size not reached: Expected "+(widthStep*szStep)+"x"+(heightStep*szStep)+", Is "+glad.getSurfaceWidth()+"x"+glad.getSurfaceHeight(), AWTRobotUtil.waitForSize(glad, widthStep*szStep, heightStep*szStep)); glad.display(); snapshotGLEventListener.setMakeSnapshot(); diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLAutoDrawableGLWindowOnOffscrnCapsNEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLAutoDrawableGLWindowOnOffscrnCapsNEWT.java index 9332b0f2e..4cdbb6fb0 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLAutoDrawableGLWindowOnOffscrnCapsNEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLAutoDrawableGLWindowOnOffscrnCapsNEWT.java @@ -152,7 +152,7 @@ public class TestGLAutoDrawableGLWindowOnOffscrnCapsNEWT extends UITestCase { glad.display(); // initial resize/display // 1 - szStep = 2 - Assert.assertTrue("Size not reached: Expected "+(widthStep*szStep)+"x"+(heightStep*szStep)+", Is "+glad.getWidth()+"x"+glad.getHeight(), + 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(); glad.display(); @@ -160,7 +160,7 @@ public class TestGLAutoDrawableGLWindowOnOffscrnCapsNEWT extends UITestCase { // 2, 3 (resize + display) szStep = 1; glad.setSize(widthStep*szStep, heightStep*szStep); - Assert.assertTrue("Size not reached: Expected "+(widthStep*szStep)+"x"+(heightStep*szStep)+", Is "+glad.getWidth()+"x"+glad.getHeight(), + 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(); glad.display(); @@ -168,7 +168,7 @@ public class TestGLAutoDrawableGLWindowOnOffscrnCapsNEWT extends UITestCase { // 4, 5 (resize + display) szStep = 4; glad.setSize(widthStep*szStep, heightStep*szStep); - Assert.assertTrue("Size not reached: Expected "+(widthStep*szStep)+"x"+(heightStep*szStep)+", Is "+glad.getWidth()+"x"+glad.getHeight(), + 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(); glad.display(); diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLAutoDrawableNewtCanvasAWTOnOffscrnCapsAWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLAutoDrawableNewtCanvasAWTOnOffscrnCapsAWT.java index ae5dc614b..22a515f42 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLAutoDrawableNewtCanvasAWTOnOffscrnCapsAWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLAutoDrawableNewtCanvasAWTOnOffscrnCapsAWT.java @@ -208,7 +208,7 @@ public class TestGLAutoDrawableNewtCanvasAWTOnOffscrnCapsAWT extends UITestCase glad.display(); // initial resize/display // 1 - szStep = 2 - Assert.assertTrue("Size not reached: Expected "+(widthStep*szStep)+"x"+(heightStep*szStep)+", Is "+glad.getWidth()+"x"+glad.getHeight(), + 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(); glad.display(); @@ -216,7 +216,7 @@ public class TestGLAutoDrawableNewtCanvasAWTOnOffscrnCapsAWT extends UITestCase // 2, 3 (resize + display) szStep = 1; setComponentSize(frame, nca, widthStep*szStep, heightStep*szStep); - Assert.assertTrue("Size not reached: Expected "+(widthStep*szStep)+"x"+(heightStep*szStep)+", Is "+glad.getWidth()+"x"+glad.getHeight(), + Assert.assertTrue("Size not reached: Expected "+(widthStep*szStep)+"x"+(heightStep*szStep)+", Is "+glad.getSurfaceWidth()+"x"+glad.getSurfaceHeight(), AWTRobotUtil.waitForSize(glad, widthStep*szStep, heightStep*szStep)); glad.display(); snapshotGLEventListener.setMakeSnapshot(); @@ -225,7 +225,7 @@ public class TestGLAutoDrawableNewtCanvasAWTOnOffscrnCapsAWT extends UITestCase // 4, 5 (resize + display) szStep = 4; setComponentSize(frame, nca, widthStep*szStep, heightStep*szStep); - Assert.assertTrue("Size not reached: Expected "+(widthStep*szStep)+"x"+(heightStep*szStep)+", Is "+glad.getWidth()+"x"+glad.getHeight(), + Assert.assertTrue("Size not reached: Expected "+(widthStep*szStep)+"x"+(heightStep*szStep)+", Is "+glad.getSurfaceWidth()+"x"+glad.getSurfaceHeight(), AWTRobotUtil.waitForSize(glad, widthStep*szStep, heightStep*szStep)); glad.display(); snapshotGLEventListener.setMakeSnapshot(); diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLContextSurfaceLockNEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLContextSurfaceLockNEWT.java index c64bb3854..1e78e492c 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLContextSurfaceLockNEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLContextSurfaceLockNEWT.java @@ -108,7 +108,7 @@ public class TestGLContextSurfaceLockNEWT extends UITestCase { win.runOnEDTIfAvail(true, new Runnable() { public void run() { // Normal resize, may trigger immediate display within lock - win.setSize(win.getWidth()+1, win.getHeight()+1); + win.setSize(win.getSurfaceWidth()+1, win.getSurfaceHeight()+1); // Force display within surface lock. // This procedure emulates the sensitive behavior diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLReadBuffer01GLCanvasAWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLReadBuffer01GLCanvasAWT.java index 0f77affe1..1da40728a 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLReadBuffer01GLCanvasAWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLReadBuffer01GLCanvasAWT.java @@ -201,7 +201,7 @@ public class TestGLReadBuffer01GLCanvasAWT extends GLReadBuffer00Base { final GLDrawable drawable = gl.getContext().getGLReadDrawable(); final String postSNDetail = String.format("awt-usr%03d", textRendererGLEL.userCounter); final String filenameAWT = getSnapshotFilename(sn, postSNDetail, - drawable.getChosenGLCapabilities(), drawable.getWidth(), drawable.getHeight(), + drawable.getChosenGLCapabilities(), drawable.getSurfaceWidth(), drawable.getSurfaceHeight(), glReadBufferUtil.hasAlpha(), fileSuffix, destPath); if( swapBuffersBeforeRead ) { drawable.swapBuffers(); diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLReadBuffer01GLJPanelAWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLReadBuffer01GLJPanelAWT.java index e93356d50..633a54ecc 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLReadBuffer01GLJPanelAWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLReadBuffer01GLJPanelAWT.java @@ -203,7 +203,7 @@ public class TestGLReadBuffer01GLJPanelAWT extends GLReadBuffer00Base { final GLDrawable drawable = gl.getContext().getGLReadDrawable(); final String postSNDetail = String.format("awt-usr%03d", textRendererGLEL.userCounter); final String filenameAWT = getSnapshotFilename(sn, postSNDetail, - drawable.getChosenGLCapabilities(), drawable.getWidth(), drawable.getHeight(), + drawable.getChosenGLCapabilities(), drawable.getSurfaceWidth(), drawable.getSurfaceHeight(), glReadBufferUtil.hasAlpha(), fileSuffix, destPath); if( swapBuffersBeforeRead ) { drawable.swapBuffers(); diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLReadBuffer01GLWindowNEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLReadBuffer01GLWindowNEWT.java index a170d9b14..e6ce9e548 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLReadBuffer01GLWindowNEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestGLReadBuffer01GLWindowNEWT.java @@ -86,7 +86,7 @@ public class TestGLReadBuffer01GLWindowNEWT extends GLReadBuffer00Base { throwable.printStackTrace(); Assume.assumeNoException( throwable ); } - final DimensionImmutable size0 = new Dimension(glad.getWidth(), glad.getHeight()); + final DimensionImmutable size0 = new Dimension(glad.getSurfaceWidth(), glad.getSurfaceHeight()); final DimensionImmutable size1 = new Dimension(size0.getWidth()+100, size0.getHeight()+100); final DimensionImmutable size2 = new Dimension(size0.getWidth()-100, size0.getHeight()-100); try { @@ -155,7 +155,7 @@ public class TestGLReadBuffer01GLWindowNEWT extends GLReadBuffer00Base { final GL gl = drawable.getGL(); final String postSNDetail = String.format("jgl-usr%03d", textRendererGLEL.userCounter); final String filenameJGL = getSnapshotFilename(sn, postSNDetail, - drawable.getChosenGLCapabilities(), drawable.getWidth(), drawable.getHeight(), + drawable.getChosenGLCapabilities(), drawable.getSurfaceWidth(), drawable.getSurfaceHeight(), glReadBufferUtil.hasAlpha(), fileSuffix, destPath); if( swapBuffersBeforeRead ) { drawable.swapBuffers(); diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestX11DefaultDisplay.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestX11DefaultDisplay.java index fca2beb73..deb800441 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestX11DefaultDisplay.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/TestX11DefaultDisplay.java @@ -89,7 +89,7 @@ public class TestX11DefaultDisplay extends UITestCase { System.err.println("NW chosen: "+glWindow.getDelegatedWindow().getChosenCapabilities()); System.err.println("GL chosen: "+glWindow.getChosenCapabilities()); - System.err.println("window pos/siz: "+glWindow.getX()+"/"+glWindow.getY()+" "+glWindow.getWidth()+"x"+glWindow.getHeight()+", "+glWindow.getInsets()); + System.err.println("window pos/siz: "+glWindow.getX()+"/"+glWindow.getY()+" "+glWindow.getSurfaceWidth()+"x"+glWindow.getSurfaceHeight()+", "+glWindow.getInsets()); animator.setUpdateFPSFrames(60, System.err); snap.setMakeSnapshot(); diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/glels/TestGLContextDrawableSwitch01NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/glels/TestGLContextDrawableSwitch01NEWT.java index 633d9de3b..8ad3e0242 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/glels/TestGLContextDrawableSwitch01NEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/glels/TestGLContextDrawableSwitch01NEWT.java @@ -123,7 +123,7 @@ public class TestGLContextDrawableSwitch01NEWT extends UITestCase { } @Override public void windowResized(WindowEvent e) { - glad.windowResizedOp(window.getWidth(), window.getHeight()); + glad.windowResizedOp(window.getSurfaceWidth(), window.getSurfaceHeight()); } }); window.addWindowListener(wl); diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/acore/glels/TestGLContextDrawableSwitch10NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/acore/glels/TestGLContextDrawableSwitch10NEWT.java index 4225cd988..52743d819 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/acore/glels/TestGLContextDrawableSwitch10NEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/acore/glels/TestGLContextDrawableSwitch10NEWT.java @@ -135,7 +135,7 @@ public class TestGLContextDrawableSwitch10NEWT extends UITestCase { } @Override public void windowResized(WindowEvent e) { - glad.windowResizedOp(window.getWidth(), window.getHeight()); + glad.windowResizedOp(window.getSurfaceWidth(), window.getSurfaceHeight()); } }); window.addWindowListener(wl); diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug816GLCanvasFrameHoppingB849B889AWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug816GLCanvasFrameHoppingB849B889AWT.java index 51d00a5a1..913dad8d0 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug816GLCanvasFrameHoppingB849B889AWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug816GLCanvasFrameHoppingB849B889AWT.java @@ -245,7 +245,7 @@ public class TestBug816GLCanvasFrameHoppingB849B889AWT extends UITestCase { static void dumpGLCanvasStats(GLCanvas glCanvas) { System.err.println("XXXX GLCanvas: comp "+glCanvas+", visible "+glCanvas.isVisible()+", showing "+glCanvas.isShowing()+ - ", displayable "+glCanvas.isDisplayable()+", "+glCanvas.getWidth()+"x"+glCanvas.getHeight()); + ", displayable "+glCanvas.isDisplayable()+", "+glCanvas.getSurfaceWidth()+"x"+glCanvas.getSurfaceHeight()); } public static void main(String args[]) { diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug816JTabbedPanelVisibilityB849B878AWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug816JTabbedPanelVisibilityB849B878AWT.java index 84af232d4..091dc5378 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug816JTabbedPanelVisibilityB849B878AWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug816JTabbedPanelVisibilityB849B878AWT.java @@ -178,7 +178,7 @@ public class TestBug816JTabbedPanelVisibilityB849B878AWT extends UITestCase { static void dumpGLCanvasStats(GLCanvas glCanvas) { System.err.println("XXXX GLCanvas: comp "+glCanvas+", visible "+glCanvas.isVisible()+", showing "+glCanvas.isShowing()+ - ", displayable "+glCanvas.isDisplayable()+", "+glCanvas.getWidth()+"x"+glCanvas.getHeight()); + ", displayable "+glCanvas.isDisplayable()+", "+glCanvas.getSurfaceWidth()+"x"+glCanvas.getSurfaceHeight()); } public static void main(String args[]) { diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug816OSXCALayerPos01AWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug816OSXCALayerPos01AWT.java index ace578e7a..443908ff8 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug816OSXCALayerPos01AWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/awt/TestBug816OSXCALayerPos01AWT.java @@ -259,9 +259,9 @@ public class TestBug816OSXCALayerPos01AWT extends UITestCase { Assert.assertTrue(animator.isStarted()); Assert.assertTrue(animator.isAnimating()); - System.err.println("canvas1 pos/siz: "+glCanvas1.getX()+"/"+glCanvas1.getY()+" "+glCanvas1.getWidth()+"x"+glCanvas1.getHeight()); + System.err.println("canvas1 pos/siz: "+glCanvas1.getX()+"/"+glCanvas1.getY()+" "+glCanvas1.getSurfaceWidth()+"x"+glCanvas1.getSurfaceHeight()); if( twoCanvas ) { - System.err.println("canvas2 pos/siz: "+glCanvas2.getX()+"/"+glCanvas2.getY()+" "+glCanvas2.getWidth()+"x"+glCanvas2.getHeight()); + System.err.println("canvas2 pos/siz: "+glCanvas2.getX()+"/"+glCanvas2.getY()+" "+glCanvas2.getSurfaceWidth()+"x"+glCanvas2.getSurfaceHeight()); } Thread.sleep(Math.max(1000, duration/2)); @@ -273,9 +273,9 @@ public class TestBug816OSXCALayerPos01AWT extends UITestCase { } else { setFrameSize(frame, true, frameRSizeHalf); } - System.err.println("resize canvas1 pos/siz: "+glCanvas1.getX()+"/"+glCanvas1.getY()+" "+glCanvas1.getWidth()+"x"+glCanvas1.getHeight()); + System.err.println("resize canvas1 pos/siz: "+glCanvas1.getX()+"/"+glCanvas1.getY()+" "+glCanvas1.getSurfaceWidth()+"x"+glCanvas1.getSurfaceHeight()); if( twoCanvas ) { - System.err.println("resize canvas2 pos/siz: "+glCanvas2.getX()+"/"+glCanvas2.getY()+" "+glCanvas2.getWidth()+"x"+glCanvas2.getHeight()); + System.err.println("resize canvas2 pos/siz: "+glCanvas2.getX()+"/"+glCanvas2.getY()+" "+glCanvas2.getSurfaceWidth()+"x"+glCanvas2.getSurfaceHeight()); } } diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/awt/text/TextRendererGLEventListener01.java b/src/test/com/jogamp/opengl/test/junit/jogl/awt/text/TextRendererGLEventListener01.java index c96684598..3a9f643dc 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/awt/text/TextRendererGLEventListener01.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/awt/text/TextRendererGLEventListener01.java @@ -96,7 +96,7 @@ public class TextRendererGLEventListener01 implements GLEventListener { public void display(GLAutoDrawable drawable) { if (disallowedMethodCalls.equals("")) { if (testNumber == 1) { - renderer.beginRendering(drawable.getWidth(), drawable.getHeight()); + renderer.beginRendering(drawable.getSurfaceWidth(), drawable.getSurfaceHeight()); renderer.setColor(1.0f, 1.0f, 1.0f, 1.0f); renderer.draw(text, 0, 0); renderer.endRendering(); diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/caps/TestBug605FlippedImageAWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/caps/TestBug605FlippedImageAWT.java index e87c34419..25883f641 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/caps/TestBug605FlippedImageAWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/caps/TestBug605FlippedImageAWT.java @@ -82,8 +82,8 @@ public class TestBug605FlippedImageAWT extends UITestCase { } gl.glFinish(); - final int width = drawable.getWidth(); - final int height = drawable.getHeight(); + final int width = drawable.getSurfaceWidth(); + final int height = drawable.getSurfaceHeight(); final String fname = getSnapshotFilename(0, null, caps, width, height, false, TextureIO.PNG, null); try { diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/caps/TestBug605FlippedImageNEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/caps/TestBug605FlippedImageNEWT.java index 28fcb9885..ed4e702f4 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/caps/TestBug605FlippedImageNEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/caps/TestBug605FlippedImageNEWT.java @@ -130,7 +130,7 @@ public class TestBug605FlippedImageNEWT extends UITestCase { glad.display(); System.err.println("XXX "+glad.getChosenGLCapabilities()); System.err.println("XXX "+glad.getContext().getGLVersion()); - testFlipped((ByteBuffer)rbu.getPixelBuffer().buffer, glad.getWidth(), glad.getHeight(), 3); + testFlipped((ByteBuffer)rbu.getPixelBuffer().buffer, glad.getSurfaceWidth(), glad.getSurfaceHeight(), 3); glad.destroy(); } 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 f4c5e8b2f..218093689 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 @@ -325,8 +325,8 @@ public class GearsES1 implements GLEventListener { Object source = e.getSource(); if(source instanceof Window) { Window window = (Window) source; - width=window.getWidth(); - height=window.getHeight(); + width=window.getSurfaceWidth(); + height=window.getSurfaceHeight(); } else if (GLProfile.isAWTAvailable() && source instanceof java.awt.Component) { java.awt.Component comp = (java.awt.Component) source; width=comp.getWidth(); diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/ElektronenMultiplizierer.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/ElektronenMultiplizierer.java index 3120a1832..6080ed2c2 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/ElektronenMultiplizierer.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/ElektronenMultiplizierer.java @@ -244,8 +244,8 @@ public class ElektronenMultiplizierer implements GLEventListener { sp0.add(gl, fp0, System.err); st.attachShaderProgram(gl, sp0, true); - final float XRESf = (float) drawable.getWidth(); - final float YRESf = (float) drawable.getHeight(); + final float XRESf = (float) drawable.getSurfaceWidth(); + final float YRESf = (float) drawable.getSurfaceHeight(); mScreenDimensionUniform = new GLUniformData("resolution", 2, Buffers.newDirectFloatBuffer(2)); final FloatBuffer mScreenDimensionV = (FloatBuffer) mScreenDimensionUniform.getBuffer(); @@ -334,8 +334,8 @@ public class ElektronenMultiplizierer implements GLEventListener { GL2ES2 gl = drawable.getGL().getGL2ES2(); - final int XRES = drawable.getWidth(); - final int YRES = drawable.getHeight(); + final int XRES = drawable.getSurfaceWidth(); + final int YRES = drawable.getSurfaceHeight(); // if (!getBaseMusic().isOffline()) { // //if music IS used sync to first second of music ... diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/FBOMix2DemosES2.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/FBOMix2DemosES2.java index add11ff8c..1de15f594 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/FBOMix2DemosES2.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/FBOMix2DemosES2.java @@ -154,8 +154,8 @@ public class FBOMix2DemosES2 implements GLEventListener { fbo0.detachAllColorbuffer(gl); fbo1.detachAllColorbuffer(gl); - fbo0.reset(gl, drawable.getWidth(), drawable.getHeight(), numSamples, false); - fbo1.reset(gl, drawable.getWidth(), drawable.getHeight(), numSamples, false); + fbo0.reset(gl, drawable.getSurfaceWidth(), drawable.getSurfaceHeight(), numSamples, false); + fbo1.reset(gl, drawable.getSurfaceWidth(), drawable.getSurfaceHeight(), numSamples, false); if(fbo0.getNumSamples() != fbo1.getNumSamples()) { throw new InternalError("sample size mismatch: \n\t0: "+fbo0+"\n\t1: "+fbo1); } @@ -180,8 +180,8 @@ public class FBOMix2DemosES2 implements GLEventListener { } private void resetFBOs(GL gl, GLAutoDrawable drawable) { - fbo0.reset(gl, drawable.getWidth(), drawable.getHeight(), numSamples, true); - fbo1.reset(gl, drawable.getWidth(), drawable.getHeight(), numSamples, true); + fbo0.reset(gl, drawable.getSurfaceWidth(), drawable.getSurfaceHeight(), numSamples, true); + fbo1.reset(gl, drawable.getSurfaceWidth(), drawable.getSurfaceHeight(), numSamples, true); if(fbo0.getNumSamples() != fbo1.getNumSamples()) { throw new InternalError("sample size mismatch: \n\t0: "+fbo0+"\n\t1: "+fbo1); } 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 653937a7e..09fd911a7 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 @@ -449,7 +449,7 @@ public class GearsES2 implements GLEventListener, TileRendererBase.TileRendererL if(null != sharedGears && !sharedGears.isInit() ) { return; } GLAnimatorControl anim = drawable.getAnimator(); if( verbose && ( null == anim || !anim.isAnimating() ) ) { - System.err.println(Thread.currentThread()+" GearsES2.display "+sid()+" "+drawable.getWidth()+"x"+drawable.getHeight()+", swapInterval "+swapInterval+", drawable 0x"+Long.toHexString(drawable.getHandle())); + System.err.println(Thread.currentThread()+" GearsES2.display "+sid()+" "+drawable.getSurfaceWidth()+"x"+drawable.getSurfaceHeight()+", swapInterval "+swapInterval+", drawable 0x"+Long.toHexString(drawable.getHandle())); } // Turn the gears' teeth if(doRotate) { @@ -611,12 +611,12 @@ public class GearsES2 implements GLEventListener, TileRendererBase.TileRendererL Window window = null; if(source instanceof Window) { window = (Window) source; - width=window.getWidth(); - height=window.getHeight(); + width=window.getSurfaceWidth(); + height=window.getSurfaceHeight(); } else if (source instanceof GLAutoDrawable) { GLAutoDrawable glad = (GLAutoDrawable) source; - width = glad.getWidth(); - height = glad.getHeight(); + 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(); @@ -629,8 +629,8 @@ public class GearsES2 implements GLEventListener, TileRendererBase.TileRendererL view_rotx += thetaX; view_roty += thetaY; if(e.isConfined() && confinedFixedCenter && null!=window) { - x=window.getWidth()/2; - y=window.getHeight()/2; + x=window.getSurfaceWidth()/2; + y=window.getSurfaceHeight()/2; window.warpPointer(x, y); } prevMouseX = x; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/LandscapeES2.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/LandscapeES2.java index e7f980ccd..641aed7d7 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/LandscapeES2.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/LandscapeES2.java @@ -94,7 +94,7 @@ public class LandscapeES2 implements GLEventListener { shaderState = new ShaderState(); shaderState.attachShaderProgram(gl, shaderProg, true); - resolution = new float[] { drawable.getWidth(), drawable.getHeight(), 0}; + resolution = new float[] { drawable.getSurfaceWidth(), drawable.getSurfaceHeight(), 0}; resolutionUni = new GLUniformData("iResolution", 3, FloatBuffer.wrap(resolution)); shaderState.ownUniform(resolutionUni); shaderState.uniform(gl, resolutionUni); @@ -127,8 +127,8 @@ public class LandscapeES2 implements GLEventListener { shaderState.useProgram(gl, true); - resolution[0] = drawable.getWidth(); - resolution[1] = drawable.getHeight(); + resolution[0] = drawable.getSurfaceWidth(); + resolution[1] = drawable.getSurfaceHeight(); shaderState.uniform(gl, resolutionUni); shaderState.useProgram(gl, false); diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/TextureDraw02ES2ListenerFBO.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/TextureDraw02ES2ListenerFBO.java index aac0080f2..3cc667f99 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/TextureDraw02ES2ListenerFBO.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/TextureDraw02ES2ListenerFBO.java @@ -183,7 +183,7 @@ public class TextureDraw02ES2ListenerFBO implements GLEventListener { if( fbo0.getNumSamples() != numSamples ) { System.err.println("**** NumSamples: "+fbo0.getNumSamples()+" -> "+numSamples); - resetFBOs(gl, drawable.getWidth(), drawable.getHeight()); + resetFBOs(gl, drawable.getSurfaceWidth(), drawable.getSurfaceHeight()); } if(0 < numSamples) { 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 cdee78fe9..17332a4e2 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 @@ -96,8 +96,8 @@ public class TextureSequenceCubeES2 implements GLEventListener { Window window = null; if(source instanceof Window) { window = (Window) source; - width=window.getWidth(); - height=window.getHeight(); + width=window.getSurfaceWidth(); + height=window.getSurfaceHeight(); } else if (GLProfile.isAWTAvailable() && source instanceof java.awt.Component) { java.awt.Component comp = (java.awt.Component) source; width=comp.getWidth(); @@ -217,7 +217,7 @@ public class TextureSequenceCubeES2 implements GLEventListener { st.useProgram(gl, true); pmvMatrix = new PMVMatrix(); - reshapePMV(drawable.getWidth(), drawable.getHeight()); + reshapePMV(drawable.getSurfaceWidth(), drawable.getSurfaceHeight()); pmvMatrixUniform = new GLUniformData("mgl_PMVMatrix", 4, 4, pmvMatrix.glGetPMvMatrixf()); // P, Mv if(!st.uniform(gl, pmvMatrixUniform)) { throw new GLException("Error setting PMVMatrix in shader: "+st); 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 c3d1d8ae5..730e6e562 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 @@ -448,7 +448,7 @@ public class MovieCube implements GLEventListener { System.err.println("XXX resetGLState"); disposeImpl(drawable, false); init(drawable); - reshape(drawable, 0, 0, drawable.getWidth(), drawable.getHeight()); + reshape(drawable, 0, 0, drawable.getSurfaceWidth(), drawable.getSurfaceHeight()); } final long currentPos = System.currentTimeMillis(); 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 9cb395826..7afd31352 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 @@ -181,7 +181,7 @@ public class MovieSimple implements GLEventListener { // Note: MODELVIEW is from [ 0 .. height ] - final int height = drawable.getHeight(); + final int height = drawable.getSurfaceHeight(); final float aspect = (float)mPlayer.getWidth() / (float)mPlayer.getHeight(); @@ -526,7 +526,7 @@ public class MovieSimple implements GLEventListener { // Push the 1st uniform down the path st.useProgram(gl, true); - int[] viewPort = new int[] { 0, 0, drawable.getWidth(), drawable.getHeight()}; + int[] viewPort = new int[] { 0, 0, drawable.getSurfaceWidth(), drawable.getSurfaceHeight()}; pmvMatrix = new PMVMatrix(); reshapePMV(viewPort[2], viewPort[3]); pmvMatrixUniform = new GLUniformData("mgl_PMVMatrix", 4, 4, pmvMatrix.glGetPMvMatrixf()); @@ -537,8 +537,8 @@ public class MovieSimple implements GLEventListener { throw new GLException("Error setting mgl_ActiveTexture in shader: "+st); } - float dWidth = drawable.getWidth(); - float dHeight = drawable.getHeight(); + float dWidth = drawable.getSurfaceWidth(); + float dHeight = drawable.getSurfaceHeight(); float mWidth = mPlayer.getWidth(); float mHeight = mPlayer.getHeight(); float mAspect = mWidth/mHeight; @@ -602,8 +602,8 @@ public class MovieSimple implements GLEventListener { final Window window = (Window) upstreamWidget; window.addMouseListener(mouseAction); window.addKeyListener(keyAction); - winWidth = window.getWidth(); - winHeight = window.getHeight(); + winWidth = window.getSurfaceWidth(); + winHeight = window.getSurfaceHeight(); } final int rmode = drawable.getChosenGLCapabilities().getSampleBuffers() ? 0 : Region.VBAA_RENDERING_BIT; final boolean lowPerfDevice = gl.isGLES(); @@ -755,7 +755,7 @@ public class MovieSimple implements GLEventListener { System.err.println("XXX resetGLState"); disposeImpl(drawable, false); init(drawable); - reshape(drawable, 0, 0, drawable.getWidth(), drawable.getHeight()); + reshape(drawable, 0, 0, drawable.getSurfaceWidth(), drawable.getSurfaceHeight()); } final long currentPos = System.currentTimeMillis(); diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/awt/TestGearsES2AWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/awt/TestGearsES2AWT.java index 58600dacd..96a120c62 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/awt/TestGearsES2AWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/awt/TestGearsES2AWT.java @@ -237,14 +237,14 @@ public class TestGearsES2AWT extends UITestCase { animator.setUpdateFPSFrames(60, System.err); } - System.err.println("canvas pos/siz: "+glCanvas.getX()+"/"+glCanvas.getY()+" "+glCanvas.getWidth()+"x"+glCanvas.getHeight()); + System.err.println("canvas pos/siz: "+glCanvas.getX()+"/"+glCanvas.getY()+" "+glCanvas.getSurfaceWidth()+"x"+glCanvas.getSurfaceHeight()); snap.setMakeSnapshot(); if( null != rwsize ) { Thread.sleep(500); // 500ms delay setSize(resizeBy, frame, true, glCanvas, rwsize); - System.err.println("window resize pos/siz: "+glCanvas.getX()+"/"+glCanvas.getY()+" "+glCanvas.getWidth()+"x"+glCanvas.getHeight()); + System.err.println("window resize pos/siz: "+glCanvas.getX()+"/"+glCanvas.getY()+" "+glCanvas.getSurfaceWidth()+"x"+glCanvas.getSurfaceHeight()); } snap.setMakeSnapshot(); diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/awt/TestGearsES2GLJPanelAWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/awt/TestGearsES2GLJPanelAWT.java index 46e39bebf..55616c15f 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/awt/TestGearsES2GLJPanelAWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/awt/TestGearsES2GLJPanelAWT.java @@ -148,7 +148,7 @@ public class TestGearsES2GLJPanelAWT extends UITestCase { if( null != rwsize ) { Thread.sleep(500); // 500ms delay setFrameSize(frame, true, rwsize); - System.err.println("window resize pos/siz: "+glJPanel.getX()+"/"+glJPanel.getY()+" "+glJPanel.getWidth()+"x"+glJPanel.getHeight()); + System.err.println("window resize pos/siz: "+glJPanel.getX()+"/"+glJPanel.getY()+" "+glJPanel.getSurfaceWidth()+"x"+glJPanel.getSurfaceHeight()); } snap.setMakeSnapshot(); diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestGearsES2NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestGearsES2NEWT.java index 5d5b0c9a1..a96bb1973 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestGearsES2NEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestGearsES2NEWT.java @@ -173,10 +173,10 @@ public class TestGearsES2NEWT extends UITestCase { glWindow.addWindowListener(new WindowAdapter() { public void windowResized(WindowEvent e) { - System.err.println("window resized: "+glWindow.getX()+"/"+glWindow.getY()+" "+glWindow.getWidth()+"x"+glWindow.getHeight()); + System.err.println("window resized: "+glWindow.getX()+"/"+glWindow.getY()+" "+glWindow.getSurfaceWidth()+"x"+glWindow.getSurfaceHeight()); } public void windowMoved(WindowEvent e) { - System.err.println("window moved: "+glWindow.getX()+"/"+glWindow.getY()+" "+glWindow.getWidth()+"x"+glWindow.getHeight()); + System.err.println("window moved: "+glWindow.getX()+"/"+glWindow.getY()+" "+glWindow.getSurfaceWidth()+"x"+glWindow.getSurfaceHeight()); } }); @@ -238,7 +238,7 @@ public class TestGearsES2NEWT extends UITestCase { new Thread() { public void run() { final Thread t = glWindow.setExclusiveContextThread(null); - System.err.println("[set fullscreen pre]: "+glWindow.getX()+"/"+glWindow.getY()+" "+glWindow.getWidth()+"x"+glWindow.getHeight()+", f "+glWindow.isFullscreen()+", a "+glWindow.isAlwaysOnTop()+", "+glWindow.getInsets()); + System.err.println("[set fullscreen pre]: "+glWindow.getX()+"/"+glWindow.getY()+" "+glWindow.getSurfaceWidth()+"x"+glWindow.getSurfaceHeight()+", f "+glWindow.isFullscreen()+", a "+glWindow.isAlwaysOnTop()+", "+glWindow.getInsets()); if( glWindow.isFullscreen() ) { glWindow.setFullscreen( false ); } else { @@ -248,16 +248,16 @@ public class TestGearsES2NEWT extends UITestCase { glWindow.setFullscreen( true ); } } - System.err.println("[set fullscreen post]: "+glWindow.getX()+"/"+glWindow.getY()+" "+glWindow.getWidth()+"x"+glWindow.getHeight()+", f "+glWindow.isFullscreen()+", a "+glWindow.isAlwaysOnTop()+", "+glWindow.getInsets()); + System.err.println("[set fullscreen post]: "+glWindow.getX()+"/"+glWindow.getY()+" "+glWindow.getSurfaceWidth()+"x"+glWindow.getSurfaceHeight()+", f "+glWindow.isFullscreen()+", a "+glWindow.isAlwaysOnTop()+", "+glWindow.getInsets()); glWindow.setExclusiveContextThread(t); } }.start(); } else if(e.getKeyChar()=='a') { new Thread() { public void run() { final Thread t = glWindow.setExclusiveContextThread(null); - System.err.println("[set alwaysontop pre]: "+glWindow.getX()+"/"+glWindow.getY()+" "+glWindow.getWidth()+"x"+glWindow.getHeight()+", f "+glWindow.isFullscreen()+", a "+glWindow.isAlwaysOnTop()+", "+glWindow.getInsets()); + System.err.println("[set alwaysontop pre]: "+glWindow.getX()+"/"+glWindow.getY()+" "+glWindow.getSurfaceWidth()+"x"+glWindow.getSurfaceHeight()+", f "+glWindow.isFullscreen()+", a "+glWindow.isAlwaysOnTop()+", "+glWindow.getInsets()); glWindow.setAlwaysOnTop(!glWindow.isAlwaysOnTop()); - System.err.println("[set alwaysontop post]: "+glWindow.getX()+"/"+glWindow.getY()+" "+glWindow.getWidth()+"x"+glWindow.getHeight()+", f "+glWindow.isFullscreen()+", a "+glWindow.isAlwaysOnTop()+", "+glWindow.getInsets()); + System.err.println("[set alwaysontop post]: "+glWindow.getX()+"/"+glWindow.getY()+" "+glWindow.getSurfaceWidth()+"x"+glWindow.getSurfaceHeight()+", f "+glWindow.isFullscreen()+", a "+glWindow.isAlwaysOnTop()+", "+glWindow.getInsets()); glWindow.setExclusiveContextThread(t); } }.start(); } else if(e.getKeyChar()=='d') { @@ -265,18 +265,18 @@ public class TestGearsES2NEWT extends UITestCase { public void run() { final Thread t = glWindow.setExclusiveContextThread(null); // while( null != glWindow.getExclusiveContextThread() ) ; - System.err.println("[set undecorated pre]: "+glWindow.getX()+"/"+glWindow.getY()+" "+glWindow.getWidth()+"x"+glWindow.getHeight()+", d "+glWindow.isUndecorated()+", "+glWindow.getInsets()); + System.err.println("[set undecorated pre]: "+glWindow.getX()+"/"+glWindow.getY()+" "+glWindow.getSurfaceWidth()+"x"+glWindow.getSurfaceHeight()+", d "+glWindow.isUndecorated()+", "+glWindow.getInsets()); glWindow.setUndecorated(!glWindow.isUndecorated()); - System.err.println("[set undecorated post]: "+glWindow.getX()+"/"+glWindow.getY()+" "+glWindow.getWidth()+"x"+glWindow.getHeight()+", d "+glWindow.isUndecorated()+", "+glWindow.getInsets()); + System.err.println("[set undecorated post]: "+glWindow.getX()+"/"+glWindow.getY()+" "+glWindow.getSurfaceWidth()+"x"+glWindow.getSurfaceHeight()+", d "+glWindow.isUndecorated()+", "+glWindow.getInsets()); glWindow.setExclusiveContextThread(t); } }.start(); } else if(e.getKeyChar()=='s') { new Thread() { public void run() { final Thread t = glWindow.setExclusiveContextThread(null); - System.err.println("[set position pre]: "+glWindow.getX()+"/"+glWindow.getY()+" "+glWindow.getWidth()+"x"+glWindow.getHeight()+", "+glWindow.getInsets()); + System.err.println("[set position pre]: "+glWindow.getX()+"/"+glWindow.getY()+" "+glWindow.getSurfaceWidth()+"x"+glWindow.getSurfaceHeight()+", "+glWindow.getInsets()); glWindow.setPosition(100, 100); - System.err.println("[set position post]: "+glWindow.getX()+"/"+glWindow.getY()+" "+glWindow.getWidth()+"x"+glWindow.getHeight()+", "+glWindow.getInsets()); + System.err.println("[set position post]: "+glWindow.getX()+"/"+glWindow.getY()+" "+glWindow.getSurfaceWidth()+"x"+glWindow.getSurfaceHeight()+", "+glWindow.getInsets()); glWindow.setExclusiveContextThread(t); } }.start(); } else if(e.getKeyChar()=='c') { @@ -332,7 +332,7 @@ public class TestGearsES2NEWT extends UITestCase { public void run() { final Thread t = glWindow.setExclusiveContextThread(null); System.err.println("[set mouse pos pre]"); - glWindow.warpPointer(glWindow.getWidth()/2, glWindow.getHeight()/2); + glWindow.warpPointer(glWindow.getSurfaceWidth()/2, glWindow.getSurfaceHeight()/2); System.err.println("[set mouse pos post]"); glWindow.setExclusiveContextThread(t); } }.start(); @@ -406,14 +406,14 @@ public class TestGearsES2NEWT extends UITestCase { System.err.println("NW chosen: "+glWindow.getDelegatedWindow().getChosenCapabilities()); System.err.println("GL chosen: "+glWindow.getChosenCapabilities()); - System.err.println("window pos/siz: "+glWindow.getX()+"/"+glWindow.getY()+" "+glWindow.getWidth()+"x"+glWindow.getHeight()+", "+glWindow.getInsets()); + System.err.println("window pos/siz: "+glWindow.getX()+"/"+glWindow.getY()+" "+glWindow.getSurfaceWidth()+"x"+glWindow.getSurfaceHeight()+", "+glWindow.getInsets()); snap.setMakeSnapshot(); if( null != rwsize ) { Thread.sleep(500); // 500ms delay glWindow.setSize(rwsize.getWidth(), rwsize.getHeight()); - System.err.println("window resize pos/siz: "+glWindow.getX()+"/"+glWindow.getY()+" "+glWindow.getWidth()+"x"+glWindow.getHeight()+", "+glWindow.getInsets()); + System.err.println("window resize pos/siz: "+glWindow.getX()+"/"+glWindow.getY()+" "+glWindow.getSurfaceWidth()+"x"+glWindow.getSurfaceHeight()+", "+glWindow.getInsets()); } snap.setMakeSnapshot(); diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestGearsES2NewtCanvasAWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestGearsES2NewtCanvasAWT.java index 5d091bb6d..c7a00350b 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestGearsES2NewtCanvasAWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestGearsES2NewtCanvasAWT.java @@ -259,10 +259,10 @@ public class TestGearsES2NewtCanvasAWT extends UITestCase { glWindow.addWindowListener(new WindowAdapter() { public void windowResized(WindowEvent e) { - System.err.println("window resized: "+glWindow.getX()+"/"+glWindow.getY()+" "+glWindow.getWidth()+"x"+glWindow.getHeight()); + System.err.println("window resized: "+glWindow.getX()+"/"+glWindow.getY()+" "+glWindow.getSurfaceWidth()+"x"+glWindow.getSurfaceHeight()); } public void windowMoved(WindowEvent e) { - System.err.println("window moved: "+glWindow.getX()+"/"+glWindow.getY()+" "+glWindow.getWidth()+"x"+glWindow.getHeight()); + System.err.println("window moved: "+glWindow.getX()+"/"+glWindow.getY()+" "+glWindow.getSurfaceWidth()+"x"+glWindow.getSurfaceHeight()); } }); @@ -295,12 +295,12 @@ public class TestGearsES2NewtCanvasAWT extends UITestCase { System.err.println("NW chosen: "+glWindow.getDelegatedWindow().getChosenCapabilities()); System.err.println("GL chosen: "+glWindow.getChosenCapabilities()); - System.err.println("window pos/siz: "+glWindow.getX()+"/"+glWindow.getY()+" "+glWindow.getWidth()+"x"+glWindow.getHeight()+", "+glWindow.getInsets()); + System.err.println("window pos/siz: "+glWindow.getX()+"/"+glWindow.getY()+" "+glWindow.getSurfaceWidth()+"x"+glWindow.getSurfaceHeight()+", "+glWindow.getInsets()); if( null != rwsize ) { Thread.sleep(500); // 500ms delay setSize(resizeBy, frame, true, newtCanvasAWT, glWindow, rwsize); - System.err.println("window resize "+rwsize+" -> pos/siz: "+glWindow.getX()+"/"+glWindow.getY()+" "+glWindow.getWidth()+"x"+glWindow.getHeight()+", "+glWindow.getInsets()); + System.err.println("window resize "+rwsize+" -> pos/siz: "+glWindow.getX()+"/"+glWindow.getY()+" "+glWindow.getSurfaceWidth()+"x"+glWindow.getSurfaceHeight()+", "+glWindow.getInsets()); } final long t0 = System.currentTimeMillis(); diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestGearsES2NewtCanvasSWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestGearsES2NewtCanvasSWT.java index 9b2db6bcc..d04846c2a 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestGearsES2NewtCanvasSWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestGearsES2NewtCanvasSWT.java @@ -175,10 +175,10 @@ public class TestGearsES2NewtCanvasSWT extends UITestCase { glWindow.addWindowListener(new WindowAdapter() { public void windowResized(WindowEvent e) { - System.err.println("window resized: "+glWindow.getX()+"/"+glWindow.getY()+" "+glWindow.getWidth()+"x"+glWindow.getHeight()); + System.err.println("window resized: "+glWindow.getX()+"/"+glWindow.getY()+" "+glWindow.getSurfaceWidth()+"x"+glWindow.getSurfaceHeight()); } public void windowMoved(WindowEvent e) { - System.err.println("window moved: "+glWindow.getX()+"/"+glWindow.getY()+" "+glWindow.getWidth()+"x"+glWindow.getHeight()); + System.err.println("window moved: "+glWindow.getX()+"/"+glWindow.getY()+" "+glWindow.getSurfaceWidth()+"x"+glWindow.getSurfaceHeight()); } }); @@ -191,9 +191,9 @@ public class TestGearsES2NewtCanvasSWT extends UITestCase { new Thread() { public void run() { final Thread t = glWindow.setExclusiveContextThread(null); - System.err.println("[set fullscreen pre]: "+glWindow.getX()+"/"+glWindow.getY()+" "+glWindow.getWidth()+"x"+glWindow.getHeight()+", f "+glWindow.isFullscreen()+", a "+glWindow.isAlwaysOnTop()+", "+glWindow.getInsets()); + System.err.println("[set fullscreen pre]: "+glWindow.getX()+"/"+glWindow.getY()+" "+glWindow.getSurfaceWidth()+"x"+glWindow.getSurfaceHeight()+", f "+glWindow.isFullscreen()+", a "+glWindow.isAlwaysOnTop()+", "+glWindow.getInsets()); glWindow.setFullscreen(!glWindow.isFullscreen()); - System.err.println("[set fullscreen post]: "+glWindow.getX()+"/"+glWindow.getY()+" "+glWindow.getWidth()+"x"+glWindow.getHeight()+", f "+glWindow.isFullscreen()+", a "+glWindow.isAlwaysOnTop()+", "+glWindow.getInsets()); + System.err.println("[set fullscreen post]: "+glWindow.getX()+"/"+glWindow.getY()+" "+glWindow.getSurfaceWidth()+"x"+glWindow.getSurfaceHeight()+", f "+glWindow.isFullscreen()+", a "+glWindow.isAlwaysOnTop()+", "+glWindow.getInsets()); glWindow.setExclusiveContextThread(t); } }.start(); } @@ -224,7 +224,7 @@ public class TestGearsES2NewtCanvasSWT extends UITestCase { System.err.println("NW chosen: "+glWindow.getDelegatedWindow().getChosenCapabilities()); System.err.println("GL chosen: "+glWindow.getChosenCapabilities()); - System.err.println("window pos/siz: "+glWindow.getX()+"/"+glWindow.getY()+" "+glWindow.getWidth()+"x"+glWindow.getHeight()+", "+glWindow.getInsets()); + System.err.println("window pos/siz: "+glWindow.getX()+"/"+glWindow.getY()+" "+glWindow.getSurfaceWidth()+"x"+glWindow.getSurfaceHeight()+", "+glWindow.getInsets()); if( null != rwsize ) { for(int i=0; i<50; i++) { // 500 ms dispatched delay @@ -238,7 +238,7 @@ public class TestGearsES2NewtCanvasSWT extends UITestCase { shell.setSize( rwsize.getWidth(), rwsize.getHeight() ); } }); - System.err.println("window resize pos/siz: "+glWindow.getX()+"/"+glWindow.getY()+" "+glWindow.getWidth()+"x"+glWindow.getHeight()+", "+glWindow.getInsets()); + System.err.println("window resize pos/siz: "+glWindow.getX()+"/"+glWindow.getY()+" "+glWindow.getSurfaceWidth()+"x"+glWindow.getSurfaceHeight()+", "+glWindow.getInsets()); } while(!quitAdapter.shouldQuit() && animator.isAnimating() && animator.getTotalFPSDuration()<duration) { diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestLandscapeES2NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestLandscapeES2NEWT.java index 50a5de1f9..5b31fdb5e 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestLandscapeES2NEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestLandscapeES2NEWT.java @@ -112,7 +112,7 @@ public class TestLandscapeES2NEWT extends UITestCase { System.err.println("NW chosen: "+glWindow.getDelegatedWindow().getChosenCapabilities()); System.err.println("GL chosen: "+glWindow.getChosenCapabilities()); - System.err.println("window pos/siz: "+glWindow.getX()+"/"+glWindow.getY()+" "+glWindow.getWidth()+"x"+glWindow.getHeight()+", "+glWindow.getInsets()); + System.err.println("window pos/siz: "+glWindow.getX()+"/"+glWindow.getY()+" "+glWindow.getSurfaceWidth()+"x"+glWindow.getSurfaceHeight()+", "+glWindow.getInsets()); snap.setMakeSnapshot(); diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestLandscapeES2NewtCanvasAWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestLandscapeES2NewtCanvasAWT.java index adc2b23ae..d1139152d 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestLandscapeES2NewtCanvasAWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestLandscapeES2NewtCanvasAWT.java @@ -107,10 +107,10 @@ public class TestLandscapeES2NewtCanvasAWT extends UITestCase { glWindow.addWindowListener(new WindowAdapter() { public void windowResized(WindowEvent e) { - System.err.println("window resized: "+glWindow.getX()+"/"+glWindow.getY()+" "+glWindow.getWidth()+"x"+glWindow.getHeight()); + System.err.println("window resized: "+glWindow.getX()+"/"+glWindow.getY()+" "+glWindow.getSurfaceWidth()+"x"+glWindow.getSurfaceHeight()); } public void windowMoved(WindowEvent e) { - System.err.println("window moved: "+glWindow.getX()+"/"+glWindow.getY()+" "+glWindow.getWidth()+"x"+glWindow.getHeight()); + System.err.println("window moved: "+glWindow.getX()+"/"+glWindow.getY()+" "+glWindow.getSurfaceWidth()+"x"+glWindow.getSurfaceHeight()); } }); @@ -134,7 +134,7 @@ public class TestLandscapeES2NewtCanvasAWT extends UITestCase { System.err.println("NW chosen: "+glWindow.getDelegatedWindow().getChosenCapabilities()); System.err.println("GL chosen: "+glWindow.getChosenCapabilities()); - System.err.println("window pos/siz: "+glWindow.getX()+"/"+glWindow.getY()+" "+glWindow.getWidth()+"x"+glWindow.getHeight()+", "+glWindow.getInsets()); + System.err.println("window pos/siz: "+glWindow.getX()+"/"+glWindow.getY()+" "+glWindow.getSurfaceWidth()+"x"+glWindow.getSurfaceHeight()+", "+glWindow.getInsets()); final long t0 = System.currentTimeMillis(); long t1 = t0; diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestRedSquareES2NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestRedSquareES2NEWT.java index 6300bbd68..800bef046 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestRedSquareES2NEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/newt/TestRedSquareES2NEWT.java @@ -129,7 +129,7 @@ public class TestRedSquareES2NEWT extends UITestCase { System.err.println("NW chosen: "+glWindow.getDelegatedWindow().getChosenCapabilities()); System.err.println("GL chosen: "+glWindow.getChosenCapabilities()); - System.err.println("window pos/siz: "+glWindow.getX()+"/"+glWindow.getY()+" "+glWindow.getWidth()+"x"+glWindow.getHeight()+", "+glWindow.getInsets()); + System.err.println("window pos/siz: "+glWindow.getX()+"/"+glWindow.getY()+" "+glWindow.getSurfaceWidth()+"x"+glWindow.getSurfaceHeight()+", "+glWindow.getInsets()); animator.setUpdateFPSFrames(60, System.err); snap.setMakeSnapshot(); diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/swt/TestGearsES2SWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/swt/TestGearsES2SWT.java index b6463ac0f..79a2911c9 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/swt/TestGearsES2SWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/es2/swt/TestGearsES2SWT.java @@ -183,7 +183,7 @@ public class TestGearsES2SWT extends UITestCase { } System.err.println("NW chosen: "+canvas.getDelegatedDrawable().getChosenGLCapabilities()); System.err.println("GL chosen: "+canvas.getChosenGLCapabilities()); - System.err.println("window pos/siz: "+canvas.getLocation()+" "+canvas.getWidth()+"x"+canvas.getHeight()); + System.err.println("window pos/siz: "+canvas.getLocation()+" "+canvas.getSurfaceWidth()+"x"+canvas.getSurfaceHeight()); if( null != rwsize ) { for(int i=0; i<50; i++) { // 500 ms dispatched delay @@ -197,7 +197,7 @@ public class TestGearsES2SWT extends UITestCase { shell.setSize( rwsize.getWidth(), rwsize.getHeight() ); } }); - System.err.println("window resize pos/siz: "+canvas.getLocation()+" "+canvas.getWidth()+"x"+canvas.getHeight()); + System.err.println("window resize pos/siz: "+canvas.getLocation()+" "+canvas.getSurfaceWidth()+"x"+canvas.getSurfaceHeight()); } while(animator.isAnimating() && animator.getTotalFPSDuration()<duration) { 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 0d71c7ad0..049945bda 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 @@ -499,8 +499,8 @@ public class Gears implements GLEventListener, TileRendererBase.TileRendererList Object source = e.getSource(); if(source instanceof Window) { Window window = (Window) source; - width=window.getWidth(); - height=window.getHeight(); + width=window.getSurfaceWidth(); + height=window.getSurfaceHeight(); } else if (GLProfile.isAWTAvailable() && source instanceof java.awt.Component) { java.awt.Component comp = (java.awt.Component) source; width=comp.getWidth(); diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl2/awt/TestGearsAWTAnalyzeBug455.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl2/awt/TestGearsAWTAnalyzeBug455.java index 66b9e4a78..55a4b8450 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl2/awt/TestGearsAWTAnalyzeBug455.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl2/awt/TestGearsAWTAnalyzeBug455.java @@ -91,7 +91,7 @@ public class TestGearsAWTAnalyzeBug455 extends UITestCase { // gl.glPushAttrib(GL.GL_COLOR_BUFFER_BIT); gl.glReadBuffer(GL.GL_BACK); // def. in dbl buff mode: GL_BACK gl.glDrawBuffer(GL.GL_FRONT); // def. in dbl buff mode: GL_BACK - gl.glCopyPixels(0, 0, drawable.getWidth(), drawable.getHeight(), GL2.GL_COLOR); + gl.glCopyPixels(0, 0, drawable.getSurfaceWidth(), drawable.getSurfaceHeight(), GL2.GL_COLOR); // gl.glPopAttrib(); gl.glDrawBuffer(GL.GL_BACK); // def. in dbl buff mode: GL_BACK } diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl2/newt/TestGearsNewtAWTWrapper.java b/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl2/newt/TestGearsNewtAWTWrapper.java index 84e6670c3..4b5cd0376 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl2/newt/TestGearsNewtAWTWrapper.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/demos/gl2/newt/TestGearsNewtAWTWrapper.java @@ -95,21 +95,21 @@ public class TestGearsNewtAWTWrapper extends UITestCase { glWindow.setVisible(true); if( doResizeTest ) { glWindow.display(); - Assert.assertTrue("Size not reached: Expected "+(width/div)+"x"+(height/div)+", Is "+glWindow.getWidth()+"x"+glWindow.getHeight(), + Assert.assertTrue("Size not reached: Expected "+(width/div)+"x"+(height/div)+", Is "+glWindow.getSurfaceWidth()+"x"+glWindow.getSurfaceHeight(), AWTRobotUtil.waitForSize(glWindow, width/div, height/div)); Thread.sleep(600); div = 2; glWindow.setSize(width/div, height/div); glWindow.display(); - Assert.assertTrue("Size not reached: Expected "+(width/div)+"x"+(height/div)+", Is "+glWindow.getWidth()+"x"+glWindow.getHeight(), + Assert.assertTrue("Size not reached: Expected "+(width/div)+"x"+(height/div)+", Is "+glWindow.getSurfaceWidth()+"x"+glWindow.getSurfaceHeight(), AWTRobotUtil.waitForSize(glWindow, width/div, height/div)); Thread.sleep(600); div = 1; glWindow.setSize(width/div, height/div); glWindow.display(); - Assert.assertTrue("Size not reached: Expected "+(width/div)+"x"+(height/div)+", Is "+glWindow.getWidth()+"x"+glWindow.getHeight(), + Assert.assertTrue("Size not reached: Expected "+(width/div)+"x"+(height/div)+", Is "+glWindow.getSurfaceWidth()+"x"+glWindow.getSurfaceHeight(), AWTRobotUtil.waitForSize(glWindow, width/div, height/div)); Thread.sleep(600); } diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/glsl/TestGLSLShaderState01NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/glsl/TestGLSLShaderState01NEWT.java index c240731a1..99d2dd683 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/glsl/TestGLSLShaderState01NEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/glsl/TestGLSLShaderState01NEWT.java @@ -150,13 +150,13 @@ public class TestGLSLShaderState01NEWT extends UITestCase { // reshape pmvMatrix.glMatrixMode(PMVMatrix.GL_PROJECTION); pmvMatrix.glLoadIdentity(); - pmvMatrix.gluPerspective(45.0F, (float) drawable.getWidth() / (float) drawable.getHeight(), 1.0F, 100.0F); + pmvMatrix.gluPerspective(45.0F, (float) drawable.getSurfaceWidth() / (float) drawable.getSurfaceHeight(), 1.0F, 100.0F); pmvMatrix.glMatrixMode(PMVMatrix.GL_MODELVIEW); pmvMatrix.glLoadIdentity(); pmvMatrix.glTranslatef(0, 0, -10); gl.glUniform(pmvMatrixUniform); - gl.glViewport(0, 0, drawable.getWidth(), drawable.getHeight()); + gl.glViewport(0, 0, drawable.getSurfaceWidth(), drawable.getSurfaceHeight()); Assert.assertEquals(GL.GL_NO_ERROR, gl.glGetError()); // display #1 vertices0 / colors0 (post-disable) @@ -270,12 +270,12 @@ public class TestGLSLShaderState01NEWT extends UITestCase { // reshape pmvMatrix.glMatrixMode(PMVMatrix.GL_PROJECTION); pmvMatrix.glLoadIdentity(); - pmvMatrix.gluPerspective(45.0F, (float) drawable.getWidth() / (float) drawable.getHeight(), 1.0F, 100.0F); + pmvMatrix.gluPerspective(45.0F, (float) drawable.getSurfaceWidth() / (float) drawable.getSurfaceHeight(), 1.0F, 100.0F); pmvMatrix.glMatrixMode(PMVMatrix.GL_MODELVIEW); pmvMatrix.glLoadIdentity(); pmvMatrix.glTranslatef(0, 0, -10); st.uniform(gl, pmvMatrixUniform); - gl.glViewport(0, 0, drawable.getWidth(), drawable.getHeight()); + gl.glViewport(0, 0, drawable.getSurfaceWidth(), drawable.getSurfaceHeight()); Assert.assertEquals(GL.GL_NO_ERROR, gl.glGetError()); // display #1 vertices0 / colors0 (post-disable) @@ -353,12 +353,12 @@ public class TestGLSLShaderState01NEWT extends UITestCase { // reshape pmvMatrix.glMatrixMode(PMVMatrix.GL_PROJECTION); pmvMatrix.glLoadIdentity(); - pmvMatrix.gluPerspective(45.0F, (float) drawable.getWidth() / (float) drawable.getHeight(), 1.0F, 100.0F); + pmvMatrix.gluPerspective(45.0F, (float) drawable.getSurfaceWidth() / (float) drawable.getSurfaceHeight(), 1.0F, 100.0F); pmvMatrix.glMatrixMode(PMVMatrix.GL_MODELVIEW); pmvMatrix.glLoadIdentity(); pmvMatrix.glTranslatef(0, 0, -10); st.uniform(gl, pmvMatrixUniform); - gl.glViewport(0, 0, drawable.getWidth(), drawable.getHeight()); + gl.glViewport(0, 0, drawable.getSurfaceWidth(), drawable.getSurfaceHeight()); gl.setSwapInterval(0); @@ -450,12 +450,12 @@ public class TestGLSLShaderState01NEWT extends UITestCase { // reshape pmvMatrix.glMatrixMode(PMVMatrix.GL_PROJECTION); pmvMatrix.glLoadIdentity(); - pmvMatrix.gluPerspective(45.0F, (float) drawable.getWidth() / (float) drawable.getHeight(), 1.0F, 100.0F); + pmvMatrix.gluPerspective(45.0F, (float) drawable.getSurfaceWidth() / (float) drawable.getSurfaceHeight(), 1.0F, 100.0F); pmvMatrix.glMatrixMode(PMVMatrix.GL_MODELVIEW); pmvMatrix.glLoadIdentity(); pmvMatrix.glTranslatef(0, 0, -10); st.uniform(gl, pmvMatrixUniform); - gl.glViewport(0, 0, drawable.getWidth(), drawable.getHeight()); + gl.glViewport(0, 0, drawable.getSurfaceWidth(), drawable.getSurfaceHeight()); gl.setSwapInterval(0); diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/glsl/TestGLSLShaderState02NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/glsl/TestGLSLShaderState02NEWT.java index eb5a3fcf5..6279684d3 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/glsl/TestGLSLShaderState02NEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/glsl/TestGLSLShaderState02NEWT.java @@ -181,12 +181,12 @@ public class TestGLSLShaderState02NEWT extends UITestCase { // reshape pmvMatrix.glMatrixMode(PMVMatrix.GL_PROJECTION); pmvMatrix.glLoadIdentity(); - pmvMatrix.gluPerspective(45.0F, (float) drawable.getWidth() / (float) drawable.getHeight(), 1.0F, 100.0F); + pmvMatrix.gluPerspective(45.0F, (float) drawable.getSurfaceWidth() / (float) drawable.getSurfaceHeight(), 1.0F, 100.0F); pmvMatrix.glMatrixMode(PMVMatrix.GL_MODELVIEW); pmvMatrix.glLoadIdentity(); pmvMatrix.glTranslatef(0, 0, -10); st.uniform(gl, pmvMatrixUniform); - gl.glViewport(0, 0, drawable.getWidth(), drawable.getHeight()); + gl.glViewport(0, 0, drawable.getSurfaceWidth(), drawable.getSurfaceHeight()); Assert.assertEquals(GL.GL_NO_ERROR, gl.glGetError()); // display #1 vertices0 / colors0 (post-disable) @@ -307,12 +307,12 @@ public class TestGLSLShaderState02NEWT extends UITestCase { // reshape pmvMatrix.glMatrixMode(PMVMatrix.GL_PROJECTION); pmvMatrix.glLoadIdentity(); - pmvMatrix.gluPerspective(45.0F, (float) drawable.getWidth() / (float) drawable.getHeight(), 1.0F, 100.0F); + pmvMatrix.gluPerspective(45.0F, (float) drawable.getSurfaceWidth() / (float) drawable.getSurfaceHeight(), 1.0F, 100.0F); pmvMatrix.glMatrixMode(PMVMatrix.GL_MODELVIEW); pmvMatrix.glLoadIdentity(); pmvMatrix.glTranslatef(0, 0, -10); st.uniform(gl, pmvMatrixUniform); - gl.glViewport(0, 0, drawable.getWidth(), drawable.getHeight()); + gl.glViewport(0, 0, drawable.getSurfaceWidth(), drawable.getSurfaceHeight()); gl.setSwapInterval(0); diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/glsl/TestRulerNEWT01.java b/src/test/com/jogamp/opengl/test/junit/jogl/glsl/TestRulerNEWT01.java index 32bea649f..0384765bf 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/glsl/TestRulerNEWT01.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/glsl/TestRulerNEWT01.java @@ -149,7 +149,7 @@ public class TestRulerNEWT01 extends UITestCase { // pmvMatrix.glTranslatef(0, 0, -6); // pmvMatrix.glRotatef(45f, 1f, 0f, 0f); st.uniform(gl, pmvMatrixUniform); - gl.glViewport(0, 0, drawable.getWidth(), drawable.getHeight()); + gl.glViewport(0, 0, drawable.getSurfaceWidth(), drawable.getSurfaceHeight()); Assert.assertEquals(GL.GL_NO_ERROR, gl.glGetError()); for(int i=0; i<10; i++) { diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/swt/TestBug672NewtCanvasSWTSashForm.java b/src/test/com/jogamp/opengl/test/junit/jogl/swt/TestBug672NewtCanvasSWTSashForm.java index 4b7537655..36c672179 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/swt/TestBug672NewtCanvasSWTSashForm.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/swt/TestBug672NewtCanvasSWTSashForm.java @@ -184,10 +184,10 @@ public class TestBug672NewtCanvasSWTSashForm extends UITestCase { glWindow.addWindowListener(new WindowAdapter() { public void windowResized(WindowEvent e) { - System.err.println("window resized: "+glWindow.getX()+"/"+glWindow.getY()+" "+glWindow.getWidth()+"x"+glWindow.getHeight()); + System.err.println("window resized: "+glWindow.getX()+"/"+glWindow.getY()+" "+glWindow.getSurfaceWidth()+"x"+glWindow.getSurfaceHeight()); } public void windowMoved(WindowEvent e) { - System.err.println("window moved: "+glWindow.getX()+"/"+glWindow.getY()+" "+glWindow.getWidth()+"x"+glWindow.getHeight()); + System.err.println("window moved: "+glWindow.getX()+"/"+glWindow.getY()+" "+glWindow.getSurfaceWidth()+"x"+glWindow.getSurfaceHeight()); } }); @@ -200,9 +200,9 @@ public class TestBug672NewtCanvasSWTSashForm extends UITestCase { new Thread() { public void run() { final Thread t = glWindow.setExclusiveContextThread(null); - System.err.println("[set fullscreen pre]: "+glWindow.getX()+"/"+glWindow.getY()+" "+glWindow.getWidth()+"x"+glWindow.getHeight()+", f "+glWindow.isFullscreen()+", a "+glWindow.isAlwaysOnTop()+", "+glWindow.getInsets()); + System.err.println("[set fullscreen pre]: "+glWindow.getX()+"/"+glWindow.getY()+" "+glWindow.getSurfaceWidth()+"x"+glWindow.getSurfaceHeight()+", f "+glWindow.isFullscreen()+", a "+glWindow.isAlwaysOnTop()+", "+glWindow.getInsets()); glWindow.setFullscreen(!glWindow.isFullscreen()); - System.err.println("[set fullscreen post]: "+glWindow.getX()+"/"+glWindow.getY()+" "+glWindow.getWidth()+"x"+glWindow.getHeight()+", f "+glWindow.isFullscreen()+", a "+glWindow.isAlwaysOnTop()+", "+glWindow.getInsets()); + System.err.println("[set fullscreen post]: "+glWindow.getX()+"/"+glWindow.getY()+" "+glWindow.getSurfaceWidth()+"x"+glWindow.getSurfaceHeight()+", f "+glWindow.isFullscreen()+", a "+glWindow.isAlwaysOnTop()+", "+glWindow.getInsets()); glWindow.setExclusiveContextThread(t); } }.start(); } @@ -232,7 +232,7 @@ public class TestBug672NewtCanvasSWTSashForm extends UITestCase { System.err.println("NW chosen: "+glWindow.getDelegatedWindow().getChosenCapabilities()); System.err.println("GL chosen: "+glWindow.getChosenCapabilities()); - System.err.println("window pos/siz.0: "+glWindow.getX()+"/"+glWindow.getY()+" "+glWindow.getWidth()+"x"+glWindow.getHeight()+", "+glWindow.getInsets()); + System.err.println("window pos/siz.0: "+glWindow.getX()+"/"+glWindow.getY()+" "+glWindow.getSurfaceWidth()+"x"+glWindow.getSurfaceHeight()+", "+glWindow.getInsets()); System.err.println("GLWindow LOS.0: "+glWindow.getLocationOnScreen(null)); System.err.println("NewtCanvasSWT LOS.0: "+canvas1.getNativeWindow().getLocationOnScreen(null)); @@ -245,7 +245,7 @@ public class TestBug672NewtCanvasSWTSashForm extends UITestCase { shell.setSize( rwsize.getWidth(), rwsize.getHeight() ); } }); - System.err.println("window resize pos/siz.1: "+glWindow.getX()+"/"+glWindow.getY()+" "+glWindow.getWidth()+"x"+glWindow.getHeight()+", "+glWindow.getInsets()); + System.err.println("window resize pos/siz.1: "+glWindow.getX()+"/"+glWindow.getY()+" "+glWindow.getSurfaceWidth()+"x"+glWindow.getSurfaceHeight()+", "+glWindow.getInsets()); System.err.println("GLWindow LOS.1: "+glWindow.getLocationOnScreen(null)); System.err.println("NewtCanvasSWT LOS.1: "+canvas1.getNativeWindow().getLocationOnScreen(null)); } diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/swt/TestBug672NewtCanvasSWTSashFormComposite.java b/src/test/com/jogamp/opengl/test/junit/jogl/swt/TestBug672NewtCanvasSWTSashFormComposite.java index 876eafe86..9ad6e1f5c 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/swt/TestBug672NewtCanvasSWTSashFormComposite.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/swt/TestBug672NewtCanvasSWTSashFormComposite.java @@ -191,10 +191,10 @@ public class TestBug672NewtCanvasSWTSashFormComposite extends UITestCase { glWindow.addWindowListener(new WindowAdapter() { public void windowResized(WindowEvent e) { - System.err.println("window resized: "+glWindow.getX()+"/"+glWindow.getY()+" "+glWindow.getWidth()+"x"+glWindow.getHeight()); + System.err.println("window resized: "+glWindow.getX()+"/"+glWindow.getY()+" "+glWindow.getSurfaceWidth()+"x"+glWindow.getSurfaceHeight()); } public void windowMoved(WindowEvent e) { - System.err.println("window moved: "+glWindow.getX()+"/"+glWindow.getY()+" "+glWindow.getWidth()+"x"+glWindow.getHeight()); + System.err.println("window moved: "+glWindow.getX()+"/"+glWindow.getY()+" "+glWindow.getSurfaceWidth()+"x"+glWindow.getSurfaceHeight()); } }); @@ -207,9 +207,9 @@ public class TestBug672NewtCanvasSWTSashFormComposite extends UITestCase { new Thread() { public void run() { final Thread t = glWindow.setExclusiveContextThread(null); - System.err.println("[set fullscreen pre]: "+glWindow.getX()+"/"+glWindow.getY()+" "+glWindow.getWidth()+"x"+glWindow.getHeight()+", f "+glWindow.isFullscreen()+", a "+glWindow.isAlwaysOnTop()+", "+glWindow.getInsets()); + System.err.println("[set fullscreen pre]: "+glWindow.getX()+"/"+glWindow.getY()+" "+glWindow.getSurfaceWidth()+"x"+glWindow.getSurfaceHeight()+", f "+glWindow.isFullscreen()+", a "+glWindow.isAlwaysOnTop()+", "+glWindow.getInsets()); glWindow.setFullscreen(!glWindow.isFullscreen()); - System.err.println("[set fullscreen post]: "+glWindow.getX()+"/"+glWindow.getY()+" "+glWindow.getWidth()+"x"+glWindow.getHeight()+", f "+glWindow.isFullscreen()+", a "+glWindow.isAlwaysOnTop()+", "+glWindow.getInsets()); + System.err.println("[set fullscreen post]: "+glWindow.getX()+"/"+glWindow.getY()+" "+glWindow.getSurfaceWidth()+"x"+glWindow.getSurfaceHeight()+", f "+glWindow.isFullscreen()+", a "+glWindow.isAlwaysOnTop()+", "+glWindow.getInsets()); glWindow.setExclusiveContextThread(t); } }.start(); } @@ -239,7 +239,7 @@ public class TestBug672NewtCanvasSWTSashFormComposite extends UITestCase { System.err.println("NW chosen: "+glWindow.getDelegatedWindow().getChosenCapabilities()); System.err.println("GL chosen: "+glWindow.getChosenCapabilities()); - System.err.println("window pos/siz.0: "+glWindow.getX()+"/"+glWindow.getY()+" "+glWindow.getWidth()+"x"+glWindow.getHeight()+", "+glWindow.getInsets()); + System.err.println("window pos/siz.0: "+glWindow.getX()+"/"+glWindow.getY()+" "+glWindow.getSurfaceWidth()+"x"+glWindow.getSurfaceHeight()+", "+glWindow.getInsets()); System.err.println("GLWindow LOS.0: "+glWindow.getLocationOnScreen(null)); System.err.println("NewtCanvasSWT LOS.0: "+canvas1.getNativeWindow().getLocationOnScreen(null)); @@ -252,7 +252,7 @@ public class TestBug672NewtCanvasSWTSashFormComposite extends UITestCase { shell.setSize( rwsize.getWidth(), rwsize.getHeight() ); } }); - System.err.println("window resize pos/siz.1: "+glWindow.getX()+"/"+glWindow.getY()+" "+glWindow.getWidth()+"x"+glWindow.getHeight()+", "+glWindow.getInsets()); + System.err.println("window resize pos/siz.1: "+glWindow.getX()+"/"+glWindow.getY()+" "+glWindow.getSurfaceWidth()+"x"+glWindow.getSurfaceHeight()+", "+glWindow.getInsets()); System.err.println("GLWindow LOS.1: "+glWindow.getLocationOnScreen(null)); System.err.println("NewtCanvasSWT LOS.1: "+canvas1.getNativeWindow().getLocationOnScreen(null)); } diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/swt/TestSWTAccessor03AWTGLn.java b/src/test/com/jogamp/opengl/test/junit/jogl/swt/TestSWTAccessor03AWTGLn.java index 7cc19a72f..906dbc879 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/swt/TestSWTAccessor03AWTGLn.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/swt/TestSWTAccessor03AWTGLn.java @@ -167,14 +167,14 @@ public class TestSWTAccessor03AWTGLn extends UITestCase { /* @Override */ public void display( GLAutoDrawable glautodrawable ) { - Rectangle rectangle = new Rectangle( 0, 0, glautodrawable.getWidth(), glautodrawable.getHeight() ); + Rectangle rectangle = new Rectangle( 0, 0, glautodrawable.getSurfaceWidth(), glautodrawable.getSurfaceHeight() ); GL2ES1 gl = glautodrawable.getGL().getGL2ES1(); OneTriangle.render( gl, rectangle.width, rectangle.height ); } /* @Override */ public void reshape( GLAutoDrawable glautodrawable, int x, int y, int width, int height ) { - Rectangle rectangle = new Rectangle( 0, 0, glautodrawable.getWidth(), glautodrawable.getHeight() ); + Rectangle rectangle = new Rectangle( 0, 0, glautodrawable.getSurfaceWidth(), glautodrawable.getSurfaceHeight() ); GL2ES1 gl = glautodrawable.getGL().getGL2ES1(); OneTriangle.setup( gl, rectangle.width, rectangle.height ); } diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/tile/TestRandomTiledRendering2GL2NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/tile/TestRandomTiledRendering2GL2NEWT.java index 16c1b33f4..9783b9205 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/tile/TestRandomTiledRendering2GL2NEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/tile/TestRandomTiledRendering2GL2NEWT.java @@ -153,8 +153,8 @@ public class TestRandomTiledRendering2GL2NEWT extends UITestCase { glad.invoke(true, new GLRunnable() { @Override public boolean run(GLAutoDrawable drawable) { - drawable.getGL().glViewport(0, 0, drawable.getWidth(), drawable.getHeight()); - gears.reshape(drawable, 0, 0, drawable.getWidth(), drawable.getHeight()); + drawable.getGL().glViewport(0, 0, drawable.getSurfaceWidth(), drawable.getSurfaceHeight()); + gears.reshape(drawable, 0, 0, drawable.getSurfaceWidth(), drawable.getSurfaceHeight()); return false; } }); diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/tile/TestRandomTiledRendering3GL2AWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/tile/TestRandomTiledRendering3GL2AWT.java index 7d3f1f622..4d770e618 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/tile/TestRandomTiledRendering3GL2AWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/tile/TestRandomTiledRendering3GL2AWT.java @@ -198,8 +198,8 @@ public class TestRandomTiledRendering3GL2AWT extends UITestCase { } renderer.detachAutoDrawable(); System.err.println("XXX post-display detached: "+renderer); - drawable.getGL().glViewport(0, 0, drawable.getWidth(), drawable.getHeight()); - glad.getGLEventListener(0).reshape(drawable, 0, 0, drawable.getWidth(), drawable.getHeight()); + drawable.getGL().glViewport(0, 0, drawable.getSurfaceWidth(), drawable.getSurfaceHeight()); + glad.getGLEventListener(0).reshape(drawable, 0, 0, drawable.getSurfaceWidth(), drawable.getSurfaceHeight()); } } @Override diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/tile/TestTiledRendering1GL2NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/tile/TestTiledRendering1GL2NEWT.java index e0fabc3cc..59bc27c07 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/tile/TestTiledRendering1GL2NEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/tile/TestTiledRendering1GL2NEWT.java @@ -107,15 +107,15 @@ public class TestTiledRendering1GL2NEWT extends UITestCase { final GL2 gl = dc.glc.getGL().getGL2(); // Fix the image size for now - final int imageWidth = dc.d.getWidth() * 6; - final int imageHeight = dc.d.getHeight() * 4; + final int imageWidth = dc.d.getSurfaceWidth() * 6; + final int imageHeight = dc.d.getSurfaceHeight() * 4; final String filename = this.getSnapshotFilename(0, "-tile", dc.d.getChosenGLCapabilities(), imageWidth, imageHeight, false, TextureIO.PNG, null); final File file = new File(filename); // Initialize the tile rendering library final TileRenderer renderer = new com.jogamp.opengl.util.TileRenderer(); - renderer.setTileSize(dc.d.getWidth(), dc.d.getHeight(), 0); + renderer.setTileSize(dc.d.getSurfaceWidth(), dc.d.getSurfaceHeight(), 0); renderer.setImageSize(imageWidth, imageHeight); final GLPixelBuffer.GLPixelBufferProvider pixelBufferProvider = GLPixelBuffer.defaultProviderWithRowStride; @@ -170,12 +170,12 @@ public class TestTiledRendering1GL2NEWT extends UITestCase { final GL2 gl = dc.glc.getGL().getGL2(); // Fix the image size for now - final int imageWidth = dc.d.getWidth() * 6; - final int imageHeight = dc.d.getHeight() * 4; + final int imageWidth = dc.d.getSurfaceWidth() * 6; + final int imageHeight = dc.d.getSurfaceHeight() * 4; // Initialize the tile rendering library final TileRenderer renderer = new com.jogamp.opengl.util.TileRenderer(); - renderer.setTileSize(dc.d.getWidth(), dc.d.getHeight(), 0); + renderer.setTileSize(dc.d.getSurfaceWidth(), dc.d.getSurfaceHeight(), 0); IllegalStateException ise = null; try { diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/tile/TestTiledRendering2NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/tile/TestTiledRendering2NEWT.java index 2220c1fb3..cf83d524d 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/tile/TestTiledRendering2NEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/tile/TestTiledRendering2NEWT.java @@ -178,8 +178,8 @@ public class TestTiledRendering2NEWT extends UITestCase { glad.addGLEventListener( demo ); // Fix the image size for now - final int imageWidth = glad.getWidth() * 6; - final int imageHeight = glad.getHeight() * 4; + final int imageWidth = glad.getSurfaceWidth() * 6; + final int imageHeight = glad.getSurfaceHeight() * 4; final String filename = this.getSnapshotFilename(0, "-tile", glad.getChosenGLCapabilities(), imageWidth, imageHeight, false, TextureIO.PNG, null); final File file = new File(filename); @@ -187,7 +187,7 @@ public class TestTiledRendering2NEWT extends UITestCase { // Initialize the tile rendering library final TileRenderer renderer = new TileRenderer(); renderer.setImageSize(imageWidth, imageHeight); - renderer.setTileSize(glad.getWidth(), glad.getHeight(), 0); + renderer.setTileSize(glad.getSurfaceWidth(), glad.getSurfaceHeight(), 0); renderer.attachAutoDrawable(glad); final GLPixelBuffer.GLPixelBufferProvider pixelBufferProvider = GLPixelBuffer.defaultProviderWithRowStride; @@ -226,8 +226,8 @@ public class TestTiledRendering2NEWT extends UITestCase { glad.invoke(true, new GLRunnable() { @Override public boolean run(GLAutoDrawable drawable) { - drawable.getGL().glViewport(0, 0, drawable.getWidth(), drawable.getHeight()); - demo.reshape(drawable, 0, 0, drawable.getWidth(), drawable.getHeight()); + drawable.getGL().glViewport(0, 0, drawable.getSurfaceWidth(), drawable.getSurfaceHeight()); + demo.reshape(drawable, 0, 0, drawable.getSurfaceWidth(), drawable.getSurfaceHeight()); return false; } }); diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/util/DemoGL2ES1ImmModeSink.java b/src/test/com/jogamp/opengl/test/junit/jogl/util/DemoGL2ES1ImmModeSink.java index c82e7def4..d6c0908f7 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/util/DemoGL2ES1ImmModeSink.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/util/DemoGL2ES1ImmModeSink.java @@ -108,9 +108,9 @@ class DemoGL2ES1ImmModeSink implements GLEventListener { ims.glColor3f( 1, 0, 0 ); ims.glVertex2f( 0, 0 ); ims.glColor3f( 0, 1, 0 ); - ims.glVertex2f( drawable.getWidth(), 0 ); + ims.glVertex2f( drawable.getSurfaceWidth(), 0 ); ims.glColor3f( 0, 0, 1 ); - ims.glVertex2f( drawable.getWidth() / 2, drawable.getHeight() ); + ims.glVertex2f( drawable.getSurfaceWidth() / 2, drawable.getSurfaceHeight() ); ims.glEnd(gl, true); } diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/util/DemoGL2ES2ImmModeSink.java b/src/test/com/jogamp/opengl/test/junit/jogl/util/DemoGL2ES2ImmModeSink.java index 02f161cf6..9d18f21e0 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/util/DemoGL2ES2ImmModeSink.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/util/DemoGL2ES2ImmModeSink.java @@ -158,9 +158,9 @@ public class DemoGL2ES2ImmModeSink implements GLEventListener { ims.glColor3f( 1, 0, 0 ); ims.glVertex2f( 0, 0 ); ims.glColor3f( 0, 1, 0 ); - ims.glVertex2f( drawable.getWidth(), 0 ); + ims.glVertex2f( drawable.getSurfaceWidth(), 0 ); ims.glColor3f( 0, 0, 1 ); - ims.glVertex2f( drawable.getWidth() / 2, drawable.getHeight() ); + ims.glVertex2f( drawable.getSurfaceWidth() / 2, drawable.getSurfaceHeight() ); ims.glEnd(gl, true); } diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestGLReadBufferUtilTextureIOWrite02AWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestGLReadBufferUtilTextureIOWrite02AWT.java index 3822bff09..712748d49 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestGLReadBufferUtilTextureIOWrite02AWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestGLReadBufferUtilTextureIOWrite02AWT.java @@ -100,8 +100,8 @@ public class TestGLReadBufferUtilTextureIOWrite02AWT extends UITestCase { public void display(GLAutoDrawable drawable) { final int fw = frame.getWidth(); final int fh = frame.getHeight(); - final int dw = drawable.getWidth(); - final int dh = drawable.getHeight(); + final int dw = drawable.getSurfaceWidth(); + final int dh = drawable.getSurfaceHeight(); final boolean sz_changed = fw_old != fw && dw_old != dw && dw <= 512; // need to check both sizes [frame + drawable], due to async resize of AWT! final boolean snap; if(sz_changed) { diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestGLReadBufferUtilTextureIOWrite02NEWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestGLReadBufferUtilTextureIOWrite02NEWT.java index 9615297e3..c52680dc3 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestGLReadBufferUtilTextureIOWrite02NEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestGLReadBufferUtilTextureIOWrite02NEWT.java @@ -83,8 +83,8 @@ public class TestGLReadBufferUtilTextureIOWrite02NEWT extends UITestCase { System.err.println("XXX: dispose"); } public void display(GLAutoDrawable drawable) { - final int dw = drawable.getWidth(); - final int dh = drawable.getHeight(); + final int dw = drawable.getSurfaceWidth(); + final int dh = drawable.getSurfaceHeight(); final boolean sz_changed = dw_old != dw && dw <= 512; final boolean snap; if(sz_changed) { diff --git a/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestJPEGJoglAWTCompareNewtAWT.java b/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestJPEGJoglAWTCompareNewtAWT.java index dbb4002a3..7079e07bf 100644 --- a/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestJPEGJoglAWTCompareNewtAWT.java +++ b/src/test/com/jogamp/opengl/test/junit/jogl/util/texture/TestJPEGJoglAWTCompareNewtAWT.java @@ -81,7 +81,7 @@ public class TestJPEGJoglAWTCompareNewtAWT extends UITestCase { final Animator animator = new Animator(); final GLWindow w1 = testJOGLJpeg(fname); - final GLWindow w2 = testAWTJpeg(fname, w1.getWidth() + 50); + final GLWindow w2 = testAWTJpeg(fname, w1.getSurfaceWidth() + 50); animator.add(w1); animator.add(w2); diff --git a/src/test/com/jogamp/opengl/test/junit/newt/TestGLWindowWarpPointer01NEWT.java b/src/test/com/jogamp/opengl/test/junit/newt/TestGLWindowWarpPointer01NEWT.java index d6b550c80..818133945 100644 --- a/src/test/com/jogamp/opengl/test/junit/newt/TestGLWindowWarpPointer01NEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/newt/TestGLWindowWarpPointer01NEWT.java @@ -136,7 +136,7 @@ public class TestGLWindowWarpPointer01NEWT extends UITestCase { @Override public void display(GLAutoDrawable drawable) { - warpRandom(drawable.getWidth(), drawable.getHeight()); + warpRandom(drawable.getSurfaceWidth(), drawable.getSurfaceHeight()); } @Override 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 6b44a4b2c..19b6fbd07 100644 --- a/src/test/com/jogamp/opengl/test/junit/newt/TestWindows01NEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/newt/TestWindows01NEWT.java @@ -80,8 +80,8 @@ public class TestWindows01NEWT extends UITestCase { Assert.assertEquals(true,screen.isNativeValid()); Assert.assertEquals(true,window.isVisible()); Assert.assertEquals(true,window.isNativeValid()); - Assert.assertEquals(width, window.getWidth()); - Assert.assertEquals(height, window.getHeight()); + Assert.assertEquals(width, window.getSurfaceWidth()); + Assert.assertEquals(height, window.getSurfaceHeight()); /** we don't sync on position - unreliable test Point p0 = window.getLocationOnScreen(null); @@ -152,8 +152,8 @@ public class TestWindows01NEWT extends UITestCase { window.setVisible(true); Assert.assertEquals(true,window.isNativeValid()); Assert.assertEquals(true,window.isVisible()); - Assert.assertEquals(width, window.getWidth()); - Assert.assertEquals(height, window.getHeight()); + Assert.assertEquals(width, window.getSurfaceWidth()); + Assert.assertEquals(height, window.getSurfaceHeight()); destroyWindow(window, true); } diff --git a/src/test/com/jogamp/opengl/test/junit/newt/mm/TestScreenMode01bNEWT.java b/src/test/com/jogamp/opengl/test/junit/newt/mm/TestScreenMode01bNEWT.java index 4804a753c..871012a28 100644 --- a/src/test/com/jogamp/opengl/test/junit/newt/mm/TestScreenMode01bNEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/newt/mm/TestScreenMode01bNEWT.java @@ -152,7 +152,7 @@ public class TestScreenMode01bNEWT extends UITestCase { GLWindow window0 = createWindow(screen, caps, "win0", xpos, ypos, width, height); Assert.assertNotNull(window0); - System.err.println("Test.0: Window bounds: "+window0.getX()+"/"+window0.getY()+" "+window0.getWidth()+"x"+window0.getHeight()+" within "+screen.getViewport()); + System.err.println("Test.0: Window bounds: "+window0.getX()+"/"+window0.getY()+" "+window0.getSurfaceWidth()+"x"+window0.getSurfaceHeight()+" within "+screen.getViewport()); final Animator anim = new Animator(window0); anim.start(); @@ -219,7 +219,7 @@ public class TestScreenMode01bNEWT extends UITestCase { } System.err.println("Test.1: Window screen: "+screen); - System.err.println("Test.1: Window bounds: "+window0.getX()+"/"+window0.getY()+" "+window0.getWidth()+"x"+window0.getHeight()+" within "+screen.getViewport()); + System.err.println("Test.1: Window bounds: "+window0.getX()+"/"+window0.getY()+" "+window0.getSurfaceWidth()+"x"+window0.getSurfaceHeight()+" within "+screen.getViewport()); System.err.println("Test.1: Window monitor: "+window0.getMainMonitor()); Thread.sleep(duration); @@ -241,7 +241,7 @@ public class TestScreenMode01bNEWT extends UITestCase { } System.err.println("Test.2: Window screen: "+screen); - System.err.println("Test.2: Window bounds: "+window0.getX()+"/"+window0.getY()+" "+window0.getWidth()+"x"+window0.getHeight()+" within "+screen.getViewport()); + System.err.println("Test.2: Window bounds: "+window0.getX()+"/"+window0.getY()+" "+window0.getSurfaceWidth()+"x"+window0.getSurfaceHeight()+" within "+screen.getViewport()); System.err.println("Test.2: Window monitor: "+window0.getMainMonitor()); Thread.sleep(duration); diff --git a/src/test/com/jogamp/opengl/test/junit/newt/mm/TestScreenMode01cNEWT.java b/src/test/com/jogamp/opengl/test/junit/newt/mm/TestScreenMode01cNEWT.java index db6360a19..b4257e070 100644 --- a/src/test/com/jogamp/opengl/test/junit/newt/mm/TestScreenMode01cNEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/newt/mm/TestScreenMode01cNEWT.java @@ -197,7 +197,7 @@ public class TestScreenMode01cNEWT extends UITestCase { GLWindow window0 = createWindow(screen, caps, "win0", xpos, ypos, width, height); Assert.assertNotNull(window0); - System.err.println("Test.0: Window bounds: "+window0.getX()+"/"+window0.getY()+" "+window0.getWidth()+"x"+window0.getHeight()+" within "+screen.getViewport()); + System.err.println("Test.0: Window bounds: "+window0.getX()+"/"+window0.getY()+" "+window0.getSurfaceWidth()+"x"+window0.getSurfaceHeight()+" within "+screen.getViewport()); final Animator anim = new Animator(window0); anim.start(); @@ -214,9 +214,9 @@ public class TestScreenMode01cNEWT extends UITestCase { } monitor = window0.getMainMonitor(); - System.err.println("Test.1: Window bounds: "+window0.getX()+"/"+window0.getY()+" "+window0.getWidth()+"x"+window0.getHeight()+" within "+screen.getViewport()); + System.err.println("Test.1: Window bounds: "+window0.getX()+"/"+window0.getY()+" "+window0.getSurfaceWidth()+"x"+window0.getSurfaceHeight()+" within "+screen.getViewport()); System.err.println("Test.1: Window monitor: "+monitor.getViewport()); - Rectangle window0Rect = new Rectangle(window0.getX(), window0.getY(), window0.getWidth(), window0.getHeight()); + Rectangle window0Rect = new Rectangle(window0.getX(), window0.getY(), window0.getSurfaceWidth(), window0.getSurfaceHeight()); if( !spanAcrossMonitors ) { Assert.assertEquals(monitor.getViewport(), window0Rect); } else { @@ -232,9 +232,9 @@ public class TestScreenMode01cNEWT extends UITestCase { window0.setFullscreen(false); - window0Rect = new Rectangle(window0.getX(), window0.getY(), window0.getWidth(), window0.getHeight()); + window0Rect = new Rectangle(window0.getX(), window0.getY(), window0.getSurfaceWidth(), window0.getSurfaceHeight()); monitor = window0.getMainMonitor(); - System.err.println("Test.2: Window bounds: "+window0.getX()+"/"+window0.getY()+" "+window0.getWidth()+"x"+window0.getHeight()+" within "+screen.getViewport()); + System.err.println("Test.2: Window bounds: "+window0.getX()+"/"+window0.getY()+" "+window0.getSurfaceWidth()+"x"+window0.getSurfaceHeight()+" within "+screen.getViewport()); System.err.println("Test.2: Window monitor: "+monitor.getViewport()); Thread.sleep(duration); diff --git a/src/test/com/jogamp/opengl/test/junit/newt/mm/TestScreenMode01dNEWT.java b/src/test/com/jogamp/opengl/test/junit/newt/mm/TestScreenMode01dNEWT.java index 6158e6244..4b16a006f 100644 --- a/src/test/com/jogamp/opengl/test/junit/newt/mm/TestScreenMode01dNEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/newt/mm/TestScreenMode01dNEWT.java @@ -164,20 +164,20 @@ public class TestScreenMode01dNEWT extends UITestCase { final MonitorDevice monitor = window.getMainMonitor(); Assert.assertEquals(false, window.isFullscreen()); - Assert.assertEquals(width, window.getWidth()); - Assert.assertEquals(height, window.getHeight()); + Assert.assertEquals(width, window.getSurfaceWidth()); + Assert.assertEquals(height, window.getSurfaceHeight()); window.setFullscreen(true); Assert.assertEquals(true, window.isFullscreen()); - Assert.assertEquals(monitor.getViewport().getWidth(), window.getWidth()); - Assert.assertEquals(monitor.getViewport().getHeight(), window.getHeight()); + Assert.assertEquals(monitor.getViewport().getWidth(), window.getSurfaceWidth()); + Assert.assertEquals(monitor.getViewport().getHeight(), window.getSurfaceHeight()); Thread.sleep(waitTimeShort); window.setFullscreen(false); Assert.assertEquals(false, window.isFullscreen()); - Assert.assertEquals(width, window.getWidth()); - Assert.assertEquals(height, window.getHeight()); + Assert.assertEquals(width, window.getSurfaceWidth()); + Assert.assertEquals(height, window.getSurfaceHeight()); Thread.sleep(waitTimeShort); @@ -210,7 +210,7 @@ public class TestScreenMode01dNEWT extends UITestCase { GLWindow window = createWindow(screen, caps, width, height, true /* onscreen */, false /* undecorated */); Assert.assertNotNull(window); - final RectangleImmutable winRect = new Rectangle(window.getX(), window.getY(), window.getWidth(), window.getHeight()); + final RectangleImmutable winRect = new Rectangle(window.getX(), window.getY(), window.getSurfaceWidth(), window.getSurfaceHeight()); final MonitorDevice monitor = screen.getMainMonitor(winRect); List<MonitorMode> monitorModes = monitor.getSupportedModes(); @@ -308,7 +308,7 @@ public class TestScreenMode01dNEWT extends UITestCase { Animator animator = new Animator(window); animator.start(); - final RectangleImmutable winRect = new Rectangle(window.getX(), window.getY(), window.getWidth(), window.getHeight()); + final RectangleImmutable winRect = new Rectangle(window.getX(), window.getY(), window.getSurfaceWidth(), window.getSurfaceHeight()); final MonitorDevice monitor = screen.getMainMonitor(winRect); MonitorMode mmCurrent = monitor.queryCurrentMode(); Assert.assertNotNull(mmCurrent); diff --git a/src/test/com/jogamp/opengl/test/junit/newt/parenting/NewtAWTReparentingKeyAdapter.java b/src/test/com/jogamp/opengl/test/junit/newt/parenting/NewtAWTReparentingKeyAdapter.java index dc9aac8ea..005579352 100644 --- a/src/test/com/jogamp/opengl/test/junit/newt/parenting/NewtAWTReparentingKeyAdapter.java +++ b/src/test/com/jogamp/opengl/test/junit/newt/parenting/NewtAWTReparentingKeyAdapter.java @@ -82,9 +82,9 @@ public class NewtAWTReparentingKeyAdapter extends KeyAdapter { new Thread() { public void run() { final Thread t = glWindow.setExclusiveContextThread(null); - System.err.println("[set fullscreen pre]: "+glWindow.getX()+"/"+glWindow.getY()+" "+glWindow.getWidth()+"x"+glWindow.getHeight()+", f "+glWindow.isFullscreen()+", a "+glWindow.isAlwaysOnTop()+", "+glWindow.getInsets()); + System.err.println("[set fullscreen pre]: "+glWindow.getX()+"/"+glWindow.getY()+" "+glWindow.getSurfaceWidth()+"x"+glWindow.getSurfaceHeight()+", f "+glWindow.isFullscreen()+", a "+glWindow.isAlwaysOnTop()+", "+glWindow.getInsets()); glWindow.setFullscreen(!glWindow.isFullscreen()); - System.err.println("[set fullscreen post]: "+glWindow.getX()+"/"+glWindow.getY()+" "+glWindow.getWidth()+"x"+glWindow.getHeight()+", f "+glWindow.isFullscreen()+", a "+glWindow.isAlwaysOnTop()+", "+glWindow.getInsets()); + System.err.println("[set fullscreen post]: "+glWindow.getX()+"/"+glWindow.getY()+" "+glWindow.getSurfaceWidth()+"x"+glWindow.getSurfaceHeight()+", f "+glWindow.isFullscreen()+", a "+glWindow.isAlwaysOnTop()+", "+glWindow.getInsets()); glWindow.setExclusiveContextThread(t); if( null != quitAdapter ) { quitAdapter.clear(); @@ -226,7 +226,7 @@ public class NewtAWTReparentingKeyAdapter extends KeyAdapter { new Thread() { public void run() { System.err.println("[set mouse pos pre]"); - glWindow.warpPointer(glWindow.getWidth()/2, glWindow.getHeight()/2); + glWindow.warpPointer(glWindow.getSurfaceWidth()/2, glWindow.getSurfaceHeight()/2); System.err.println("[set mouse pos post]"); } }.start(); } diff --git a/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting02NEWT.java b/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting02NEWT.java index 9f56ecdbf..417a1c506 100644 --- a/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting02NEWT.java +++ b/src/test/com/jogamp/opengl/test/junit/newt/parenting/TestParenting02NEWT.java @@ -110,8 +110,8 @@ public class TestParenting02NEWT extends UITestCase { GLWindow glWindow1 = GLWindow.create(window1); Assert.assertNotNull(glWindow1); glWindow1.setSize(width, height); - Assert.assertEquals(width,glWindow1.getWidth()); - Assert.assertEquals(height,glWindow1.getHeight()); + Assert.assertEquals(width,glWindow1.getSurfaceWidth()); + Assert.assertEquals(height,glWindow1.getSurfaceHeight()); glWindow1.setTitle("test01NewtOnNewtParentChildDraw - PARENT"); glWindow1.setPosition(x,y); //glWindow1.addKeyListener(new TraceKeyAdapter(new KeyAction(eventFifo))); @@ -134,7 +134,7 @@ public class TestParenting02NEWT extends UITestCase { //Assert.assertEquals(width/2,glWindow2.getWidth()); //Assert.assertEquals(height/2,glWindow2.getHeight()); glWindow2.setTitle("test01NewtOnNewtParentChildDraw - CHILD"); - glWindow2.setPosition(glWindow1.getWidth()/2, glWindow1.getHeight()/2); + glWindow2.setPosition(glWindow1.getSurfaceWidth()/2, glWindow1.getSurfaceHeight()/2); //glWindow2.addKeyListener(new TraceKeyAdapter(new KeyAction(eventFifo))); //glWindow2.addWindowListener(new TraceWindowAdapter(new WindowAction(eventFifo))); // glWindow2.addMouseListener(new TraceMouseAdapter()); @@ -163,7 +163,7 @@ public class TestParenting02NEWT extends UITestCase { x += 1; y += 1; // glWindow1.setPosition(x,y); - glWindow2.setPosition(glWindow1.getWidth()/2,glWindow1.getHeight()/2-y); + glWindow2.setPosition(glWindow1.getSurfaceWidth()/2,glWindow1.getSurfaceHeight()/2-y); Thread.sleep(step); while( null != ( event = eventFifo.get() ) ) { 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 599a6dc9f..45df52220 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.getWidth()/2, insets.getTopHeight()/2); + p0.translate(win.getSurfaceWidth()/2, insets.getTopHeight()/2); } else { - p0.translate(win.getWidth()/2, win.getHeight()/2); + p0.translate(win.getSurfaceWidth()/2, win.getSurfaceHeight()/2); } return new int[] { p0.getX(), p0.getY() }; } @@ -671,7 +671,7 @@ public class AWTRobotUtil { */ public static boolean waitForSize(GLDrawable drawable, int width, int height) throws InterruptedException { int wait; - for (wait=0; wait<POLL_DIVIDER && ( width != drawable.getWidth() || height != drawable.getHeight() ) ; wait++) { + for (wait=0; wait<POLL_DIVIDER && ( width != drawable.getSurfaceWidth() || height != drawable.getSurfaceHeight() ) ; wait++) { Thread.sleep(TIME_SLICE); } return wait<POLL_DIVIDER; diff --git a/src/test/com/jogamp/opengl/test/junit/util/UITestCase.java b/src/test/com/jogamp/opengl/test/junit/util/UITestCase.java index a08e9f842..3c0f388b6 100644 --- a/src/test/com/jogamp/opengl/test/junit/util/UITestCase.java +++ b/src/test/com/jogamp/opengl/test/junit/util/UITestCase.java @@ -335,7 +335,7 @@ public abstract class UITestCase { public void snapshot(int sn, String postSNDetail, GL gl, GLReadBufferUtil readBufferUtil, String fileSuffix, String destPath) { final GLDrawable drawable = gl.getContext().getGLReadDrawable(); final String filename = getSnapshotFilename(sn, postSNDetail, - drawable.getChosenGLCapabilities(), drawable.getWidth(), drawable.getHeight(), + drawable.getChosenGLCapabilities(), drawable.getSurfaceWidth(), drawable.getSurfaceHeight(), readBufferUtil.hasAlpha(), fileSuffix, destPath); System.err.println(Thread.currentThread().getName()+": ** screenshot: "+filename); gl.glFinish(); // just make sure rendering finished .. @@ -367,7 +367,7 @@ public abstract class UITestCase { final GL gl = drawable.getGL(); final boolean _makeShot = makeShot || makeShotAlways; if(verbose) { - System.err.println(Thread.currentThread().getName()+": ** display: "+displayCount+": "+drawable.getWidth()+"x"+drawable.getHeight()+", makeShot "+_makeShot); + System.err.println(Thread.currentThread().getName()+": ** display: "+displayCount+": "+drawable.getSurfaceWidth()+"x"+drawable.getSurfaceHeight()+", makeShot "+_makeShot); } if(_makeShot) { makeShot=false; @@ -377,7 +377,7 @@ public abstract class UITestCase { } public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) { if(verbose) { - System.err.println(Thread.currentThread().getName()+": ** reshape: "+reshapeCount+": "+width+"x"+height+" - "+drawable.getWidth()+"x"+drawable.getHeight()); + System.err.println(Thread.currentThread().getName()+": ** reshape: "+reshapeCount+": "+width+"x"+height+" - "+drawable.getSurfaceWidth()+"x"+drawable.getSurfaceHeight()); } reshapeCount++; } |