diff options
author | Sven Gothel <[email protected]> | 2023-01-31 04:20:16 +0100 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2023-01-31 04:20:16 +0100 |
commit | ed4cf029c22c3380e04971011a51ef2c666aa6d9 (patch) | |
tree | e4a07abb2b064949deddc3073e082cf1e4698839 /src | |
parent | 54760cd667365277c9c2473350bdc56ba5398348 (diff) |
NativeWindow: Add getBounds() (moved from NEWT Window) and getSurfaceBounds()
Diffstat (limited to 'src')
11 files changed, 140 insertions, 62 deletions
diff --git a/src/nativewindow/classes/com/jogamp/nativewindow/NativeWindow.java b/src/nativewindow/classes/com/jogamp/nativewindow/NativeWindow.java index 1a2d212da..85340f29c 100644 --- a/src/nativewindow/classes/com/jogamp/nativewindow/NativeWindow.java +++ b/src/nativewindow/classes/com/jogamp/nativewindow/NativeWindow.java @@ -42,6 +42,7 @@ package com.jogamp.nativewindow; import com.jogamp.nativewindow.util.InsetsImmutable; import com.jogamp.nativewindow.util.Point; +import com.jogamp.nativewindow.util.Rectangle; /** * Extend the {@link NativeSurface} interface with windowing @@ -178,6 +179,17 @@ public interface NativeWindow extends NativeSurface, NativeSurfaceHolder { public int getHeight(); /** + * Returns a newly created {@link Rectangle} containing window origin, {@link #getX()} & {@link #getY()}, + * and size, {@link #getWidth()} & {@link #getHeight()}, in window units. + */ + Rectangle getBounds(); + + /** + * Returns a newly created {@link Rectangle} containing window's surface origin and size in pixel units. + */ + Rectangle getSurfaceBounds(); + + /** * Returns the window's top-left client-area position in the screen. * <p> * If {@link Point} is not <code>null</code>, it is translated about the resulting screen position diff --git a/src/nativewindow/classes/com/jogamp/nativewindow/awt/JAWTWindow.java b/src/nativewindow/classes/com/jogamp/nativewindow/awt/JAWTWindow.java index 0c25b3e28..6df43bd0f 100644 --- a/src/nativewindow/classes/com/jogamp/nativewindow/awt/JAWTWindow.java +++ b/src/nativewindow/classes/com/jogamp/nativewindow/awt/JAWTWindow.java @@ -98,7 +98,7 @@ public abstract class JAWTWindow implements NativeWindow, OffscreenLayerSurface, private JAWT jawt; private boolean isOffscreenLayerSurface; protected long drawable; - protected Rectangle bounds; + protected Rectangle jawt_surface_bounds; protected Insets insets; private volatile long offscreenSurfaceLayer; @@ -279,7 +279,7 @@ public abstract class JAWTWindow implements NativeWindow, OffscreenLayerSurface, isOffscreenLayerSurface = false; drawable= 0; drawable_old = 0; - bounds = new Rectangle(); + jawt_surface_bounds = new Rectangle(); insets = new Insets(); hasPixelScale[0] = ScalableSurface.IDENTITY_PIXELSCALE; hasPixelScale[1] = ScalableSurface.IDENTITY_PIXELSCALE; @@ -359,13 +359,13 @@ public abstract class JAWTWindow implements NativeWindow, OffscreenLayerSurface, */ protected final boolean updateLockedData(final JAWT_Rectangle jawtBounds, final GraphicsConfiguration gc) { final Rectangle jb = new Rectangle(jawtBounds.getX(), jawtBounds.getY(), jawtBounds.getWidth(), jawtBounds.getHeight()); - final boolean changedBounds = !bounds.equals(jb); + final boolean changedBounds = !jawt_surface_bounds.equals(jb); if( changedBounds ) { if( DEBUG ) { - System.err.println("JAWTWindow.updateBounds: "+bounds+" -> "+jb); + System.err.println("JAWTWindow.updateBounds: "+jawt_surface_bounds+" -> "+jb); } - bounds.set(jawtBounds.getX(), jawtBounds.getY(), jawtBounds.getWidth(), jawtBounds.getHeight()); + jawt_surface_bounds.set(jawtBounds.getX(), jawtBounds.getY(), jawtBounds.getWidth(), jawtBounds.getHeight()); if(component instanceof Container) { final java.awt.Insets contInsets = ((Container)component).getInsets(); @@ -435,8 +435,8 @@ public abstract class JAWTWindow implements NativeWindow, OffscreenLayerSurface, return SurfaceScaleUtils.setNewPixelScale(hasPixelScale, hasPixelScale, reqPixelScale, minPixelScale, maxPixelScale, DEBUG ? getClass().getSimpleName() : null); } - /** @return the JAWT_DrawingSurfaceInfo's (JAWT_Rectangle) bounds, updated with lock */ - public final RectangleImmutable getBounds() { return bounds; } + /** @return the JAWT_DrawingSurfaceInfo's (JAWT_Rectangle) bounds in pixel units, updated with lock */ + public final RectangleImmutable getJAWTSurfaceBounds() { return jawt_surface_bounds; } /** @return the safe pixelScale value for x-direction, i.e. never negative or zero. Updated with lock. */ protected final float getPixelScaleX() { return hasPixelScale[0]; } @@ -816,6 +816,16 @@ public abstract class JAWTWindow implements NativeWindow, OffscreenLayerSurface, // @Override + public final int getX() { + return component.getX(); + } + + @Override + public final int getY() { + return component.getY(); + } + + @Override public final int getWidth() { return component.getWidth(); } @@ -826,6 +836,18 @@ public abstract class JAWTWindow implements NativeWindow, OffscreenLayerSurface, } @Override + public final Rectangle getBounds() { + return new Rectangle(getX(), getY(), getWidth(), getHeight()); + } + + @Override + public final Rectangle getSurfaceBounds() { + return new Rectangle(SurfaceScaleUtils.scale(getX(), getPixelScaleX()), + SurfaceScaleUtils.scale(getY(), getPixelScaleY()), + getSurfaceWidth(), getSurfaceHeight()); + } + + @Override public void destroy() { surfaceLock.lock(); try { @@ -849,16 +871,6 @@ public abstract class JAWTWindow implements NativeWindow, OffscreenLayerSurface, return drawable; } - @Override - public final int getX() { - return component.getX(); - } - - @Override - public final int getY() { - return component.getY(); - } - /** * {@inheritDoc} * @@ -922,10 +934,10 @@ public abstract class JAWTWindow implements NativeWindow, OffscreenLayerSurface, sb.append("JAWT version: ").append(toHexString(jawt.getCachedVersion())). append(", CA_LAYER: ").append(JAWTUtil.isJAWTUsingOffscreenLayer(jawt)). append(", isLayeredSurface ").append(isOffscreenLayerSurfaceEnabled()). - append(", bounds ").append(bounds).append(", insets ").append(insets). + append(", bounds ").append(jawt_surface_bounds).append(", insets ").append(insets). append(", pixelScale ").append(getPixelScaleX()).append("x").append(getPixelScaleY()); } else { - sb.append("JAWT n/a, bounds ").append(bounds).append(", insets ").append(insets); + sb.append("JAWT n/a, bounds ").append(jawt_surface_bounds).append(", insets ").append(insets); } return sb; } @@ -940,7 +952,7 @@ public abstract class JAWTWindow implements NativeWindow, OffscreenLayerSurface, ", attachedSurfaceLayer "+toHexString(getAttachedSurfaceLayer())+ ", windowHandle "+toHexString(getWindowHandle())+ ", surfaceHandle "+toHexString(getSurfaceHandle())+ - ", bounds "+bounds+", insets "+insets + ", bounds "+jawt_surface_bounds+", insets "+insets ); sb.append(", window ["+getX()+"/"+getY()+" "+getWidth()+"x"+getHeight()+ "], pixels[scale "+getPixelScaleX()+", "+getPixelScaleY()+" -> "+getSurfaceWidth()+"x"+getSurfaceHeight()+"]"+ diff --git a/src/nativewindow/classes/jogamp/nativewindow/WrappedSurface.java b/src/nativewindow/classes/jogamp/nativewindow/WrappedSurface.java index a417de4cb..769041f10 100644 --- a/src/nativewindow/classes/jogamp/nativewindow/WrappedSurface.java +++ b/src/nativewindow/classes/jogamp/nativewindow/WrappedSurface.java @@ -101,6 +101,12 @@ public class WrappedSurface extends ProxySurfaceImpl implements ScalableSurface protected final void unlockSurfaceImpl() { } + /** @return the safe pixelScale value for x-direction, i.e. never negative or zero. Updated with lock. */ + protected final float getPixelScaleX() { return hasPixelScale[0]; } + + /** @return the safe pixelScale value for y-direction, i.e. never negative or zero. Updated with lock. */ + protected final float getPixelScaleY() { return hasPixelScale[1]; } + /** * {@inheritDoc} * <p> diff --git a/src/nativewindow/classes/jogamp/nativewindow/WrappedWindow.java b/src/nativewindow/classes/jogamp/nativewindow/WrappedWindow.java index 4231402c7..9da127666 100644 --- a/src/nativewindow/classes/jogamp/nativewindow/WrappedWindow.java +++ b/src/nativewindow/classes/jogamp/nativewindow/WrappedWindow.java @@ -9,7 +9,7 @@ import com.jogamp.nativewindow.UpstreamSurfaceHook; import com.jogamp.nativewindow.util.Insets; import com.jogamp.nativewindow.util.InsetsImmutable; import com.jogamp.nativewindow.util.Point; - +import com.jogamp.nativewindow.util.Rectangle; import com.jogamp.nativewindow.UpstreamWindowHookMutableSizePos; public class WrappedWindow extends WrappedSurface implements NativeWindow { @@ -105,6 +105,18 @@ public class WrappedWindow extends WrappedSurface implements NativeWindow { } @Override + public final Rectangle getBounds() { + return new Rectangle(getX(), getY(), getWidth(), getHeight()); + } + + @Override + public final Rectangle getSurfaceBounds() { + return new Rectangle(SurfaceScaleUtils.scale(getX(), getPixelScaleX()), + SurfaceScaleUtils.scale(getY(), getPixelScaleY()), + getSurfaceWidth(), getSurfaceHeight()); + } + + @Override public Point getLocationOnScreen(final Point point) { if(null!=point) { return point; diff --git a/src/nativewindow/classes/jogamp/nativewindow/jawt/macosx/MacOSXJAWTWindow.java b/src/nativewindow/classes/jogamp/nativewindow/jawt/macosx/MacOSXJAWTWindow.java index e754bb262..40fb48f33 100644 --- a/src/nativewindow/classes/jogamp/nativewindow/jawt/macosx/MacOSXJAWTWindow.java +++ b/src/nativewindow/classes/jogamp/nativewindow/jawt/macosx/MacOSXJAWTWindow.java @@ -171,9 +171,9 @@ public class MacOSXJAWTWindow extends JAWTWindow implements MutableSurface { pA1.translate(-outterInsets.left, -outterInsets.top); } System.err.println("JAWTWindow.attachSurfaceLayerImpl: "+toHexString(_offscreenSurfaceLayer) + ", [ins "+outterInsets+"], pA "+pA0+" -> "+pA1+ - ", p0 "+p0+" -> "+p1+", bounds "+bounds); + ", p0 "+p0+" -> "+p1+", bounds "+jawt_surface_bounds); } else if( DEBUG ) { - System.err.println("JAWTWindow.attachSurfaceLayerImpl: "+toHexString(_offscreenSurfaceLayer) + ", [ins "+outterInsets+"], p0 "+p0+" -> "+p1+", bounds "+bounds); + System.err.println("JAWTWindow.attachSurfaceLayerImpl: "+toHexString(_offscreenSurfaceLayer) + ", [ins "+outterInsets+"], p0 "+p0+" -> "+p1+", bounds "+jawt_surface_bounds); } // HiDPI: uniform pixel scale OSXUtil.AddCASublayer(rootSurfaceLayer, _offscreenSurfaceLayer, p1.getX(), p1.getY(), getWidth(), getHeight(), getPixelScaleX(), JAWTUtil.getOSXCALayerQuirks()); @@ -205,10 +205,10 @@ public class MacOSXJAWTWindow extends JAWTWindow implements MutableSurface { } System.err.println("JAWTWindow.layoutSurfaceLayerImpl: "+toHexString(getAttachedSurfaceLayer()) + ", quirks "+caLayerQuirks+", visible "+visible+ ", [ins "+outterInsets+"], pA "+pA0+" -> "+pA1+ - ", p0 "+p0+" -> "+p1+", bounds "+bounds); + ", p0 "+p0+" -> "+p1+", bounds "+jawt_surface_bounds); } else if( DEBUG ) { System.err.println("JAWTWindow.layoutSurfaceLayerImpl: "+toHexString(getAttachedSurfaceLayer()) + ", quirks "+caLayerQuirks+", visible "+visible+ - ", [ins "+outterInsets+"], p0 "+p0+" -> "+p1+", bounds "+bounds); + ", [ins "+outterInsets+"], p0 "+p0+" -> "+p1+", bounds "+jawt_surface_bounds); } OSXUtil.RunOnMainThread(false /* wait */, false, new Runnable() { @Override @@ -352,7 +352,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(), getPixelScaleX()); // HiDPI: uniform pixel scale + rootSurfaceLayer = OSXUtil.CreateCALayer(jawt_surface_bounds.getWidth(), jawt_surface_bounds.getHeight(), getPixelScaleX()); // HiDPI: uniform pixel scale if(0 == rootSurfaceLayer) { errMsg = "Could not create root CALayer"; } else { diff --git a/src/newt/classes/com/jogamp/newt/Window.java b/src/newt/classes/com/jogamp/newt/Window.java index 607ed285c..5134708c4 100644 --- a/src/newt/classes/com/jogamp/newt/Window.java +++ b/src/newt/classes/com/jogamp/newt/Window.java @@ -625,12 +625,6 @@ public interface Window extends NativeWindow, WindowClosingProtocol, ScalableSur // /** - * Returns a newly created {@link Rectangle} containing window origin, {@link #getX()} & {@link #getY()}, - * and size, {@link #getWidth()} & {@link #getHeight()}, in window units. - */ - Rectangle getBounds(); - - /** * Returns the <i>pixels per millimeter</i> of this window's {@link NativeSurface} * according to the {@link #getMainMonitor() main monitor}'s <i>current</i> {@link MonitorMode mode}'s * {@link SurfaceSize#getResolution() surface resolution}. diff --git a/src/newt/classes/com/jogamp/newt/javafx/NewtCanvasJFX.java b/src/newt/classes/com/jogamp/newt/javafx/NewtCanvasJFX.java index ae46e2922..288516deb 100644 --- a/src/newt/classes/com/jogamp/newt/javafx/NewtCanvasJFX.java +++ b/src/newt/classes/com/jogamp/newt/javafx/NewtCanvasJFX.java @@ -574,6 +574,16 @@ public class NewtCanvasJFX extends Canvas implements NativeWindowHolder, WindowC } @Override + public int getX() { + return NewtCanvasJFX.this.clientArea.getX(); // FIXME: Use 'scale' or an actual window-width + } + + @Override + public int getY() { + return NewtCanvasJFX.this.clientArea.getY(); // FIXME: Use 'scale' or an actual window-width + } + + @Override public int getWidth() { return getSurfaceWidth(); // FIXME: Use 'scale' or an actual window-width } @@ -584,6 +594,17 @@ public class NewtCanvasJFX extends Canvas implements NativeWindowHolder, WindowC } @Override + public final Rectangle getBounds() { + return new Rectangle(getX(), getY(), getWidth(), getHeight()); + } + + @Override + public final Rectangle getSurfaceBounds() { + return new Rectangle(getX(), getY(), // FIXME: 'scale' window -> pixel size + getSurfaceWidth(), getSurfaceHeight()); + } + + @Override public final int[] convertToWindowUnits(final int[] pixelUnitsAndResult) { return pixelUnitsAndResult; // FIXME HiDPI: use 'pixelScale' } @@ -643,16 +664,6 @@ public class NewtCanvasJFX extends Canvas implements NativeWindowHolder, WindowC } @Override - public int getX() { - return NewtCanvasJFX.this.clientArea.getX(); - } - - @Override - public int getY() { - return NewtCanvasJFX.this.clientArea.getY(); - } - - @Override public Point getLocationOnScreen(final Point point) { final Point los = NativeWindowFactory.getLocationOnScreen(this); // client window location on screen if(null!=point) { diff --git a/src/newt/classes/com/jogamp/newt/opengl/GLWindow.java b/src/newt/classes/com/jogamp/newt/opengl/GLWindow.java index c7e1c0a45..6b102ea68 100644 --- a/src/newt/classes/com/jogamp/newt/opengl/GLWindow.java +++ b/src/newt/classes/com/jogamp/newt/opengl/GLWindow.java @@ -467,6 +467,11 @@ public class GLWindow extends GLAutoDrawableBase implements GLAutoDrawable, Wind } @Override + public final Rectangle getSurfaceBounds() { + return window.getSurfaceBounds(); + } + + @Override public final int[] convertToWindowUnits(final int[] pixelUnitsAndResult) { return window.convertToWindowUnits(pixelUnitsAndResult); } diff --git a/src/newt/classes/com/jogamp/newt/swt/NewtCanvasSWT.java b/src/newt/classes/com/jogamp/newt/swt/NewtCanvasSWT.java index fd9709331..b545a2e77 100644 --- a/src/newt/classes/com/jogamp/newt/swt/NewtCanvasSWT.java +++ b/src/newt/classes/com/jogamp/newt/swt/NewtCanvasSWT.java @@ -54,7 +54,6 @@ import jogamp.newt.swt.SWTEDTUtil; import org.eclipse.swt.SWT; import org.eclipse.swt.SWTException; import org.eclipse.swt.graphics.Color; -import org.eclipse.swt.graphics.Rectangle; import org.eclipse.swt.widgets.Canvas; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Event; @@ -80,7 +79,7 @@ public class NewtCanvasSWT extends Canvas implements NativeWindowHolder, WindowC private WindowClosingMode newtChildClosingMode = WindowClosingMode.DISPOSE_ON_CLOSE; private final WindowClosingMode closingMode = WindowClosingMode.DISPOSE_ON_CLOSE; - private volatile Rectangle clientAreaPixels, clientAreaWindow; + private volatile org.eclipse.swt.graphics.Rectangle clientAreaPixels, clientAreaWindow; /** pixelScale = pixelUnit / windowUnix */ private volatile float[] pixelScale = new float[] { 1f, 1f }; @@ -197,7 +196,7 @@ public class NewtCanvasSWT extends Canvas implements NativeWindowHolder, WindowC * </p> * @param r containing desired size */ - private final void setNewtChildSize(final Rectangle r) { + private final void setNewtChildSize(final org.eclipse.swt.graphics.Rectangle r) { if( !SWTAccessor.isOSX ) { final Point p = SWTAccessor.deviceZoomScaleUp(new Point(r.width, r.height)); newtChild.setSize(p.getX(), p.getY()); @@ -344,7 +343,7 @@ public class NewtCanvasSWT extends Canvas implements NativeWindowHolder, WindowC return true; // already valid } updatePosSizeCheck(); - final Rectangle nClientAreaWindow = clientAreaWindow; + final org.eclipse.swt.graphics.Rectangle nClientAreaWindow = clientAreaWindow; if(0 >= nClientAreaWindow.width || 0 >= nClientAreaWindow.height) { return false; } @@ -378,9 +377,9 @@ public class NewtCanvasSWT extends Canvas implements NativeWindowHolder, WindowC } protected final void updatePosSizeCheck() { - final Rectangle oClientAreaWindow = clientAreaWindow; - final Rectangle nClientAreaPixels = SWTAccessor.getClientAreaInPixels(this); - final Rectangle nClientAreaWindow = getClientArea(); + final org.eclipse.swt.graphics.Rectangle oClientAreaWindow = clientAreaWindow; + final org.eclipse.swt.graphics.Rectangle nClientAreaPixels = SWTAccessor.getClientAreaInPixels(this); + final org.eclipse.swt.graphics.Rectangle nClientAreaWindow = getClientArea(); final boolean sizeChanged, posChanged; { sizeChanged = nClientAreaWindow.width != oClientAreaWindow.width || nClientAreaWindow.height != oClientAreaWindow.height; @@ -689,6 +688,16 @@ public class NewtCanvasSWT extends Canvas implements NativeWindowHolder, WindowC } @Override + public int getX() { + return 0; + } + + @Override + public int getY() { + return 0; + } + + @Override public int getWidth() { return newtScaleUp(clientAreaWindow.width, clientAreaWindow.width); } @@ -699,6 +708,17 @@ public class NewtCanvasSWT extends Canvas implements NativeWindowHolder, WindowC } @Override + public final com.jogamp.nativewindow.util.Rectangle getBounds() { + return new com.jogamp.nativewindow.util.Rectangle(getX(), getY(), getWidth(), getHeight()); + } + + @Override + public final com.jogamp.nativewindow.util.Rectangle getSurfaceBounds() { + return new com.jogamp.nativewindow.util.Rectangle(getX(), getY(), + getSurfaceWidth(), getSurfaceHeight()); + } + + @Override public final int[] convertToWindowUnits(final int[] pixelUnitsAndResult) { pixelUnitsAndResult[0] /= pixelScale[0]; pixelUnitsAndResult[1] /= pixelScale[1]; @@ -762,16 +782,6 @@ public class NewtCanvasSWT extends Canvas implements NativeWindowHolder, WindowC } @Override - public int getX() { - return 0; - } - - @Override - public int getY() { - return 0; - } - - @Override public Point getLocationOnScreen(final Point point) { final Point los = NativeWindowFactory.getLocationOnScreen(this); // client window location on screen if(null!=point) { diff --git a/src/newt/classes/jogamp/newt/WindowImpl.java b/src/newt/classes/jogamp/newt/WindowImpl.java index 8567be5cc..67f1e863b 100644 --- a/src/newt/classes/jogamp/newt/WindowImpl.java +++ b/src/newt/classes/jogamp/newt/WindowImpl.java @@ -2621,6 +2621,11 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer } @Override + public final Rectangle getSurfaceBounds() { + return new Rectangle(pixelPos[0], pixelPos[1], pixelSize[0], pixelSize[1]); + } + + @Override public final int[] convertToWindowUnits(final int[] pixelUnitsAndResult) { return SurfaceScaleUtils.scaleInv(pixelUnitsAndResult, pixelUnitsAndResult, hasPixelScale); } 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 6733d7e57..e6f1cdeaa 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 @@ -142,12 +142,13 @@ public class TestGearsES2NEWT extends UITestCase { final Screen screen = NewtFactory.createScreen(dpy, screenIdx); final GLWindow glWindow = GLWindow.create(screen, caps); Assert.assertNotNull(glWindow); - glWindow.setSurfaceScale(reqSurfacePixelScale); - final float[] valReqSurfacePixelScale = glWindow.getRequestedSurfaceScale(new float[2]); glWindow.setSize(wsize.getWidth(), wsize.getHeight()); if(null != wpos) { glWindow.setPosition(wpos.getX(), wpos.getY()); } + glWindow.setSurfaceScale(reqSurfacePixelScale); + final float[] valReqSurfacePixelScale = glWindow.getRequestedSurfaceScale(new float[2]); + glWindow.setUndecorated(undecorated); glWindow.setAlwaysOnTop(alwaysOnTop); glWindow.setAlwaysOnBottom(alwaysOnBottom); @@ -207,8 +208,11 @@ public class TestGearsES2NEWT extends UITestCase { glWindow.addGLEventListener(snap); if(waitForKey) { glWindow.addGLEventListener(new GLEventListener() { + @Override public void init(final GLAutoDrawable drawable) { } + @Override public void dispose(final GLAutoDrawable drawable) { } + @Override public void display(final GLAutoDrawable drawable) { final GLAnimatorControl actrl = drawable.getAnimator(); if(waitForKey && actrl.getTotalFPSFrames() == 60*3) { @@ -217,6 +221,7 @@ public class TestGearsES2NEWT extends UITestCase { waitForKey = false; } } + @Override public void reshape(final GLAutoDrawable drawable, final int x, final int y, final int width, final int height) { } }); @@ -229,10 +234,12 @@ public class TestGearsES2NEWT extends UITestCase { } glWindow.addWindowListener(new WindowAdapter() { + @Override public void windowResized(final WindowEvent e) { System.err.println("window resized: "+glWindow.getBounds()+" "+glWindow.getSurfaceWidth()+"x"+glWindow.getSurfaceHeight()); NEWTDemoListener.setTitle(glWindow); } + @Override public void windowMoved(final WindowEvent e) { System.err.println("window moved: "+glWindow.getBounds()+" "+glWindow.getSurfaceWidth()+"x"+glWindow.getSurfaceHeight()); NEWTDemoListener.setTitle(glWindow); @@ -308,6 +315,7 @@ public class TestGearsES2NEWT extends UITestCase { if( edt instanceof DefaultEDTUtil ) { newtDemoListener.doQuit(); ((DefaultEDTUtil)edt).invokeAndWaitError(new Runnable() { + @Override public void run() { throw new RuntimeException("XXX Should never ever be seen! - "+Thread.currentThread()); } @@ -334,7 +342,9 @@ public class TestGearsES2NEWT extends UITestCase { System.err.println("Window Supported States: "+glWindow.getSupportedStateMaskString()); 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.getSurfaceWidth()+"x"+glWindow.getSurfaceHeight()+", "+glWindow.getInsets()); + System.err.println("window insets: "+glWindow.getInsets()); + System.err.println("window bounds (window): "+glWindow.getBounds()); + System.err.println("window bounds (pixels): "+glWindow.getSurfaceBounds()); final float[] hasSurfacePixelScale1 = glWindow.getCurrentSurfaceScale(new float[2]); System.err.println("HiDPI PixelScale: "+reqSurfacePixelScale[0]+"x"+reqSurfacePixelScale[1]+" (req) -> "+ @@ -371,6 +381,7 @@ public class TestGearsES2NEWT extends UITestCase { if( edt instanceof DefaultEDTUtil ) { newtDemoListener.doQuit(); ((DefaultEDTUtil)edt).invokeAndWaitError(new Runnable() { + @Override public void run() { throw new RuntimeException("XXX Should never ever be seen!"); } |