From fb57c652fee6be133990cd7afbbd2fdfc084afaa Mon Sep 17 00:00:00 2001
From: Sven Gothel
+ * Implementation:
+ *
+ *
+ *
+ * All required locks are being claimed. + *
+ * @param newWidth new width in pixel units + * @param newWidth new height in pixel units + */ public final void windowResizedOp(int newWidth, int newHeight) { super.defaultWindowResizedOp(newWidth, newHeight); } diff --git a/src/jogl/classes/com/jogamp/opengl/swt/GLCanvas.java b/src/jogl/classes/com/jogamp/opengl/swt/GLCanvas.java index 1c6dced6a..ec0935c18 100644 --- a/src/jogl/classes/com/jogamp/opengl/swt/GLCanvas.java +++ b/src/jogl/classes/com/jogamp/opengl/swt/GLCanvas.java @@ -455,12 +455,12 @@ public class GLCanvas extends Canvas implements GLAutoDrawable, GLSharedContextS public final void destroy(ProxySurface s) { /* nop */ } @Override - public final int getPixelWidth(ProxySurface s) { + public final int getSurfaceWidth(ProxySurface s) { return clientArea.width; } @Override - public final int getPixelHeight(ProxySurface s) { + public final int getSurfaceHeight(ProxySurface s) { return clientArea.height; } diff --git a/src/jogl/classes/javax/media/opengl/GLEventListener.java b/src/jogl/classes/javax/media/opengl/GLEventListener.java index c8c3440b5..995ca2620 100644 --- a/src/jogl/classes/javax/media/opengl/GLEventListener.java +++ b/src/jogl/classes/javax/media/opengl/GLEventListener.java @@ -80,13 +80,23 @@ public interface GLEventListener extends EventListener { enabled. */ public void display(GLAutoDrawable drawable); - /** Called by the drawable during the first repaint after the - component has been resized. The client can update the viewport - and view volume of the window appropriately, for example by a - call to {@link javax.media.opengl.GL#glViewport}; note that for - convenience the component has already calledglViewport(x,
- y, width, height)
when this method is called, so the
- client may not have to do anything in this method.
- */
+ /**
+ * Called by the drawable during the first repaint after the
+ * component has been resized.
+ * + * The client can update it's viewport associated data + * and view volume of the window appropriately. + *
+ *
+ * For efficiency the GL viewport has already been updated
+ * via glViewport(x, y, width, height)
when this method is called.
+ *
* This drawable is being locked during operation. *
* @param context the {@link GLContext} bound to this drawable, will be made current during operation * A prev. current context will be make current after operation. - * @param newWidth - * @param newHeight + * @param newWidth new width in pixel units + * @param newHeight new width in pixel units * @throws NativeWindowException in case the surface could no be locked * @throws GLException in case an error during the resize operation occurred */ - void setSize(GLContext context, int newWidth, int newHeight) throws NativeWindowException, GLException; + void setSurfaceSize(GLContext context, int newWidth, int newHeight) throws NativeWindowException, GLException; } } diff --git a/src/jogl/classes/javax/media/opengl/GLOffscreenAutoDrawable.java b/src/jogl/classes/javax/media/opengl/GLOffscreenAutoDrawable.java index d34edaf2e..a69480242 100644 --- a/src/jogl/classes/javax/media/opengl/GLOffscreenAutoDrawable.java +++ b/src/jogl/classes/javax/media/opengl/GLOffscreenAutoDrawable.java @@ -37,19 +37,19 @@ import com.jogamp.opengl.FBObject; * exposing offscreen functionality. ** This class distinguishes itself from {@link GLAutoDrawable} - * with it's {@link #setSize(int, int)} functionality. + * with it's {@link #setSurfaceSize(int, int)} functionality. *
*/ public interface GLOffscreenAutoDrawable extends GLAutoDrawable, GLSharedContextSetter { /** - * Resize this auto drawable. - * @param newWidth - * @param newHeight + * Resize this {@link GLAutoDrawable}'s surface + * @param newWidth new width in pixel units + * @param newHeight new height in pixel units * @throws NativeWindowException in case the surface could no be locked * @throws GLException in case of an error during the resize operation */ - void setSize(int newWidth, int newHeight) throws NativeWindowException, GLException; + void setSurfaceSize(int newWidth, int newHeight) throws NativeWindowException, GLException; /** * Set the upstream UI toolkit object. diff --git a/src/jogl/classes/javax/media/opengl/awt/GLCanvas.java b/src/jogl/classes/javax/media/opengl/awt/GLCanvas.java index c5ce32827..d06b61624 100644 --- a/src/jogl/classes/javax/media/opengl/awt/GLCanvas.java +++ b/src/jogl/classes/javax/media/opengl/awt/GLCanvas.java @@ -101,7 +101,6 @@ import com.jogamp.opengl.JoglVersion; import com.jogamp.opengl.util.GLDrawableUtil; import com.jogamp.opengl.util.TileRenderer; -import jogamp.nativewindow.jawt.JAWTUtil; import jogamp.opengl.Debug; import jogamp.opengl.GLContextImpl; import jogamp.opengl.GLDrawableHelper; diff --git a/src/jogl/classes/jogamp/opengl/GLAutoDrawableBase.java b/src/jogl/classes/jogamp/opengl/GLAutoDrawableBase.java index de7653570..493926f25 100644 --- a/src/jogl/classes/jogamp/opengl/GLAutoDrawableBase.java +++ b/src/jogl/classes/jogamp/opengl/GLAutoDrawableBase.java @@ -216,8 +216,23 @@ public abstract class GLAutoDrawableBase implements GLAutoDrawable, GLStateKeepe } } - /** Default implementation to handle resize events from the windowing system. All required locks are being claimed. */ - protected final void defaultWindowResizedOp(int newWidth, int newHeight) throws NativeWindowException, GLException { + /** + * Handling resize events from the windowing system. + *+ * Implementation: + *
+ * All required locks are being claimed. + *
+ * @param newWidth new width in pixel units + * @param newWidth new height in pixel units + */ + protected final void defaultWindowResizedOp(final int newWidth, final int newHeight) throws NativeWindowException, GLException { GLDrawableImpl _drawable = drawable; if( null!=_drawable ) { if(DEBUG) { diff --git a/src/jogl/classes/jogamp/opengl/GLDrawableHelper.java b/src/jogl/classes/jogamp/opengl/GLDrawableHelper.java index 6116a2886..c0603383a 100644 --- a/src/jogl/classes/jogamp/opengl/GLDrawableHelper.java +++ b/src/jogl/classes/jogamp/opengl/GLDrawableHelper.java @@ -362,7 +362,7 @@ public class GLDrawableHelper { final ProxySurface ps = (ProxySurface) ns; final UpstreamSurfaceHook ush = ps.getUpstreamSurfaceHook(); if(ush instanceof UpstreamSurfaceHook.MutableSize) { - ((UpstreamSurfaceHook.MutableSize)ush).setPixelSize(newWidth, newHeight); + ((UpstreamSurfaceHook.MutableSize)ush).setSurfaceSize(newWidth, newHeight); } else if(DEBUG) { // we have to assume UpstreamSurfaceHook contains the new size already, hence size check @ bottom System.err.println("GLDrawableHelper.resizeOffscreenDrawable: Drawable's offscreen ProxySurface n.a. UpstreamSurfaceHook.MutableSize, but "+ush.getClass().getName()+": "+ush); } diff --git a/src/jogl/classes/jogamp/opengl/GLFBODrawableImpl.java b/src/jogl/classes/jogamp/opengl/GLFBODrawableImpl.java index 0e9d3c1bb..bf6a56afe 100644 --- a/src/jogl/classes/jogamp/opengl/GLFBODrawableImpl.java +++ b/src/jogl/classes/jogamp/opengl/GLFBODrawableImpl.java @@ -565,7 +565,7 @@ public class GLFBODrawableImpl extends GLDrawableImpl implements GLFBODrawable { } @Override - public final void setSize(GLContext context, int newWidth, int newHeight) throws NativeWindowException, GLException { + public final void setSurfaceSize(GLContext context, int newWidth, int newHeight) throws NativeWindowException, GLException { if(DEBUG) { System.err.println("GLFBODrawableImpl.ResizeableImpl setSize: ("+getThreadName()+"): "+newWidth+"x"+newHeight+" - surfaceHandle 0x"+Long.toHexString(getNativeSurface().getSurfaceHandle())); } @@ -578,7 +578,7 @@ public class GLFBODrawableImpl extends GLDrawableImpl implements GLFBODrawable { final ProxySurface ps = (ProxySurface) getNativeSurface(); final UpstreamSurfaceHook ush = ps.getUpstreamSurfaceHook(); if(ush instanceof UpstreamSurfaceHook.MutableSize) { - ((UpstreamSurfaceHook.MutableSize)ush).setPixelSize(newWidth, newHeight); + ((UpstreamSurfaceHook.MutableSize)ush).setSurfaceSize(newWidth, newHeight); } else { throw new InternalError("GLFBODrawableImpl.ResizableImpl's ProxySurface doesn't hold a UpstreamSurfaceHookMutableSize but "+ush.getClass().getName()+", "+ps+", ush"); } diff --git a/src/jogl/classes/jogamp/opengl/GLOffscreenAutoDrawableImpl.java b/src/jogl/classes/jogamp/opengl/GLOffscreenAutoDrawableImpl.java index 345f08e4c..edfebdcfe 100644 --- a/src/jogl/classes/jogamp/opengl/GLOffscreenAutoDrawableImpl.java +++ b/src/jogl/classes/jogamp/opengl/GLOffscreenAutoDrawableImpl.java @@ -57,7 +57,7 @@ public class GLOffscreenAutoDrawableImpl extends GLAutoDrawableDelegate implemen } @Override - public void setSize(int newWidth, int newHeight) throws NativeWindowException, GLException { + public void setSurfaceSize(int newWidth, int newHeight) throws NativeWindowException, GLException { this.defaultWindowResizedOp(newWidth, newHeight); } diff --git a/src/jogl/classes/jogamp/opengl/egl/EGLDummyUpstreamSurfaceHook.java b/src/jogl/classes/jogamp/opengl/egl/EGLDummyUpstreamSurfaceHook.java index 6deaa26c7..205a94951 100644 --- a/src/jogl/classes/jogamp/opengl/egl/EGLDummyUpstreamSurfaceHook.java +++ b/src/jogl/classes/jogamp/opengl/egl/EGLDummyUpstreamSurfaceHook.java @@ -10,10 +10,10 @@ import com.jogamp.nativewindow.egl.EGLGraphicsDevice; /** Uses a PBuffer offscreen surface */ public class EGLDummyUpstreamSurfaceHook extends UpstreamSurfaceHookMutableSize { /** - * @param width the initial width as returned by {@link NativeSurface#getSurfaceWidth()} via {@link UpstreamSurfaceHook#getPixelWidth(ProxySurface)}, + * @param width the initial width as returned by {@link NativeSurface#getSurfaceWidth()} via {@link UpstreamSurfaceHook#getSurfaceWidth(ProxySurface)}, * not the actual dummy surface width. * The latter is platform specific and small - * @param height the initial height as returned by {@link NativeSurface#getSurfaceHeight()} via {@link UpstreamSurfaceHook#getPixelHeight(ProxySurface)}, + * @param height the initial height as returned by {@link NativeSurface#getSurfaceHeight()} via {@link UpstreamSurfaceHook#getSurfaceHeight(ProxySurface)}, * not the actual dummy surface height, * The latter is platform specific and small */ diff --git a/src/jogl/classes/jogamp/opengl/egl/EGLUpstreamSurfaceHook.java b/src/jogl/classes/jogamp/opengl/egl/EGLUpstreamSurfaceHook.java index 8cc4580a7..d0dc79437 100644 --- a/src/jogl/classes/jogamp/opengl/egl/EGLUpstreamSurfaceHook.java +++ b/src/jogl/classes/jogamp/opengl/egl/EGLUpstreamSurfaceHook.java @@ -45,9 +45,9 @@ public class EGLUpstreamSurfaceHook implements UpstreamSurfaceHook.MutableSize { static String getThreadName() { return Thread.currentThread().getName(); } @Override - public final void setPixelSize(int width, int height) { + public final void setSurfaceSize(int width, int height) { if(null != upstreamSurfaceHookMutableSize) { - upstreamSurfaceHookMutableSize.setPixelSize(width, height); + upstreamSurfaceHookMutableSize.setSurfaceSize(width, height); } } @@ -199,12 +199,12 @@ public class EGLUpstreamSurfaceHook implements UpstreamSurfaceHook.MutableSize { } @Override - public final int getPixelWidth(ProxySurface s) { + public final int getSurfaceWidth(ProxySurface s) { return upstreamSurface.getSurfaceWidth(); } @Override - public final int getPixelHeight(ProxySurface s) { + public final int getSurfaceHeight(ProxySurface s) { return upstreamSurface.getSurfaceHeight(); } diff --git a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLContext.java b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLContext.java index d3cfffdea..485fbd0a0 100644 --- a/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLContext.java +++ b/src/jogl/classes/jogamp/opengl/macosx/cgl/MacOSXCGLContext.java @@ -859,11 +859,7 @@ public class MacOSXCGLContext extends GLContextImpl } // All CALayer lifecycle ops are deferred on main-thread - final int[] winSize; - { - final int[] pixelSize = { lastWidth, lastHeight }; - winSize = drawable.getNativeSurface().getWindowUnitXY(pixelSize, pixelSize); - } + final int[] winSize = drawable.getNativeSurface().convertToWindowUnits(new int[]{ lastWidth, lastHeight }); attachGLLayerCmd = new AttachGLLayerCmd( backingLayerHost, ctx, gl3ShaderProgramName, pixelFormat, pbufferHandle, texID, chosenCaps.isBackgroundOpaque(), lastWidth, lastHeight, winSize[0], winSize[1] ); diff --git a/src/nativewindow/classes/com/jogamp/nativewindow/DelegatedUpstreamSurfaceHookWithSurfaceSize.java b/src/nativewindow/classes/com/jogamp/nativewindow/DelegatedUpstreamSurfaceHookWithSurfaceSize.java index db4a979d1..9a462105f 100644 --- a/src/nativewindow/classes/com/jogamp/nativewindow/DelegatedUpstreamSurfaceHookWithSurfaceSize.java +++ b/src/nativewindow/classes/com/jogamp/nativewindow/DelegatedUpstreamSurfaceHookWithSurfaceSize.java @@ -10,7 +10,7 @@ public class DelegatedUpstreamSurfaceHookWithSurfaceSize implements UpstreamSurf /** * @param upstream optional upstream UpstreamSurfaceHook used for {@link #create(ProxySurface)} and {@link #destroy(ProxySurface)}. - * @param surface mandatory {@link NativeSurface} used for {@link #getPixelWidth(ProxySurface)} and {@link #getPixelHeight(ProxySurface)} + * @param surface mandatory {@link NativeSurface} used for {@link #getSurfaceWidth(ProxySurface)} and {@link #getSurfaceHeight(ProxySurface)} */ public DelegatedUpstreamSurfaceHookWithSurfaceSize(UpstreamSurfaceHook upstream, NativeSurface surface) { this.upstream = upstream; @@ -35,12 +35,12 @@ public class DelegatedUpstreamSurfaceHookWithSurfaceSize implements UpstreamSurf } @Override - public final int getPixelWidth(ProxySurface s) { + public final int getSurfaceWidth(ProxySurface s) { return surface.getSurfaceWidth(); } @Override - public final int getPixelHeight(ProxySurface s) { + public final int getSurfaceHeight(ProxySurface s) { return surface.getSurfaceHeight(); } diff --git a/src/nativewindow/classes/com/jogamp/nativewindow/UpstreamSurfaceHookMutableSize.java b/src/nativewindow/classes/com/jogamp/nativewindow/UpstreamSurfaceHookMutableSize.java index 5910f5fea..25e2bbd49 100644 --- a/src/nativewindow/classes/com/jogamp/nativewindow/UpstreamSurfaceHookMutableSize.java +++ b/src/nativewindow/classes/com/jogamp/nativewindow/UpstreamSurfaceHookMutableSize.java @@ -16,18 +16,18 @@ public class UpstreamSurfaceHookMutableSize implements UpstreamSurfaceHook.Mutab } @Override - public final void setPixelSize(int width, int height) { + public final void setSurfaceSize(int width, int height) { this.pixWidth = width; this.pixHeight = height; } @Override - public final int getPixelWidth(ProxySurface s) { + public final int getSurfaceWidth(ProxySurface s) { return pixWidth; } @Override - public final int getPixelHeight(ProxySurface s) { + public final int getSurfaceHeight(ProxySurface s) { return pixHeight; } @Override diff --git a/src/nativewindow/classes/com/jogamp/nativewindow/UpstreamWindowHookMutableSizePos.java b/src/nativewindow/classes/com/jogamp/nativewindow/UpstreamWindowHookMutableSizePos.java index f761b522a..2e9a33801 100644 --- a/src/nativewindow/classes/com/jogamp/nativewindow/UpstreamWindowHookMutableSizePos.java +++ b/src/nativewindow/classes/com/jogamp/nativewindow/UpstreamWindowHookMutableSizePos.java @@ -28,6 +28,9 @@ public class UpstreamWindowHookMutableSizePos extends UpstreamSurfaceHookMutable public final void setWinSize(int winWidth, int winHeight) { this.winWidth= winWidth; this.winHeight= winHeight; + // FIXME HiDPI: Use pixelScale ?! + // FIXME HiDPI: Consider setting winWidth/winHeight by setSurfaceSize(..) (back-propagation) + this.setSurfaceSize(winWidth, winHeight); } public final int getX() { diff --git a/src/nativewindow/classes/com/jogamp/nativewindow/awt/JAWTWindow.java b/src/nativewindow/classes/com/jogamp/nativewindow/awt/JAWTWindow.java index e35716c49..24bc8fa51 100644 --- a/src/nativewindow/classes/com/jogamp/nativewindow/awt/JAWTWindow.java +++ b/src/nativewindow/classes/com/jogamp/nativewindow/awt/JAWTWindow.java @@ -648,19 +648,19 @@ public abstract class JAWTWindow implements NativeWindow, OffscreenLayerSurface, } @Override - public final int[] getWindowUnitXY(int[] result, final int[] pixelUnitXY) { + public final int[] convertToWindowUnits(final int[] pixelUnitsAndResult) { final int scale = getPixelScale(); - result[0] = pixelUnitXY[0] / scale; - result[1] = pixelUnitXY[1] / scale; - return result; + pixelUnitsAndResult[0] /= scale; + pixelUnitsAndResult[1] /= scale; + return pixelUnitsAndResult; } @Override - public final int[] getPixelUnitXY(int[] result, final int[] windowUnitXY) { + public final int[] convertToPixelUnits(final int[] windowUnitsAndResult) { final int scale = getPixelScale(); - result[0] = windowUnitXY[0] * scale; - result[1] = windowUnitXY[1] * scale; - return result; + windowUnitsAndResult[0] *= scale; + windowUnitsAndResult[1] *= scale; + return windowUnitsAndResult; } @Override diff --git a/src/nativewindow/classes/javax/media/nativewindow/NativeSurface.java b/src/nativewindow/classes/javax/media/nativewindow/NativeSurface.java index d5cc048a1..f8596bc74 100644 --- a/src/nativewindow/classes/javax/media/nativewindow/NativeSurface.java +++ b/src/nativewindow/classes/javax/media/nativewindow/NativeSurface.java @@ -181,7 +181,7 @@ public interface NativeSurface extends SurfaceUpdatedListener { * Returns the width of the client area excluding insets (window decorations) in pixel units. * @return width of the client area in pixel units * @see NativeWindow#getWindowWidth() - * @see #getWindowUnitXY(int[], int[]) + * @see #convertToWindowUnits(int[]) */ public int getSurfaceWidth(); @@ -189,25 +189,25 @@ public interface NativeSurface extends SurfaceUpdatedListener { * Returns the height of the client area excluding insets (window decorations) in pixel units. * @return height of the client area in pixel units * @see NativeWindow#getWindowHeight() - * @see #getWindowUnitXY(int[], int[]) + * @see #convertToWindowUnits(int[]) */ public int getSurfaceHeight(); /** - * Converts the given pixel units into window units. - * @param result int[2] storage for the result, may be equal to pixelUnitXY (in-place) - * @param pixelUnitXY int[2] x- and y-coord values in pixel units - * @return result int[2] storage for chaining holding the converted values + * Converts the given pixel units into window units in place. + * @param pixelUnitsAndResult int[2] storage holding the pixel units for the x- and y-coord to convert + * and the resulting values. + * @return result int[2] storage pixelUnitsAndResult for chaining holding the converted values */ - public int[] getWindowUnitXY(int[] result, final int[] pixelUnitXY); + public int[] convertToWindowUnits(final int[] pixelUnitsAndResult); /** - * Converts the given window units into pixel units. - * @param result int[2] storage for the result, may be equal to windowUnitXY (in-place) - * @param windowUnitXY int[2] x- and y-coord values in window units - * @return result int[2] storage for chaining holding the converted values + * Converts the given window units into pixel units in place. + * @param windowUnitsAndResult int[2] storage holding the window units for the x- and y-coord to convert + * and the resulting values. + * @return result int[2] storage windowUnitsAndResult for chaining holding the converted values */ - public int[] getPixelUnitXY(int[] result, final int[] windowUnitXY); + public int[] convertToPixelUnits(final int[] windowUnitsAndResult); /** * Returns the graphics configuration corresponding to this window. diff --git a/src/nativewindow/classes/javax/media/nativewindow/UpstreamSurfaceHook.java b/src/nativewindow/classes/javax/media/nativewindow/UpstreamSurfaceHook.java index 39e316856..1a13b050a 100644 --- a/src/nativewindow/classes/javax/media/nativewindow/UpstreamSurfaceHook.java +++ b/src/nativewindow/classes/javax/media/nativewindow/UpstreamSurfaceHook.java @@ -39,14 +39,19 @@ public interface UpstreamSurfaceHook { public void destroy(ProxySurface s); /** Returns the width of the upstream surface in pixels, used if {@link ProxySurface#UPSTREAM_PROVIDES_SIZE} is set. */ - public int getPixelWidth(ProxySurface s); + public int getSurfaceWidth(ProxySurface s); /** Returns the height of the upstream surface in pixels, used if {@link ProxySurface#UPSTREAM_PROVIDES_SIZE} is set. */ - public int getPixelHeight(ProxySurface s); + public int getSurfaceHeight(ProxySurface s); /** * {@link UpstreamSurfaceHook} w/ mutable size, allowing it's {@link ProxySurface} user to resize. */ public interface MutableSize extends UpstreamSurfaceHook { - public void setPixelSize(int width, int height); + /** + * Resizes the upstream surface. + * @param width new width in pixel units + * @param height new height in pixel units + */ + public void setSurfaceSize(int width, int height); } } diff --git a/src/nativewindow/classes/javax/media/nativewindow/util/Point.java b/src/nativewindow/classes/javax/media/nativewindow/util/Point.java index 331c1388e..e544118d0 100644 --- a/src/nativewindow/classes/javax/media/nativewindow/util/Point.java +++ b/src/nativewindow/classes/javax/media/nativewindow/util/Point.java @@ -106,22 +106,54 @@ public class Point implements Cloneable, PointImmutable { public final void setX(int x) { this.x = x; } public final void setY(int y) { this.y = y; } + /** + * Translate this instance's x- and y-components, + * i.e. add the values of the given delta point to them. + * @param pd delta point + * @return this instance for scaling + */ public final Point translate(Point pd) { x += pd.x ; y += pd.y ; return this; } + /** + * Translate this instance's x- and y-components, + * i.e. add the given deltas to them. + * @param dx delta for x + * @param dy delta for y + * @return this instance for scaling + */ public final Point translate(int dx, int dy) { x += dx ; y += dy ; return this; } + /** + * Scale this instance's x- and y-components, + * i.e. multiply them by the given scale factors. + * @param sx scale factor for x + * @param sy scale factor for y + * @return this instance for scaling + */ public final Point scale(int sx, int sy) { x *= sx ; y *= sy ; return this; } + /** + * Inverse scale this instance's x- and y-components, + * i.e. divide them by the given scale factors. + * @param sx inverse scale factor for x + * @param sy inverse scale factor for y + * @return this instance for scaling + */ + public final Point scaleInv(int sx, int sy) { + x /= sx ; + y /= sy ; + return this; + } } diff --git a/src/nativewindow/classes/jogamp/nativewindow/ProxySurfaceImpl.java b/src/nativewindow/classes/jogamp/nativewindow/ProxySurfaceImpl.java index dd1b6f185..969e012a6 100644 --- a/src/nativewindow/classes/jogamp/nativewindow/ProxySurfaceImpl.java +++ b/src/nativewindow/classes/jogamp/nativewindow/ProxySurfaceImpl.java @@ -150,12 +150,12 @@ public abstract class ProxySurfaceImpl implements ProxySurface { @Override public final int getSurfaceWidth() { - return upstream.getPixelWidth(this); + return upstream.getSurfaceWidth(this); } @Override public final int getSurfaceHeight() { - return upstream.getPixelHeight(this); + return upstream.getSurfaceHeight(this); } @Override diff --git a/src/nativewindow/classes/jogamp/nativewindow/WrappedSurface.java b/src/nativewindow/classes/jogamp/nativewindow/WrappedSurface.java index 5601dac02..902223c80 100644 --- a/src/nativewindow/classes/jogamp/nativewindow/WrappedSurface.java +++ b/src/nativewindow/classes/jogamp/nativewindow/WrappedSurface.java @@ -98,20 +98,13 @@ public class WrappedSurface extends ProxySurfaceImpl { } @Override - public final int[] getWindowUnitXY(int[] result, final int[] pixelUnitXY) { - final int scale = 1; // FIXME: Use 'scale' .. - result[0] = pixelUnitXY[0] / scale; - result[1] = pixelUnitXY[1] / scale; - return result; + public final int[] convertToWindowUnits(final int[] pixelUnitsAndResult) { + return pixelUnitsAndResult; // FIXME HiDPI: use 'pixelScale' } @Override - public final int[] getPixelUnitXY(int[] result, final int[] windowUnitXY) { - final int scale = 1; // FIXME: Use 'scale' .. - result[0] = windowUnitXY[0] * scale; - result[1] = windowUnitXY[1] * scale; - return result; + public final int[] convertToPixelUnits(final int[] windowUnitsAndResult) { + return windowUnitsAndResult; // FIXME HiDPI: use 'pixelScale' } - -} +} \ No newline at end of file diff --git a/src/nativewindow/classes/jogamp/nativewindow/macosx/OSXDummyUpstreamSurfaceHook.java b/src/nativewindow/classes/jogamp/nativewindow/macosx/OSXDummyUpstreamSurfaceHook.java index 5a51aca3e..98ea68f4f 100644 --- a/src/nativewindow/classes/jogamp/nativewindow/macosx/OSXDummyUpstreamSurfaceHook.java +++ b/src/nativewindow/classes/jogamp/nativewindow/macosx/OSXDummyUpstreamSurfaceHook.java @@ -11,10 +11,10 @@ public class OSXDummyUpstreamSurfaceHook extends UpstreamSurfaceHookMutableSize long nsWindow; /** - * @param width the initial width as returned by {@link NativeSurface#getSurfaceWidth()} via {@link UpstreamSurfaceHook#getPixelWidth(ProxySurface)}, + * @param width the initial width as returned by {@link NativeSurface#getSurfaceWidth()} via {@link UpstreamSurfaceHook#getSurfaceWidth(ProxySurface)}, * not the actual dummy surface width. * The latter is platform specific and small - * @param height the initial height as returned by {@link NativeSurface#getSurfaceHeight()} via {@link UpstreamSurfaceHook#getPixelHeight(ProxySurface)}, + * @param height the initial height as returned by {@link NativeSurface#getSurfaceHeight()} via {@link UpstreamSurfaceHook#getSurfaceHeight(ProxySurface)}, * not the actual dummy surface height, * The latter is platform specific and small */ diff --git a/src/nativewindow/classes/jogamp/nativewindow/windows/GDIDummyUpstreamSurfaceHook.java b/src/nativewindow/classes/jogamp/nativewindow/windows/GDIDummyUpstreamSurfaceHook.java index 9c74950e0..bf59a6639 100644 --- a/src/nativewindow/classes/jogamp/nativewindow/windows/GDIDummyUpstreamSurfaceHook.java +++ b/src/nativewindow/classes/jogamp/nativewindow/windows/GDIDummyUpstreamSurfaceHook.java @@ -9,10 +9,10 @@ import com.jogamp.nativewindow.UpstreamSurfaceHookMutableSize; public class GDIDummyUpstreamSurfaceHook extends UpstreamSurfaceHookMutableSize { /** - * @param width the initial width as returned by {@link NativeSurface#getSurfaceWidth()} via {@link UpstreamSurfaceHook#getPixelWidth(ProxySurface)}, + * @param width the initial width as returned by {@link NativeSurface#getSurfaceWidth()} via {@link UpstreamSurfaceHook#getSurfaceWidth(ProxySurface)}, * not the actual dummy surface width. * The latter is platform specific and small - * @param height the initial height as returned by {@link NativeSurface#getSurfaceHeight()} via {@link UpstreamSurfaceHook#getPixelHeight(ProxySurface)}, + * @param height the initial height as returned by {@link NativeSurface#getSurfaceHeight()} via {@link UpstreamSurfaceHook#getSurfaceHeight(ProxySurface)}, * not the actual dummy surface height, * The latter is platform specific and small */ diff --git a/src/nativewindow/classes/jogamp/nativewindow/windows/GDISurface.java b/src/nativewindow/classes/jogamp/nativewindow/windows/GDISurface.java index c4ec0f653..c9e48e94e 100644 --- a/src/nativewindow/classes/jogamp/nativewindow/windows/GDISurface.java +++ b/src/nativewindow/classes/jogamp/nativewindow/windows/GDISurface.java @@ -130,19 +130,13 @@ public class GDISurface extends ProxySurfaceImpl { } @Override - public final int[] getWindowUnitXY(int[] result, final int[] pixelUnitXY) { - if( pixelUnitXY != result ) { // no scale factor, window units == pixel units - System.arraycopy(pixelUnitXY, 0, result, 0, 2); - } - return result; + public final int[] convertToWindowUnits(final int[] pixelUnitsAndResult) { + return pixelUnitsAndResult; // no pixelScale factor } @Override - public final int[] getPixelUnitXY(int[] result, final int[] windowUnitXY) { - if( windowUnitXY != result ) { // no scale factor, window units == pixel units - System.arraycopy(windowUnitXY, 0, result, 0, 2); - } - return result; + public final int[] convertToPixelUnits(final int[] windowUnitsAndResult) { + return windowUnitsAndResult; // no pixelScale factor } } diff --git a/src/nativewindow/classes/jogamp/nativewindow/x11/X11DummyUpstreamSurfaceHook.java b/src/nativewindow/classes/jogamp/nativewindow/x11/X11DummyUpstreamSurfaceHook.java index 31d168fea..53b303071 100644 --- a/src/nativewindow/classes/jogamp/nativewindow/x11/X11DummyUpstreamSurfaceHook.java +++ b/src/nativewindow/classes/jogamp/nativewindow/x11/X11DummyUpstreamSurfaceHook.java @@ -14,10 +14,10 @@ import com.jogamp.nativewindow.x11.X11GraphicsScreen; public class X11DummyUpstreamSurfaceHook extends UpstreamSurfaceHookMutableSize { /** - * @param width the initial width as returned by {@link NativeSurface#getSurfaceWidth()} via {@link UpstreamSurfaceHook#getPixelWidth(ProxySurface)}, + * @param width the initial width as returned by {@link NativeSurface#getSurfaceWidth()} via {@link UpstreamSurfaceHook#getSurfaceWidth(ProxySurface)}, * not the actual dummy surface width. * The latter is platform specific and small - * @param height the initial height as returned by {@link NativeSurface#getSurfaceHeight()} via {@link UpstreamSurfaceHook#getPixelHeight(ProxySurface)}, + * @param height the initial height as returned by {@link NativeSurface#getSurfaceHeight()} via {@link UpstreamSurfaceHook#getSurfaceHeight(ProxySurface)}, * not the actual dummy surface height, * The latter is platform specific and small */ diff --git a/src/newt/classes/com/jogamp/newt/MonitorDevice.java b/src/newt/classes/com/jogamp/newt/MonitorDevice.java index 2d1d912c7..1198f7681 100644 --- a/src/newt/classes/com/jogamp/newt/MonitorDevice.java +++ b/src/newt/classes/com/jogamp/newt/MonitorDevice.java @@ -168,12 +168,19 @@ public abstract class MonitorDevice { return supportedModes.getData(); } - /** Returns the {@link RectangleImmutable rectangular} portion of the rotated virtual {@link Screen} size represented by this monitor. */ + /** + * Returns the {@link RectangleImmutable rectangular} portion + * of the rotated virtual {@link Screen} size in screen/window units + * represented by this monitor. + */ public final RectangleImmutable getViewport() { return viewport; } - /** Returnstrue
if given coordinates are contained by this {@link #getViewport() viewport}, otherwise false
. */
+ /**
+ * Returns true
if given screen coordinates in screen/window units
+ * are contained by this {@link #getViewport() viewport}, otherwise false
.
+ */
public final boolean contains(int x, int y) {
return x >= viewport.getX() &&
x < viewport.getX() + viewport.getWidth() &&
diff --git a/src/newt/classes/com/jogamp/newt/NewtFactory.java b/src/newt/classes/com/jogamp/newt/NewtFactory.java
index 3b31861f0..4443c70c9 100644
--- a/src/newt/classes/com/jogamp/newt/NewtFactory.java
+++ b/src/newt/classes/com/jogamp/newt/NewtFactory.java
@@ -296,7 +296,7 @@ public class NewtFactory {
}
final Window win = WindowImpl.create(parentWindow, 0, screen, caps);
- win.setSize(parentWindow.getSurfaceWidth(), parentWindow.getSurfaceHeight());
+ win.setSize(parentWindow.getWindowWidth(), parentWindow.getWindowHeight());
if ( null != newtParentWindow ) {
newtParentWindow.addChild(win);
win.setVisible(newtParentWindow.isVisible());
diff --git a/src/newt/classes/com/jogamp/newt/Screen.java b/src/newt/classes/com/jogamp/newt/Screen.java
index ef62ec95d..2a713c538 100644
--- a/src/newt/classes/com/jogamp/newt/Screen.java
+++ b/src/newt/classes/com/jogamp/newt/Screen.java
@@ -131,27 +131,27 @@ public abstract class Screen {
public abstract int getIndex();
/**
- * @return the x position of the virtual viewport's top-left origin.
+ * @return the x position of the virtual viewport's top-left origin in screen/window units.
*/
public abstract int getX();
/**
- * @return the y position of the virtual viewport's top-left origin.
+ * @return the y position of the virtual viewport's top-left origin in screen/window units.
*/
public abstract int getY();
/**
- * @return the rotated virtual viewport's width.
+ * @return the rotated virtual viewport's width in screen/window units.
*/
public abstract int getWidth();
/**
- * @return the rotated virtual viewport's height.
+ * @return the rotated virtual viewport's height in screen/window units.
*/
public abstract int getHeight();
/**
- * @return the rotated virtual viewport, i.e. origin and size.
+ * @return the rotated virtual viewport, i.e. origin and size in screen/window units.
*/
public abstract RectangleImmutable getViewport();
@@ -186,6 +186,7 @@ public abstract class Screen {
* * If no coverage is detected the first {@link MonitorDevice} is returned. *
+ * @param r arbitrary rectangle in screen/window units */ public final MonitorDevice getMainMonitor(RectangleImmutable r) { MonitorDevice res = null; @@ -206,7 +207,7 @@ public abstract class Screen { } /** - * Returns the union of all monitor's {@link MonitorDevice#getViewport() viewport}. + * Returns the union of all monitor's {@link MonitorDevice#getViewport() viewport} in screen/window units. ** Should be equal to {@link #getX()}, {@link #getY()}, {@link #getWidth()} and {@link #getHeight()}, * however, some native toolkits may choose a different virtual screen area. @@ -257,7 +258,7 @@ public abstract class Screen { synchronized(screenList) { int i = fromIndex >= 0 ? fromIndex : screenList.size() - 1 ; while( ( incr > 0 ) ? i < screenList.size() : i >= 0 ) { - final Screen screen = (Screen) screenList.get(i).get(); + final Screen screen = screenList.get(i).get(); if( null == screen ) { // Clear GC'ed dead reference entry! screenList.remove(i); diff --git a/src/newt/classes/com/jogamp/newt/Window.java b/src/newt/classes/com/jogamp/newt/Window.java index 9cf67c56f..b733406e8 100644 --- a/src/newt/classes/com/jogamp/newt/Window.java +++ b/src/newt/classes/com/jogamp/newt/Window.java @@ -46,6 +46,7 @@ import javax.media.nativewindow.CapabilitiesChooser; import javax.media.nativewindow.CapabilitiesImmutable; import javax.media.nativewindow.NativeWindow; import javax.media.nativewindow.WindowClosingProtocol; +import javax.media.nativewindow.util.Point; import javax.media.nativewindow.util.RectangleImmutable; /** @@ -251,10 +252,37 @@ public interface Window extends NativeWindow, WindowClosingProtocol { * @param width of the window's client area in window units * @param height of the window's client area in window units * + * @see #setSurfaceSize(int, int) + * @see #setTopLevelSize(int, int) * @see #getInsets() */ void setSize(int width, int height); + /** + * Sets the size of the window's surface in pixel units which claims the window's client area excluding decorations. + * + *
+ * Zero size semantics are respected, see {@link #setVisible(boolean)}:
+ *
+ * if ( visible && 0 != windowHandle && ( 0 ≥ width || 0 ≥ height ) ) { + * setVisible(false); + * } else if ( visible && 0 == windowHandle && 0 < width && 0 < height ) { + * setVisible(true); + * } else { + * // as expected .. + * } + *+ *
+ * This call is ignored if in fullscreen mode.
* Since the position reflects the client area, it does not include the insets. *
@@ -722,7 +722,8 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer */ protected abstract Point getLocationOnScreenImpl(int x, int y); - /** Triggered by user via {@link #getInsets()}.* This methods issues {@link android.view.Window#setContentView(android.view.View, android.view.ViewGroup.LayoutParams) androidWindow.setContenView(newtWindow.getAndroidView())} * and finally calls {@link #registerNEWTWindow(Window)}. - *
+ * * @param androidWindow * @param newtWindow * @throws IllegalArgumentException if thenewtWindow
's {@link Window#getDelegatedWindow() delegate} is not an AndroidDriver.
@@ -128,7 +128,7 @@ public class NewtBaseActivity extends Activity {
final WindowDriver newtAWindow = (WindowDriver)delegateWindow;
androidWindow.setContentView(newtAWindow.getAndroidView());
} else {
- throw new IllegalArgumentException("Given NEWT Window is not an Android Window: "+newtWindow.getClass().getName());
+ throw new IllegalArgumentException("Given NEWT Window is not an Android Window: "+newtWindow.getClass().getName());
}
registerNEWTWindow(newtWindow);
}
@@ -137,7 +137,7 @@ public class NewtBaseActivity extends Activity {
* * This methods issues {@link android.view.Window#addContentView(android.view.View, android.view.ViewGroup.LayoutParams) androidWindow.addContenView(newtWindow.getAndroidView(), params)} * and finally calls {@link #registerNEWTWindow(Window)}. - *
+ * * @param androidWindow * @param newtWindow * @param params @@ -151,8 +151,8 @@ public class NewtBaseActivity extends Activity { final WindowDriver newtAWindow = (WindowDriver)delegateWindow; androidWindow.addContentView(newtAWindow.getAndroidView(), params); } else { - throw new IllegalArgumentException("Given NEWT Window's Delegate is not an Android Window: "+delegateWindow.getClass().getName()); - } + throw new IllegalArgumentException("Given NEWT Window's Delegate is not an Android Window: "+delegateWindow.getClass().getName()); + } registerNEWTWindow(newtWindow); } /** @@ -161,15 +161,15 @@ public class NewtBaseActivity extends Activity { * This methods registers the given NEWT window to ensure it's destruction at {@link #onDestroy()}. * *- * If adding a {@link GLAutoDrawable} implementation, the {@link GLAnimatorControl} retrieved by {@link GLAutoDrawable#getAnimator()} + * If adding a {@link GLAutoDrawable} implementation, the {@link GLAnimatorControl} retrieved by {@link GLAutoDrawable#getAnimator()} * will be used for {@link #onPause()} and {@link #onResume()}. *
*- * If adding a {@link GLAutoDrawable} implementation, the {@link GLEventListenerState} will preserve it's state - * when {@link #onPause()} is being called while not {@link #isFinishing()}. A later {@link #onResume()} will + * If adding a {@link GLAutoDrawable} implementation, the {@link GLEventListenerState} will preserve it's state + * when {@link #onPause()} is being called while not {@link #isFinishing()}. A later {@link #onResume()} will * reinstate the {@link GLEventListenerState}. *
- * + * * @param newtWindow * @throws IllegalArgumentException if thenewtWindow
's {@link Window#getDelegatedWindow() delegate} is not an AndroidDriver.
* @see #setContentView(android.view.Window, Window)
@@ -182,8 +182,8 @@ public class NewtBaseActivity extends Activity {
final WindowDriver newtAWindow = (WindowDriver)delegateWindow;
newtAWindow.registerActivity(getActivity());
} else {
- throw new IllegalArgumentException("Given NEWT Window's Delegate is not an Android Window: "+delegateWindow.getClass().getName());
- }
+ throw new IllegalArgumentException("Given NEWT Window's Delegate is not an Android Window: "+delegateWindow.getClass().getName());
+ }
newtWindows.add(newtWindow);
if(newtWindow instanceof GLAutoDrawable) {
glAutoDrawables.add((GLAutoDrawable)newtWindow);
@@ -203,9 +203,9 @@ public class NewtBaseActivity extends Activity {
startAnimation(true);
}
};
-
+
/**
- * Convenient method to set the Android window's flags to fullscreen or size-layout depending on the given NEWT window.
+ * Convenient method to set the Android window's flags to fullscreen or size-layout depending on the given NEWT window.
* * Must be called before creating the view and adding any content, i.e. setContentView() ! *
@@ -216,7 +216,7 @@ public class NewtBaseActivity extends Activity { if(null == androidWindow || null == newtWindow) { throw new IllegalArgumentException("Android or NEWT Window null"); } - + if( newtWindow.isFullscreen() || newtWindow.isUndecorated() ) { androidWindow.requestFeature(android.view.Window.FEATURE_NO_TITLE); } @@ -225,16 +225,16 @@ public class NewtBaseActivity extends Activity { androidWindow.clearFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN); } else { androidWindow.addFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN); - androidWindow.clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN); + androidWindow.clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN); + } + + if(newtWindow.getWindowWidth()>0 && newtWindow.getWindowHeight()>0 && !newtWindow.isFullscreen()) { + androidWindow.setLayout(newtWindow.getWindowWidth(), newtWindow.getWindowHeight()); } - - if(newtWindow.getSurfaceWidth()>0 && newtWindow.getSurfaceHeight()>0 && !newtWindow.isFullscreen()) { - androidWindow.setLayout(newtWindow.getSurfaceWidth(), newtWindow.getSurfaceHeight()); - } } /** - * Convenient method to set the Android window's flags to fullscreen or size-layout depending on the given NEWT window. + * Convenient method to set the Android window's flags to fullscreen or size-layout depending on the given NEWT window. ** Must be called before creating the view and adding any content, i.e. setContentView() ! *
@@ -245,7 +245,7 @@ public class NewtBaseActivity extends Activity { if(null == androidWindow) { throw new IllegalArgumentException("Android or Window null"); } - + if( fullscreen ) { androidWindow.requestFeature(android.view.Window.FEATURE_NO_TITLE); androidWindow.addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN); @@ -255,9 +255,9 @@ public class NewtBaseActivity extends Activity { androidWindow.clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN); } } - + /** - * Convenient method to set this context's theme to transparency depending on {@link CapabilitiesImmutable#isBackgroundOpaque()}. + * Convenient method to set this context's theme to transparency depending on {@link CapabilitiesImmutable#isBackgroundOpaque()}. ** Must be called before creating the view and adding any content, i.e. setContentView() ! *
@@ -267,7 +267,7 @@ public class NewtBaseActivity extends Activity { setTransparencyTheme(); } } - + /** * Convenient method to set this context's theme to transparency. *@@ -279,12 +279,12 @@ public class NewtBaseActivity extends Activity { *
** Can be called only once. - *
+ * */ public void setTransparencyTheme() { if(!setThemeCalled) { setThemeCalled = true; - final Context ctx = getActivity().getApplicationContext(); + final Context ctx = getActivity().getApplicationContext(); final String frn = ctx.getPackageName()+":style/Theme.Transparent"; final int resID = ctx.getResources().getIdentifier("Theme.Transparent", "style", ctx.getPackageName()); if(0 == resID) { @@ -295,14 +295,14 @@ public class NewtBaseActivity extends Activity { } } } - + /** * Setting up a global {@Link GLAnimatorControl} for {@link #onPause()} and {@link #onResume()}. ** Note that if adding a {@link GLAutoDrawable} implementation via {@link #registerNEWTWindow(Window)}, * {@link #setContentView(android.view.Window, Window)} or {@link #addContentView(android.view.Window, Window, android.view.ViewGroup.LayoutParams)} * their {@link GLAnimatorControl} retrieved by {@link GLAutoDrawable#getAnimator()} will be used as well. - * In this case, using this global {@Link GLAnimatorControl} is redundant. + * In this case, using this global {@Link GLAnimatorControl} is redundant. *
* @see #registerNEWTWindow(Window) * @see #setContentView(android.view.Window, Window) @@ -315,7 +315,7 @@ public class NewtBaseActivity extends Activity { } animator.pause(); } - + @Override public android.view.Window getWindow() { if( isDelegatedActivity() ) { @@ -324,22 +324,22 @@ public class NewtBaseActivity extends Activity { return super.getWindow(); } } - + @Override public void onCreate(Bundle savedInstanceState) { Log.d(MD.TAG, "onCreate.0"); if(!isDelegatedActivity()) { super.onCreate(savedInstanceState); } - // Extraordinary cleanup, for cases of 'onCreate()' calls w/ valid states, + // Extraordinary cleanup, for cases of 'onCreate()' calls w/ valid states, // i.e. w/o having onDestroy() being called. // Could happened due to spec when App process is killed for memory exhaustion or other reasons. cleanup(); - + jogamp.common.os.android.StaticContext.init(rootActivity.getApplicationContext()); Log.d(MD.TAG, "onCreate.X"); } - + @Override public void onStart() { Log.d(MD.TAG, "onStart.0"); @@ -348,7 +348,7 @@ public class NewtBaseActivity extends Activity { } Log.d(MD.TAG, "onStart.X"); } - + @Override public void onRestart() { Log.d(MD.TAG, "onRestart.0"); @@ -407,11 +407,11 @@ public class NewtBaseActivity extends Activity { win.setVisible(false); } if( !isDelegatedActivity() ) { - super.onStop(); + super.onStop(); } Log.d(MD.TAG, "onStop.X"); } - + /** * Performs cleaning up all references, *
@@ -450,14 +450,14 @@ public class NewtBaseActivity extends Activity {
jogamp.common.os.android.StaticContext.clear();
Log.d(MD.TAG, "cleanup.X");
}
-
+
@Override
public void onDestroy() {
Log.d(MD.TAG, "onDestroy.0");
cleanup(); // normal cleanup
if(!isDelegatedActivity()) {
- super.onDestroy();
+ super.onDestroy();
}
Log.d(MD.TAG, "onDestroy.X");
- }
+ }
}
diff --git a/src/newt/classes/jogamp/newt/driver/android/WindowDriver.java b/src/newt/classes/jogamp/newt/driver/android/WindowDriver.java
index 20163f96c..93ff0c1e0 100644
--- a/src/newt/classes/jogamp/newt/driver/android/WindowDriver.java
+++ b/src/newt/classes/jogamp/newt/driver/android/WindowDriver.java
@@ -304,7 +304,7 @@ public class WindowDriver extends jogamp.newt.WindowImpl implements Callback2 {
if(null == androidView) {
setupAndroidView( StaticContext.getContext() );
}
- viewGroup.addView(androidView, new android.widget.FrameLayout.LayoutParams(getSurfaceWidth(), getSurfaceHeight(), Gravity.BOTTOM|Gravity.RIGHT));
+ viewGroup.addView(androidView, new android.widget.FrameLayout.LayoutParams(getWindowWidth(), getWindowHeight(), Gravity.BOTTOM|Gravity.RIGHT));
Log.d(MD.TAG, "canCreateNativeImpl: added to static ViewGroup - on thread "+Thread.currentThread().getName());
} });
for(long sleep = TIMEOUT_NATIVEWINDOW; 0