aboutsummaryrefslogtreecommitdiffstats
path: root/src/newt/classes
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2012-08-23 21:07:55 +0200
committerSven Gothel <[email protected]>2012-08-23 21:07:55 +0200
commitab3ec08822e7958943686a7ba5157a4ff314e7ac (patch)
tree70676c663c3412c946c872b2f1f00abe30d82ecd /src/newt/classes
parent6d241fc2a46413ee478985d676d2481c5a7ed119 (diff)
Fix Android/NEWT WindowDriver: Add missing eglDestroySurface() in closeNativeImpl(); Complete visibleChanged() in reconfigureWindowImpl() even if resize or reposition can't be handled
Add missing eglDestroySurface() in closeNativeImpl() - missing egl surface destruction leaked it's resource .. Complete visibleChanged() in reconfigureWindowImpl() even if resize or reposition can't be handled - properly detect resize and reposition request, warn if this action cannot be completed but contine w/ workflow -> visibleChanged() - this allows properly handling of setVisible(..) and it's visible-changed detection polling
Diffstat (limited to 'src/newt/classes')
-rw-r--r--src/newt/classes/jogamp/newt/driver/android/WindowDriver.java36
1 files changed, 27 insertions, 9 deletions
diff --git a/src/newt/classes/jogamp/newt/driver/android/WindowDriver.java b/src/newt/classes/jogamp/newt/driver/android/WindowDriver.java
index 8ad11b35f..276b0d070 100644
--- a/src/newt/classes/jogamp/newt/driver/android/WindowDriver.java
+++ b/src/newt/classes/jogamp/newt/driver/android/WindowDriver.java
@@ -39,6 +39,7 @@ import javax.media.nativewindow.util.Insets;
import javax.media.nativewindow.util.Point;
import javax.media.opengl.GLCapabilitiesChooser;
import javax.media.opengl.GLCapabilitiesImmutable;
+import javax.media.opengl.GLException;
import com.jogamp.nativewindow.egl.EGLGraphicsDevice;
@@ -263,15 +264,24 @@ public class WindowDriver extends jogamp.newt.WindowImpl implements Callback2 {
setGraphicsConfiguration(eglConfig);
setWindowHandle(surfaceHandle);
focusChanged(false, true);
- Log.d(MD.TAG, "createNativeImpl X");
+ Log.d(MD.TAG, "createNativeImpl X: eglSurfaceHandle 0x"+Long.toHexString(eglSurface));
}
@Override
protected void closeNativeImpl() {
+ Log.d(MD.TAG, "closeNativeImpl 0 - surfaceHandle 0x"+Long.toHexString(surfaceHandle)+
+ ", eglSurfaceHandle 0x"+Long.toHexString(eglSurface)+
+ ", format [a "+androidFormat+", n "+nativeFormat+"], "+getX()+"/"+getY()+" "+getWidth()+"x"+getHeight()+" - "+Thread.currentThread().getName());
+ if(0 != eglSurface) {
+ final EGLGraphicsDevice eglDevice = (EGLGraphicsDevice) getScreen().getDisplay().getGraphicsDevice();
+ if (!EGL.eglDestroySurface(eglDevice.getHandle(), eglSurface)) {
+ throw new GLException("Error destroying window surface (eglDestroySurface)");
+ }
+ eglSurface = 0;
+ }
release0(surfaceHandle);
surface = null;
surfaceHandle = 0;
- eglSurface = 0;
}
@Override
@@ -291,25 +301,33 @@ public class WindowDriver extends jogamp.newt.WindowImpl implements Callback2 {
}
}
- protected boolean reconfigureWindowImpl(int x, int y, int width, int height, int flags) {
+ protected boolean reconfigureWindowImpl(int x, int y, int width, int height, int flags) {
+ boolean res = true;
+
if( 0 != ( FLAG_CHANGE_FULLSCREEN & flags) ) {
Log.d(MD.TAG, "reconfigureWindowImpl.setFullscreen post creation (setContentView()) n/a");
return false;
}
- if(width>0 || height>0) {
+ if(getWidth() != width || getHeight() != height) {
if(0!=getWindowHandle()) {
Log.d(MD.TAG, "reconfigureWindowImpl.setSize n/a");
- return false;
+ res = false;
+ } else {
+ defineSize(width, height);
}
}
- if(x>=0 || y>=0) {
- Log.d(MD.TAG, "reconfigureWindowImpl.setPos n/a");
- return false;
+ if(getX() != x || getY() != y) {
+ if(0!=getWindowHandle()) {
+ Log.d(MD.TAG, "reconfigureWindowImpl.setPos n/a");
+ res = false;
+ } else {
+ definePosition(x, y);
+ }
}
if( 0 != ( FLAG_CHANGE_VISIBILITY & flags) ) {
visibleChanged(false, 0 != ( FLAG_IS_VISIBLE & flags));
}
- return true;
+ return res;
}
protected Point getLocationOnScreenImpl(int x, int y) {