diff options
-rw-r--r-- | src/newt/classes/jogamp/newt/driver/android/AndroidWindow.java | 77 | ||||
-rw-r--r-- | src/test/com/jogamp/opengl/test/android/NEWTGearsES2TransActivity.java | 4 |
2 files changed, 43 insertions, 38 deletions
diff --git a/src/newt/classes/jogamp/newt/driver/android/AndroidWindow.java b/src/newt/classes/jogamp/newt/driver/android/AndroidWindow.java index 2c7031dae..cd3cb489f 100644 --- a/src/newt/classes/jogamp/newt/driver/android/AndroidWindow.java +++ b/src/newt/classes/jogamp/newt/driver/android/AndroidWindow.java @@ -175,13 +175,23 @@ public class AndroidWindow extends jogamp.newt.WindowImpl implements Callback2 { // statement if back-porting this code to older SDKs. // sh.setType(SurfaceHolder.SURFACE_TYPE_GPU); // sh.setType(SurfaceHolder.SURFACE_TYPE_NORMAL); + + // default size -> TBD ! + this.width = 0; + this.height = 0; } public SurfaceView getAndroidView() { return androidView; } public void setAndroidWindow(android.view.Window window) { + System.err.println("setandroidWindow: "+window+", "+width+"x"+height); androidWindow = window; - androidSetupFullscreen(); + androidWindowConfigurationPreCreate(); + if(width>0 && height>0 && !isFullscreen()) { + if(null != androidWindow) { + androidWindow.setLayout(width, height); + } + } } public android.view.Window getAndroidWindow() { return androidWindow; } @@ -249,11 +259,15 @@ public class AndroidWindow extends jogamp.newt.WindowImpl implements Callback2 { protected void requestFocusImpl(boolean reparented) { } - protected void androidSetupFullscreen() { - if( null != androidWindow && isFullscreen() ) { - androidWindow.requestFeature(Window.FEATURE_NO_TITLE); - androidWindow.setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, - WindowManager.LayoutParams.FLAG_FULLSCREEN); + protected void androidWindowConfigurationPreCreate() { + if( null != androidWindow) { + if( isFullscreen() || isUndecorated() ) { + androidWindow.requestFeature(Window.FEATURE_NO_TITLE); + } + if( isFullscreen() ) { + androidWindow.setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, + WindowManager.LayoutParams.FLAG_FULLSCREEN); + } } } @@ -315,8 +329,6 @@ public class AndroidWindow extends jogamp.newt.WindowImpl implements Callback2 { public void surfaceCreated(SurfaceHolder holder) { Log.d(MD.TAG, "surfaceCreated: "+x+"/"+y+" "+width+"x"+height); - // surfaceRealized(holder); - Log.d(MD.TAG, "surfaceCreated: X"); } public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) { @@ -333,43 +345,34 @@ public class AndroidWindow extends jogamp.newt.WindowImpl implements Callback2 { } getScreen().getCurrentScreenMode(); // if ScreenMode changed .. trigger ScreenMode event + if(0>x || 0>y) { + x = 0; + y = 0; + positionChanged(false, 0, 0); + } + if(0 == surfaceHandle) { - surfaceRealized(holder); - } else { - if(0>x || 0>y) { - x = 0; - y = 0; - positionChanged(false, 0, 0); + surface = holder.getSurface(); + surfaceHandle = getSurfaceHandle0(surface); + acquire0(surfaceHandle); + format = getSurfaceVisualID0(surfaceHandle); + capsByFormat = (GLCapabilitiesImmutable) fixCaps(format, getRequestedCapabilities()); + sizeChanged(false, getWidth0(surfaceHandle), getHeight0(surfaceHandle), false); + + Log.d(MD.TAG, "surfaceRealized: isValid: "+surface.isValid()+ + ", new surfaceHandle 0x"+Long.toHexString(surfaceHandle)+", format: "+format+ + ", "+x+"/"+y+" "+width+"x"+height+", visible: "+isVisible()); + + if(isVisible()) { + setVisible(true); } + } else { sizeChanged(false, width, height, false); } windowRepaint(0, 0, width, height); Log.d(MD.TAG, "surfaceChanged: X"); } - private void surfaceRealized(SurfaceHolder holder) { - surface = holder.getSurface(); - surfaceHandle = getSurfaceHandle0(surface); - acquire0(surfaceHandle); - format = getSurfaceVisualID0(surfaceHandle); - capsByFormat = (GLCapabilitiesImmutable) fixCaps(format, getRequestedCapabilities()); - if(0>x || 0>y) { - x = 0; - y = 0; - positionChanged(false, 0, 0); - } - sizeChanged(false, getWidth0(surfaceHandle), getHeight0(surfaceHandle), false); - - Log.d(MD.TAG, "surfaceRealized: isValid: "+surface.isValid()+ - ", new surfaceHandle 0x"+Long.toHexString(surfaceHandle)+", format: "+format+ - ", "+x+"/"+y+" "+width+"x"+height); - - if(isVisible()) { - setVisible(true); - } - Log.d(MD.TAG, "surfaceRealized: X"); - } - public void surfaceDestroyed(SurfaceHolder holder) { Log.d(MD.TAG, "surfaceDestroyed"); windowDestroyNotify(); diff --git a/src/test/com/jogamp/opengl/test/android/NEWTGearsES2TransActivity.java b/src/test/com/jogamp/opengl/test/android/NEWTGearsES2TransActivity.java index 1862b1ba1..84ff0a5a7 100644 --- a/src/test/com/jogamp/opengl/test/android/NEWTGearsES2TransActivity.java +++ b/src/test/com/jogamp/opengl/test/android/NEWTGearsES2TransActivity.java @@ -55,7 +55,9 @@ public class NEWTGearsES2TransActivity extends NewtBaseActivity { caps.setBackgroundOpaque(false); Log.d(TAG, "req caps: "+caps); GLWindow glWindow = GLWindow.create(caps); - glWindow.setFullscreen(true); + glWindow.setSize(300, 300); + // glWindow.setFullscreen(true); + glWindow.setUndecorated(true); setContentView(getWindow(), glWindow); glWindow.addGLEventListener(new GearsES2(1)); |