summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2014-01-11 07:27:15 +0100
committerSven Gothel <[email protected]>2014-01-11 07:27:15 +0100
commit6ea03078e162eed89653ae123d172b6fca7c6d61 (patch)
tree257f5298d499af876de1b8a4043d1f9fe10b9107
parent6647b4a63866a554c738e0b7b61e6dc40a6fb511 (diff)
Misc Cleanup: JAWTWindow: Reusing visible in HIERARCHY listener; Remove obsolete 'getPrivateGraphicsConfiguration()'
-rw-r--r--src/jogl/classes/jogamp/opengl/GLDrawableHelper.java10
-rw-r--r--src/jogl/classes/jogamp/opengl/GLFBODrawableImpl.java4
-rw-r--r--src/nativewindow/classes/com/jogamp/nativewindow/awt/JAWTWindow.java27
-rw-r--r--src/nativewindow/classes/jogamp/nativewindow/ProxySurfaceImpl.java6
-rw-r--r--src/newt/classes/jogamp/newt/WindowImpl.java7
5 files changed, 20 insertions, 34 deletions
diff --git a/src/jogl/classes/jogamp/opengl/GLDrawableHelper.java b/src/jogl/classes/jogamp/opengl/GLDrawableHelper.java
index 61735c487..c0bf43d2c 100644
--- a/src/jogl/classes/jogamp/opengl/GLDrawableHelper.java
+++ b/src/jogl/classes/jogamp/opengl/GLDrawableHelper.java
@@ -336,7 +336,7 @@ public class GLDrawableHelper {
}
final NativeSurface ns = drawable.getNativeSurface();
final int lockRes = ns.lockSurface();
- if (NativeSurface.LOCK_SURFACE_NOT_READY >= lockRes) {
+ if ( NativeSurface.LOCK_SURFACE_NOT_READY >= lockRes ) {
throw new NativeWindowException("Could not lock surface of drawable: "+drawable);
}
boolean validateSize = true;
@@ -345,10 +345,10 @@ public class GLDrawableHelper {
System.err.println("WARNING: Odd size detected: "+newWidth+"x"+newHeight+", using safe size 1x1. Drawable "+drawable);
Thread.dumpStack();
}
- if(0>=newWidth) { newWidth = 1; validateSize=false; }
- if(0>=newHeight) { newHeight = 1; validateSize=false; }
+ if( 0 >= newWidth ) { newWidth = 1; validateSize=false; }
+ if( 0 >= newHeight ) { newHeight = 1; validateSize=false; }
// propagate new size
- if(ns instanceof ProxySurface) {
+ if( ns instanceof ProxySurface ) {
final ProxySurface ps = (ProxySurface) ns;
final UpstreamSurfaceHook ush = ps.getUpstreamSurfaceHook();
if(ush instanceof UpstreamSurfaceHook.MutableSize) {
@@ -359,7 +359,7 @@ public class GLDrawableHelper {
} else if(DEBUG) { // we have to assume surface contains the new size already, hence size check @ bottom
System.err.println("GLDrawableHelper.resizeOffscreenDrawable: Drawable's offscreen surface n.a. ProxySurface, but "+ns.getClass().getName()+": "+ns);
}
- if(drawable instanceof GLFBODrawable) {
+ if( drawable instanceof GLFBODrawable ) {
if( null != context && context.isCreated() ) {
((GLFBODrawable) drawable).resetSize(context.getGL());
}
diff --git a/src/jogl/classes/jogamp/opengl/GLFBODrawableImpl.java b/src/jogl/classes/jogamp/opengl/GLFBODrawableImpl.java
index ab318927c..0e9d142ba 100644
--- a/src/jogl/classes/jogamp/opengl/GLFBODrawableImpl.java
+++ b/src/jogl/classes/jogamp/opengl/GLFBODrawableImpl.java
@@ -90,7 +90,7 @@ public class GLFBODrawableImpl extends GLDrawableImpl implements GLFBODrawable {
this.initialized = false;
this.parent = parent;
- this.origParentChosenCaps = (GLCapabilitiesImmutable) getChosenGLCapabilities(); // just to avoid null, will be reset at initialize(..)
+ this.origParentChosenCaps = getChosenGLCapabilities(); // just to avoid null, will be reset at initialize(..)
this.texUnit = textureUnit;
this.samples = fboCaps.getNumSamples();
fboResetQuirk = false;
@@ -552,7 +552,7 @@ public class GLFBODrawableImpl extends GLDrawableImpl implements GLFBODrawable {
",\n\tfboI back "+fboIBack+", front "+fboIFront+", num "+(initialized ? fbos.length : 0)+
",\n\tFBO front read "+getDefaultReadFramebuffer()+", "+getFBObject(GL.GL_FRONT)+
",\n\tFBO back write "+getDefaultDrawFramebuffer()+", "+getFBObject(GL.GL_BACK)+
- ",\n\tSurface "+getNativeSurface()+
+ ",\n\tSurface "+surface+
"]";
}
diff --git a/src/nativewindow/classes/com/jogamp/nativewindow/awt/JAWTWindow.java b/src/nativewindow/classes/com/jogamp/nativewindow/awt/JAWTWindow.java
index ddf513180..ed25a497f 100644
--- a/src/nativewindow/classes/com/jogamp/nativewindow/awt/JAWTWindow.java
+++ b/src/nativewindow/classes/com/jogamp/nativewindow/awt/JAWTWindow.java
@@ -220,30 +220,31 @@ public abstract class JAWTWindow implements NativeWindow, OffscreenLayerSurface,
if( 0 != ( java.awt.event.HierarchyEvent.DISPLAYABILITY_CHANGED & bits ) ) {
final boolean displayable = changed.isDisplayable();
final boolean propagateDisplayability = changed == component && ( displayable && localVisibility ) != compIsVisible;
+ final boolean visible = displayable && localVisibility;
+ final boolean propagateDisplayability = changed == component && visible != compIsVisible;
if( propagateDisplayability ) {
// Propagate parent's displayability, i.e. 'removeNotify()' and 'addNotify()'
- final boolean _visible = displayable && localVisibility;
visibilityPropagation = true;
globalVisibility = displayable;
if(DEBUG) {
- System.err.println(jawtStr()+".hierarchyChanged DISPLAYABILITY_CHANGED (1): displayable "+displayable+" -> visible "+_visible+", "+s(e));
+ System.err.println(jawtStr()+".hierarchyChanged DISPLAYABILITY_CHANGED (1): displayable "+displayable+" -> visible "+visible+", "+s(e));
}
- component.setVisible(_visible);
+ component.setVisible(visible);
} else if(DEBUG) {
System.err.println(jawtStr()+".hierarchyChanged DISPLAYABILITY_CHANGED (x): displayable "+displayable+", "+s(e));
}
} else if( 0 != ( java.awt.event.HierarchyEvent.SHOWING_CHANGED & bits ) ) {
final boolean showing = changed.isShowing();
- final boolean propagateVisibility = changed != component && ( showing && localVisibility ) != compIsVisible;
+ final boolean visible = showing && localVisibility;
+ final boolean propagateVisibility = changed != component && visible != compIsVisible;
if( propagateVisibility ) {
// Propagate parent's visibility
- final boolean _visible = showing && localVisibility;
visibilityPropagation = true;
globalVisibility = showing;
if(DEBUG) {
- System.err.println(jawtStr()+".hierarchyChanged SHOWING_CHANGED (1): showing "+showing+" -> visible "+_visible+", "+s(e));
+ System.err.println(jawtStr()+".hierarchyChanged SHOWING_CHANGED (1): showing "+showing+" -> visible "+visible+", "+s(e));
}
- component.setVisible(_visible);
+ component.setVisible(visible);
} else if( changed == component ) {
// Update component's local visibility state
if(!visibilityPropagation) {
@@ -251,10 +252,10 @@ public abstract class JAWTWindow implements NativeWindow, OffscreenLayerSurface,
}
visibilityPropagation = false;
if(DEBUG) {
- System.err.println(jawtStr()+".hierarchyChanged SHOWING_CHANGED (0): showing "+showing+" -> visible "+(showing && localVisibility)+", "+s(e));
+ System.err.println(jawtStr()+".hierarchyChanged SHOWING_CHANGED (0): showing "+showing+" -> visible "+visible+", "+s(e));
}
} else if(DEBUG) {
- System.err.println(jawtStr()+".hierarchyChanged SHOWING_CHANGED (x): showing "+showing+" -> visible "+(showing && localVisibility)+", "+s(e));
+ System.err.println(jawtStr()+".hierarchyChanged SHOWING_CHANGED (x): showing "+showing+" -> visible "+visible+", "+s(e));
}
} else if(DEBUG) {
final boolean displayable = changed.isDisplayable();
@@ -423,7 +424,7 @@ public abstract class JAWTWindow implements NativeWindow, OffscreenLayerSurface,
@Override
public final void setChosenCapabilities(CapabilitiesImmutable caps) {
((MutableGraphicsConfiguration)getGraphicsConfiguration()).setChosenCapabilities(caps);
- getPrivateGraphicsConfiguration().setChosenCapabilities(caps);
+ config.setChosenCapabilities(caps);
}
@Override
@@ -601,10 +602,6 @@ public abstract class JAWTWindow implements NativeWindow, OffscreenLayerSurface,
return drawable;
}
- public final AWTGraphicsConfiguration getPrivateGraphicsConfiguration() {
- return config;
- }
-
@Override
public final AbstractGraphicsConfiguration getGraphicsConfiguration() {
return config.getNativeGraphicsConfiguration();
@@ -792,7 +789,7 @@ public abstract class JAWTWindow implements NativeWindow, OffscreenLayerSurface,
sb.append(", pos "+getX()+"/"+getY()+", size "+getWidth()+"x"+getHeight()+
", visible "+component.isVisible());
sb.append(", lockedExt "+isSurfaceLockedByOtherThread()+
- ",\n\tconfig "+getPrivateGraphicsConfiguration()+
+ ",\n\tconfig "+config+
",\n\tawtComponent "+getAWTComponent()+
",\n\tsurfaceLock "+surfaceLock+"]");
diff --git a/src/nativewindow/classes/jogamp/nativewindow/ProxySurfaceImpl.java b/src/nativewindow/classes/jogamp/nativewindow/ProxySurfaceImpl.java
index 097fffead..fbff7128e 100644
--- a/src/nativewindow/classes/jogamp/nativewindow/ProxySurfaceImpl.java
+++ b/src/nativewindow/classes/jogamp/nativewindow/ProxySurfaceImpl.java
@@ -45,7 +45,7 @@ public abstract class ProxySurfaceImpl implements ProxySurface {
private AbstractGraphicsConfiguration config; // control access due to delegation
private UpstreamSurfaceHook upstream;
private long surfaceHandle_old;
- private RecursiveLock surfaceLock = LockFactory.createRecursiveLock();
+ private final RecursiveLock surfaceLock = LockFactory.createRecursiveLock();
private int implBitfield;
private boolean upstreamSurfaceHookLifecycleEnabled;
@@ -122,10 +122,6 @@ public abstract class ProxySurfaceImpl implements ProxySurface {
throw new InternalError("UpstreamSurfaceHook given, but required method not implemented.");
}
- protected final AbstractGraphicsConfiguration getPrivateGraphicsConfiguration() {
- return config;
- }
-
@Override
public final AbstractGraphicsConfiguration getGraphicsConfiguration() {
return config.getNativeGraphicsConfiguration();
diff --git a/src/newt/classes/jogamp/newt/WindowImpl.java b/src/newt/classes/jogamp/newt/WindowImpl.java
index f3bbd7a24..260ae4dd8 100644
--- a/src/newt/classes/jogamp/newt/WindowImpl.java
+++ b/src/newt/classes/jogamp/newt/WindowImpl.java
@@ -1927,13 +1927,6 @@ public abstract class WindowImpl implements Window, NEWTEventConsumer
windowDestroyNotifyAction = r;
}
- /**
- * Returns the non delegated {@link AbstractGraphicsConfiguration},
- * see {@link #getGraphicsConfiguration()}. */
- public final AbstractGraphicsConfiguration getPrivateGraphicsConfiguration() {
- return config;
- }
-
protected final long getParentWindowHandle() {
return isFullscreen() ? 0 : parentWindowHandle;
}